treewide: Format with shellcheck, jsonlint and yamllint

This commit is contained in:
2025-12-29 12:41:13 +01:00
parent d7e4fb43cb
commit f81a4b2732
53 changed files with 313 additions and 220 deletions
+1
View File
@@ -1,6 +1,7 @@
*.tgz *.tgz
_*/ _*/
.direnv/ .direnv/
.env
.pre-commit-config.yaml .pre-commit-config.yaml
_*.yaml _*.yaml
backup/ backup/
+29 -22
View File
@@ -6,39 +6,46 @@ let
values = lib.apps.appValues { values = lib.apps.appValues {
inherit env; inherit env;
base = ../values/atlantis; base = ../values/atlantis;
extraValues = {}; extraValues = { };
}; };
kustomize = r: kustomize =
r:
if r.kind == "Deployment" then if r.kind == "Deployment" then
lib.attrsets.recursiveUpdate r { lib.attrsets.recursiveUpdate r {
spec.template.spec.containers = spec.template.spec.containers = builtins.map (
builtins.map (x: x:
x // { x
// {
livenessProbe.httpGet.path = "/healthz"; livenessProbe.httpGet.path = "/healthz";
readinessProble.httpGet.path = "/healthz"; readinessProble.httpGet.path = "/healthz";
env = x.env ++ [ { name = "INERNAL_PORT"; value = 8000; } ]; env = x.env ++ [
}) r.spec.template.spec.containers; {
name = "INERNAL_PORT";
value = 8000;
}
];
}
) r.spec.template.spec.containers;
} }
else if r.kind == "Service" then else if r.kind == "Service" then
{} { }
else r; else
r;
in in
{ {
options.apps.atlantis = lib.apps.appOptions { options.apps.atlantis = lib.apps.appOptions {
revision = lib.mkOption { revision = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "main"; default = "main";
description = "Revision"; description = "Revision";
}; };
hostname = lib.mkOption { hostname = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = if env == "prod" default = if env == "prod" then "maps.oceanbox.io" else "atlantis.beta.oceanbox.io";
then "maps.oceanbox.io" description = "Revision";
else "atlantis.beta.oceanbox.io"; };
description = "Revision";
};
}; };
config = lib.apps.appConfig cfg "${env}-atlantis" { config = lib.apps.appConfig cfg "${env}-atlantis" {
+23 -25
View File
@@ -6,34 +6,32 @@ let
values = lib.apps.appValues { values = lib.apps.appValues {
inherit env; inherit env;
base = ../values/openfga; base = ../values/openfga;
extraValues = {}; extraValues = { };
}; };
kustomize = r: kustomize =
if r.kind == "Job" then r: if r.kind == "Job" then lib.attrsets.recursiveUpdate r { spec.backoffLimit = 2; } else r;
lib.attrsets.recursiveUpdate r { spec.backoffLimit = 2; }
else r;
in in
{ {
options.apps.openfga = lib.apps.appOptions {}; options.apps.openfga = lib.apps.appOptions { };
config = lib.apps.appConfig cfg "${env}-openfga" { config = lib.apps.appConfig cfg "${env}-openfga" {
helm.releases."${env}-openfga" = { helm.releases."${env}-openfga" = {
inherit values; inherit values;
chart = lib.helm.downloadHelmChart { chart = lib.helm.downloadHelmChart {
repo = "https://openfga.github.io/helm-charts"; repo = "https://openfga.github.io/helm-charts";
chart = "openfga"; chart = "openfga";
version = "0.2.12"; version = "0.2.12";
chartHash = "sha256-7yLcw9/oNPvCePrtTJwKAG88t0Ym5Dl/S83Gz+gQdDU="; chartHash = "sha256-7yLcw9/oNPvCePrtTJwKAG88t0Ym5Dl/S83Gz+gQdDU=";
};
transformer = rs: builtins.map (x: kustomize x) rs;
};
annotations = {};
resources = {
services.poop.spec = {
};
};
}; };
} transformer = rs: builtins.map (x: kustomize x) rs;
};
annotations = { };
resources = {
services.poop.spec = {
};
};
};
}
+3 -3
View File
@@ -46,19 +46,19 @@ spec:
{{ end }} {{ end }}
cleanupController: cleanupController:
resources: resources:
limits: limits:
memory: {{ .Values.kyverno.resources.cleanupController.memory }} memory: {{ .Values.kyverno.resources.cleanupController.memory }}
requests: requests:
memory: {{ .Values.kyverno.resources.cleanupController.memory }} memory: {{ .Values.kyverno.resources.cleanupController.memory }}
reportsController: reportsController:
resources: resources:
limits: limits:
memory: {{ .Values.kyverno.resources.reportsController.memory }} memory: {{ .Values.kyverno.resources.reportsController.memory }}
requests: requests:
memory: {{ .Values.kyverno.resources.reportsController.memory }} memory: {{ .Values.kyverno.resources.reportsController.memory }}
backgroundController: backgroundController:
resources: resources:
limits: limits:
memory: {{ .Values.kyverno.resources.backgroundController.memory }} memory: {{ .Values.kyverno.resources.backgroundController.memory }}
requests: requests:
memory: {{ .Values.kyverno.resources.backgroundController.memory }} memory: {{ .Values.kyverno.resources.backgroundController.memory }}
+4 -4
View File
@@ -27,17 +27,17 @@ spec:
scheme: {{ .Values.linkerd.secretScheme }} scheme: {{ .Values.linkerd.secretScheme }}
{{- if .Values.linkerd.identityIssuerPEM }} {{- if .Values.linkerd.identityIssuerPEM }}
tls: tls:
crtPEM: {{- .Values.linkerd.identityIssuerPEM | toYaml | indent 14 }} crtPEM: {{- .Values.linkerd.identityIssuerPEM | toYaml | indent 14 }}
{{- end }} {{- end }}
policyValidator: policyValidator:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
proxyInjector: proxyInjector:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
profileValidator: profileValidator:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
project: sys project: sys
syncPolicy: syncPolicy:
+1 -1
View File
@@ -16,7 +16,7 @@ spec:
helm: helm:
values: | values: |
containerPort: 10250 containerPort: 10250
resources: resources:
requests: requests:
cpu: 100m cpu: 100m
memory: 200Mi memory: 200Mi
+1 -1
View File
@@ -53,7 +53,7 @@ spec:
endpoint: "tempo.tempo.svc:4317" endpoint: "tempo.tempo.svc:4317"
tls: tls:
insecure: true insecure: true
## ##
otlphttp/metrics: otlphttp/metrics:
endpoint: http://prom-prometheus.prometheus:9090/api/v1/otlp endpoint: http://prom-prometheus.prometheus:9090/api/v1/otlp
tls: tls:
@@ -12,8 +12,8 @@ metadata:
policies.kyverno.io/minversion: 1.7.0 policies.kyverno.io/minversion: 1.7.0
kyverno.io/kubernetes-version: "1.23" kyverno.io/kubernetes-version: "1.23"
policies.kyverno.io/description: >- policies.kyverno.io/description: >-
Customers should not have full admin permissions on their own namespaces. Customers should not have full admin permissions on their own namespaces.
This policy will generate a RoleBinding, binding their group_id to This policy will generate a RoleBinding, binding their group_id to
the Cluster-Admin clusterrole. This will still only apply to the namespace as the Cluster-Admin clusterrole. This will still only apply to the namespace as
the resource is a rolebinding, not clusterrolebinding. the resource is a rolebinding, not clusterrolebinding.
This policy should not trigger on any namespaces with label component=sys This policy should not trigger on any namespaces with label component=sys
@@ -24,7 +24,7 @@ spec:
grafana_folder: Prometheus-stack grafana_folder: Prometheus-stack
targets: targets:
- apiVersion: v1 - apiVersion: v1
kind: ConfigMap kind: ConfigMap
name: "{{`{{ request.object.metadata.name }}`}}" name: "{{`{{ request.object.metadata.name }}`}}"
name: generate-dashboard-folder-annotation name: generate-dashboard-folder-annotation
skipBackgroundRequests: true skipBackgroundRequests: true
+1 -1
View File
@@ -13,7 +13,7 @@ metadata:
is time consuming and error prone. This policy will copy a is time consuming and error prone. This policy will copy a
Secret called `regcred` which exists in the `default` Namespace to Secret called `regcred` which exists in the `default` Namespace to
new Namespaces when they are created. It will also push updates to new Namespaces when they are created. It will also push updates to
the copied Secrets should the source Secret be changed. the copied Secrets should the source Secret be changed.
spec: spec:
rules: rules:
- name: sync-image-pull-secret - name: sync-image-pull-secret
@@ -9,12 +9,12 @@ metadata:
policies.kyverno.io/severity: medium policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Ingress policies.kyverno.io/subject: Ingress
policies.kyverno.io/description: >- policies.kyverno.io/description: >-
Ingresses with the label "internal=true" should be whitelisted. Ingresses with the label "internal=true" should be whitelisted.
If no whitelist exists, add the default values, otherwise append If no whitelist exists, add the default values, otherwise append
whitelist to the already existing ones whitelist to the already existing ones
spec: spec:
mutateExistingOnPolicyUpdate: false mutateExistingOnPolicyUpdate: false
#precondition: has whitelist annotation or #precondition: has whitelist annotation or
rules: rules:
- name: ensure-nginx-whitelist-exists - name: ensure-nginx-whitelist-exists
match: match:
@@ -32,7 +32,7 @@ data:
} }
], ],
"__elements":{ "__elements":{
}, },
"__requires":[ "__requires":[
{ {
@@ -70,7 +70,7 @@ data:
"limit":100, "limit":100,
"matchAny":false, "matchAny":false,
"tags":[ "tags":[
], ],
"type":"dashboard" "type":"dashboard"
}, },
@@ -83,7 +83,7 @@ data:
"graphTooltip":0, "graphTooltip":0,
"id":null, "id":null,
"links":[ "links":[
], ],
"liveNow":false, "liveNow":false,
"panels":[ "panels":[
@@ -130,7 +130,7 @@ data:
} }
}, },
"mappings":[ "mappings":[
], ],
"thresholds":{ "thresholds":{
"mode":"absolute", "mode":"absolute",
@@ -195,7 +195,7 @@ data:
"options":{ "options":{
"legend":{ "legend":{
"calcs":[ "calcs":[
], ],
"displayMode":"list", "displayMode":"list",
"placement":"bottom", "placement":"bottom",
@@ -255,7 +255,7 @@ data:
"multi":false, "multi":false,
"name":"DS_PROMETHEUS", "name":"DS_PROMETHEUS",
"options":[ "options":[
], ],
"query":"prometheus", "query":"prometheus",
"refresh":1, "refresh":1,
@@ -266,7 +266,7 @@ data:
}, },
{ {
"current":{ "current":{
}, },
"datasource":{ "datasource":{
"type":"prometheus", "type":"prometheus",
@@ -279,7 +279,7 @@ data:
"multi":false, "multi":false,
"name":"namespace", "name":"namespace",
"options":[ "options":[
], ],
"query":{ "query":{
"query":"label_values(rabbitmq_identity_info, namespace)", "query":"label_values(rabbitmq_identity_info, namespace)",
@@ -296,7 +296,7 @@ data:
}, },
{ {
"current":{ "current":{
}, },
"datasource":{ "datasource":{
"type":"prometheus", "type":"prometheus",
@@ -309,7 +309,7 @@ data:
"multi":false, "multi":false,
"name":"rabbitmq_cluster", "name":"rabbitmq_cluster",
"options":[ "options":[
], ],
"query":{ "query":{
"query":"label_values(rabbitmq_identity_info{namespace=\"$namespace\"}, rabbitmq_cluster)", "query":"label_values(rabbitmq_identity_info{namespace=\"$namespace\"}, rabbitmq_cluster)",
@@ -326,7 +326,7 @@ data:
}, },
{ {
"current":{ "current":{
}, },
"datasource":{ "datasource":{
"type":"prometheus", "type":"prometheus",
@@ -339,7 +339,7 @@ data:
"multi":false, "multi":false,
"name":"queue", "name":"queue",
"options":[ "options":[
], ],
"query":{ "query":{
"query":"query_result(rabbitmq_detailed_queue_messages{namespace=\"$namespace\"} * on (instance, job) group_left(rabbitmq_cluster) rabbitmq_identity_info{namespace=\"$namespace\", rabbitmq_cluster=\"$rabbitmq_cluster\"})", "query":"query_result(rabbitmq_detailed_queue_messages{namespace=\"$namespace\"} * on (instance, job) group_left(rabbitmq_cluster) rabbitmq_identity_info{namespace=\"$namespace\", rabbitmq_cluster=\"$rabbitmq_cluster\"})",
@@ -361,7 +361,7 @@ data:
"to":"now" "to":"now"
}, },
"timepicker":{ "timepicker":{
}, },
"timezone":"", "timezone":"",
"title":"RabbitMQ-Queue", "title":"RabbitMQ-Queue",
@@ -37,7 +37,7 @@ rules:
resources: resources:
- events - events
verbs: ["*"] verbs: ["*"]
- nonResourceURLs: ["*"] - nonResourceURLs: ["*"]
verbs: ["*"] verbs: ["*"]
- apiGroups: - apiGroups:
@@ -139,8 +139,8 @@ spec:
resources: {} resources: {}
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
command: command:
- "/bin/sh" - "/bin/sh"
- -c - -c
- /tmp/renew-certs/renew-certs.sh - /tmp/renew-certs/renew-certs.sh
volumeMounts: volumeMounts:
@@ -216,7 +216,7 @@ metadata:
name: default-deny-egress name: default-deny-egress
namespace: cert-manager namespace: cert-manager
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels:
block-egress: "true" block-egress: "true"
policyTypes: policyTypes:
@@ -42,8 +42,8 @@ spec:
resources: {} resources: {}
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
command: command:
- "/bin/sh" - "/bin/sh"
- -c - -c
- /tmp/renew-certs/renew-certs.sh - /tmp/renew-certs/renew-certs.sh
volumeMounts: volumeMounts:
@@ -119,7 +119,7 @@ metadata:
name: default-deny-egress name: default-deny-egress
namespace: gitlab namespace: gitlab
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels:
block-egress: "true" block-egress: "true"
policyTypes: policyTypes:
-3
View File
@@ -1,7 +1,4 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
+1 -1
View File
@@ -1,4 +1,4 @@
# Oceanbox IdP # Oceanbox IdP
``` ```
npm install && npm start npm install && npm start
+7 -7
View File
@@ -2,16 +2,16 @@
server="root@fs1-0" server="root@fs1-0"
path="/vol/brick0/nfs0/k1/pv-oceanbox-dex" path="/vol/brick0/nfs0/k1/pv-oceanbox-dex"
dest="$server:$path" dest="${server}:${path}"
index=$(basename dist/assets/index-*.js) index=$(basename dist/assets/index-*.js)
ssh $server -- rm $path/static/js/*.js ssh "${server}" -- rm "${path}"/static/js/*.js
scp dist/assets/*.js $dest/static/js/ scp dist/assets/*.js "${dest}"/static/js/
sed -r "s/@index@/$index/" ./dex/templates/login.html > login.html.$$ sed -r "s/@index@/${index}/" ./dex/templates/login.html > login.html.$$
scp ./dex/templates/* $dest/templates/ scp ./dex/templates/* "${dest}"/templates/
scp ./dex/static/*.* $dest/static/ scp ./dex/static/*.* "${dest}"/static/
scp login.html.$$ $dest/templates/login.html scp login.html.$$ "${dest}"/templates/login.html
rm login.html.$$ rm login.html.$$
ssh admin@k1-0.itpartner.intern -- kubectl rollout restart -n oceanbox deployment/dex ssh admin@k1-0.itpartner.intern -- kubectl rollout restart -n oceanbox deployment/dex
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -66,7 +66,7 @@ let MyApp() =
if isNullOrUndefined localStorage["user_id"] then if isNullOrUndefined localStorage["user_id"] then
"" ""
else else
localStorage["user_id"] localStorage["user_id"]
// Browser.Dom.document.cookie // Browser.Dom.document.cookie
// |> fun s -> s.Split ';' // |> fun s -> s.Split ';'
// |> Array.filter (fun s -> s.StartsWith "user_id=") // |> Array.filter (fun s -> s.StartsWith "user_id=")
@@ -75,7 +75,7 @@ let MyApp() =
// |> Option.defaultValue "" // |> Option.defaultValue ""
let toggleAmnesia _ = setAmnesia (not amnesia) let toggleAmnesia _ = setAmnesia (not amnesia)
html $""" html $"""
<div class="centering"> <div class="centering">
<div @keydown={Ev(onEnter)}> <div @keydown={Ev(onEnter)}>
+18 -17
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC2034 # Unused variables left for readability
helmfile () { helmfile () {
@@ -10,30 +11,30 @@ bases:
- ../envs/environments.yaml.gotmpl - ../envs/environments.yaml.gotmpl
commonLabels: commonLabels:
tier: $tier tier: ${tier}
releases: releases:
- name: $name - name: ${name}
namespace: {{ .Environment.Name }}-$name namespace: {{ .Environment.Name }}-${name}
chart: ../charts/$name chart: ../charts/${name}
condition: $name.enabled condition: ${name}.enabled
values: values:
- ../values/$name/values/values.yaml.gotmpl - ../values/${name}/values/values.yaml.gotmpl
- ../values/$name/values/values-{{ .Environment.Name }}.yaml - ../values/${name}/values/values-{{ .Environment.Name }}.yaml
postRenderer: ../bin/kustomizer postRenderer: ../bin/kustomizer
postRendererArgs: postRendererArgs:
- ../values/$name/kustomize/{{ .Environment.Name }} - ../values/${name}/kustomize/{{ .Environment.Name }}
missingFileHandler: Info missingFileHandler: Info
- name: manifests - name: manifests
namespace: {{ .Environment.Name }}-$name namespace: {{ .Environment.Name }}-${name}
chart: manifests chart: manifests
condition: $name.enabled condition: ${name}.enabled
missingFileHandler: Info missingFileHandler: Info
values: values:
- ../values/env.yaml - ../values/env.yaml
- ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
- ../values/$name/env.yaml.gotmpl - ../values/${name}/env.yaml.gotmpl
- ../values/$name/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl - ../values/${name}/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl
hooks: hooks:
- events: [ prepare, cleanup ] - events: [ prepare, cleanup ]
showlogs: true showlogs: true
@@ -42,7 +43,7 @@ releases:
- '{{\`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}\`}}' - '{{\`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}\`}}'
- '{{\`{{ .Release.Chart }}\`}}' - '{{\`{{ .Release.Chart }}\`}}'
- '{{\`{{ .Environment.Name }}\`}}' - '{{\`{{ .Environment.Name }}\`}}'
- ../values/$name/manifests - ../values/${name}/manifests
- manifests - manifests
EOF EOF
} }
@@ -59,10 +60,10 @@ done
name=$1 name=$1
tier=$2 tier=$2
if [ -n "$ns" ]; then if [[ -n "${ns}" ]]; then
namespace="namespace: {{ .Environment.Name }}-$name" namespace="namespace: {{ .Environment.Name }}-${name}"
else else
namespace="namespace: $name" namespace="namespace: ${name}"
fi fi
helmfile $1 $2 helmfile "$1" "$2"
+13 -14
View File
@@ -4,39 +4,38 @@ set -o pipefail
cmd=$1 cmd=$1
chart=$2 chart=$2
env=$3
manifests=${4:-manifests} manifests=${4:-manifests}
outdir=${5:-_manifests} outdir=${5:-_manifests}
build() { build() {
mkdir -p $outdir/templates mkdir -p "${outdir}"/templates
echo "Creating $outdir/templates" echo "Creating ${outdir}/templates"
echo "generating $outdir/Chart.yaml" 1>&2 echo "generating ${outdir}/Chart.yaml" 1>&2
cat <<EOF > $outdir/Chart.yaml cat <<EOF > "${outdir}"/Chart.yaml
apiVersion: v1 apiVersion: v1
appVersion: "1.0" appVersion: "1.0"
# description: A Helm chart for Kubernetes # description: A Helm chart for Kubernetes
name: $chart name: ${chart}
version: 0.1.0 version: 0.1.0
EOF EOF
if [ -d $manifests ]; then if [[ -d "${manifests}" ]]; then
cp -r $manifests/* $outdir/templates cp -r "${manifests}"/* "${outdir}"/templates
elif [ -f $manifests ]; then elif [[ -f "${manifests}" ]]; then
cp $manifests $outdir/templates cp "${manifests}" "${outdir}"/templates
fi fi
} }
clean() { clean() {
echo "cleaning $outdir" 1>&2 echo "cleaning ${outdir}" 1>&2
rm -rf $outdir rm -rf "${outdir}"
} }
case "$cmd" in case "${cmd}" in
"build" ) build ;; "build" ) build ;;
"clean" ) clean ;; "clean" ) clean ;;
* ) echo "unsupported command: $cmd" 1>&2; exit 1 ;; * ) echo "unsupported command: ${cmd}" 1>&2; exit 1 ;;
esac esac
+5 -5
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
[ $# != 1 ] && exit 1 [[ $# != 1 ]] && exit 1
dir=$1 dir=$1
base=$dir/../base base=${dir}/../base
if [ -f $base/kustomization.yaml -a -f $dir/kustomization.yaml ]; then if [[ -f "${base}"/kustomization.yaml ]] && [[ -f "${dir}"/kustomization.yaml ]]; then
cat > $base/_manifest.yaml cat > "${base}"/_manifest.yaml
kubectl kustomize $dir kubectl kustomize "${dir}"
else else
cat cat
fi fi
+2 -2
View File
@@ -3,5 +3,5 @@
img=registry.gitlab.com/oceanbox/manifests/helm-kustomize-cmp img=registry.gitlab.com/oceanbox/manifests/helm-kustomize-cmp
tag=${1:-latest} tag=${1:-latest}
docker build -t $img:$tag . docker build -t "${img}":"${tag}" .
docker push $img:$tag docker push "${img}":"${tag}"
+16 -15
View File
@@ -1,14 +1,15 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC2154
export HOME=/plugin export HOME=/plugin
env > /tmp/$ARGOCD_APP_NAME.env env > /tmp/"${ARGOCD_APP_NAME}".env
echo "$ARGOCD_APP_PARAMETERS" | jq '.[] | select(.name == "helm-parameters") | .map' | yq -P -oy > parameters.yaml echo "${ARGOCD_APP_PARAMETERS}" | jq '.[] | select(.name == "helm-parameters") | .map' | yq -P -oy > parameters.yaml
cp parameters.yaml /tmp/$ARGOCD_APP_NAME-parameters.yaml cp parameters.yaml /tmp/"${ARGOCD_APP_NAME}"-parameters.yaml
if [ -n "$PARAM_CHART" -a "$PARAM_CHART" != "." ]; then if [ -n "${PARAM_CHART}" ] && [ "${PARAM_CHART}" != "." ]; then
CHART=$PARAM_CHART CHART=${PARAM_CHART}
elif [ -d chart ]; then elif [ -d chart ]; then
CHART=chart CHART=chart
elif [ -f chart ]; then elif [ -f chart ]; then
@@ -18,19 +19,19 @@ else
fi fi
[ -f chart/values.yaml ] && VALUES="-f chart/values.yaml" [ -f chart/values.yaml ] && VALUES="-f chart/values.yaml"
[ -f values-chart.yaml ] && VALUES="$VALUES -f values-chart.yaml" [ -f values-chart.yaml ] && VALUES="${VALUES} -f values-chart.yaml"
[ -f values.yaml ] && VALUES="$VALUES -f values.yaml" [ -f values.yaml ] && VALUES="${VALUES} -f values.yaml"
[ -f values-$PARAM_ENV.yaml ] && VALUES="$VALUES -f values-$PARAM_ENV.yaml" [ -f values-"${PARAM_ENV}".yaml ] && VALUES="${VALUES} -f values-${PARAM_ENV}.yaml"
VALUES="$VALUES -f parameters.yaml" VALUES="${VALUES} -f parameters.yaml"
helm dependency update $CHART >/tmp/$ARGOCD_APP_NAME-helm-dependency-build.out helm dependency update "${CHART}" >/tmp/"${ARGOCD_APP_NAME}"-helm-dependency-build.out
mkdir -p base mkdir -p base
echo "helm template -n $ARGOCD_APP_NAMESPACE $PARAM_FLAGS $VALUES $ARGOCD_APP_NAME $CHART" > /tmp/$ARGOCD_APP_NAME-helm.sh echo "helm template -n ${ARGOCD_APP_NAMESPACE} ${PARAM_FLAGS} ${VALUES} ${ARGOCD_APP_NAME} ${CHART}" > /tmp/"${ARGOCD_APP_NAME}"-helm.sh
helm template -n $ARGOCD_APP_NAMESPACE $PARAM_FLAGS $VALUES $ARGOCD_APP_NAME $CHART > ./base/_manifest.yaml helm template -n "${ARGOCD_APP_NAMESPACE}" "${PARAM_FLAGS}" "${VALUES}" "${ARGOCD_APP_NAME}" "${CHART}" > ./base/_manifest.yaml
cp ./base/_manifest.yaml /tmp/$ARGOCD_APP_NAME-manifest.yaml cp ./base/_manifest.yaml /tmp/"${ARGOCD_APP_NAME}"-manifest.yaml
[ -d "$PARAM_ENV" ] && kubectl kustomize $PARAM_ENV > /tmp/$ARGOCD_APP_NAME-manifest.yaml [ -d "${PARAM_ENV}" ] && kubectl kustomize "${PARAM_ENV}" > /tmp/"${ARGOCD_APP_NAME}"-manifest.yaml
cat /tmp/$ARGOCD_APP_NAME-manifest.yaml cat /tmp/"${ARGOCD_APP_NAME}"-manifest.yaml
+1 -1
View File
@@ -18,7 +18,7 @@ EOF
exit 0 exit 0
fi fi
yq e -o=p $VALUES | jq --slurp --raw-input ' yq e -o=p "${VALUES}" | jq --slurp --raw-input '
[{ [{
name: "helm-parameters", name: "helm-parameters",
title: "Helm Parameters", title: "Helm Parameters",
@@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC2154
export HOME=/plugin export HOME=/plugin
helm repo add --username argocd-helm --password "$OCEANBOX_HELM_ACCESS_TOKEN" oceanbox \ helm repo add --username argocd-helm --password "${OCEANBOX_HELM_ACCESS_TOKEN}" oceanbox \
https://gitlab.com/api/v4/projects/54396343/packages/helm/stable https://gitlab.com/api/v4/projects/54396343/packages/helm/stable
helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add bitnami https://charts.bitnami.com/bitnami
+3 -3
View File
@@ -4,9 +4,9 @@ export HOME=/plugin
helm repo update oceanbox helm repo update oceanbox
if [ -n "$PARAM_CHART" -a "$PARAM_CHART" != "." ]; then if [ -n "${PARAM_CHART}" ] && [ "${PARAM_CHART}" != "." ]; then
helm show values $PARAM_CHART > values-chart.yaml helm show values "${PARAM_CHART}" > values-chart.yaml
elif [ -f chart ]; then elif [ -f chart ]; then
CHART=$(cat chart) CHART=$(cat chart)
helm show values $CHART > values-chart.yaml helm show values "${CHART}" > values-chart.yaml
fi fi
+2 -2
View File
@@ -3,5 +3,5 @@
img=registry.gitlab.com/oceanbox/manifests/helmfile-cmp img=registry.gitlab.com/oceanbox/manifests/helmfile-cmp
tag=${1:-latest} tag=${1:-latest}
docker build -t $img:$tag . docker build -t "${img}":"${tag}" .
docker push $img:$tag docker push "${img}":"${tag}"
+4 -3
View File
@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC2154
# NOTE: Ensure errors are part of exitcode # NOTE: Ensure errors are part of exitcode
# set -o pipefail # set -o pipefail
@@ -10,7 +11,7 @@ export HELM_CONFIG_HOME=/tmp/helm/config
export HELMFILE_CACHE_HOME=/tmp/helmfile/cache export HELMFILE_CACHE_HOME=/tmp/helmfile/cache
export HELMFILE_TEMPDIR=/tmp/helmfile/tmp export HELMFILE_TEMPDIR=/tmp/helmfile/tmp
test -n ARGOCD_ENV_HELMFILE_ENVIRONMENT && export HELMFILE_ENVIRONMENT=$ARGOCD_ENV_HELMFILE_ENVIRONMENT test -n ARGOCD_ENV_HELMFILE_ENVIRONMENT && export HELMFILE_ENVIRONMENT="${ARGOCD_ENV_HELMFILE_ENVIRONMENT}"
test -n ARGOCD_ENV_HELMFILE_FILE_PATH && export HELMFILE_FILE_PATH=$ARGOCD_ENV_HELMFILE_FILE_PATH test -n ARGOCD_ENV_HELMFILE_FILE_PATH && export HELMFILE_FILE_PATH="${ARGOCD_ENV_HELMFILE_FILE_PATH}"
helmfile -n "$ARGOCD_APP_NAMESPACE" $ARGS template -q --include-crds helmfile -n "${ARGOCD_APP_NAMESPACE}" "${ARGS}" template -q --include-crds
+1 -1
View File
@@ -13,7 +13,7 @@ kubectl --context ekman apply -f cluster-admin-token.yaml
# kubectl --context oceanbox apply -f _cluster-ekman.yaml # kubectl --context oceanbox apply -f _cluster-ekman.yaml
token=$(kubectl --context ekman get secret -n kube-system argocd-manager-token -o yaml | grep ' token:' | cut -d' ' -f4 | base64 -d) token=$(kubectl --context ekman get secret -n kube-system argocd-manager-token -o yaml | grep ' token:' | cut -d' ' -f4 | base64 -d)
sed "s/@token@/$token/" cluster-ekman.yaml > _cluster-ekman.yaml sed "s/@token@/${token}/" cluster-ekman.yaml > _cluster-ekman.yaml
echo "configure argocd ekman-cluster..." echo "configure argocd ekman-cluster..."
cat _cluster-ekman.yaml cat _cluster-ekman.yaml
kubectl --context oceanbox apply -f _cluster-ekman.yaml kubectl --context oceanbox apply -f _cluster-ekman.yaml
+65
View File
@@ -0,0 +1,65 @@
let
sources = import ./default.nix;
pkgs = import sources.nixpkgs { };
pre-commit = import sources.git-hooks;
globalExcludes = [
"nix/default.nix"
".*vendor"
".*chart/.*"
".*schema.json"
];
in
pre-commit.run {
src = pkgs.nix-gitignore.gitignoreSource [ ] ../.;
# Do not run at pre-commit time
default_stages = [
"pre-push"
];
# TODO(mrtz): Remove when default
package = pkgs.prek;
# Linters From https://github.com/cachix/pre-commit-hooks.nix
hooks = {
nixfmt-rfc-style = {
enable = true;
excludes = globalExcludes;
};
trim-trailing-whitespace.enable = true;
shellcheck = {
enable = true;
excludes = [
"vcluster/"
];
args = [
"-x"
"-o"
"all"
];
};
yamllint = {
enable = false;
excludes = [
"attic/"
"charts/templates/"
"charts/charts/"
];
settings = {
strict = true;
configData = ''{ extends: default, rules: { document-start: disable, line-length: {max: 165} } }'';
};
};
check-json.enable = true;
renovate-config-validator = {
enable = true;
files = "renovate.json$";
entry = "renovate-config-validator";
};
};
}
+13
View File
@@ -1,5 +1,18 @@
{ {
"pins": { "pins": {
"git-hooks": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "cachix",
"repo": "git-hooks.nix"
},
"branch": "master",
"submodules": false,
"revision": "b68b780b69702a090c8bb1b973bab13756cc7a27",
"url": "https://github.com/cachix/git-hooks.nix/archive/b68b780b69702a090c8bb1b973bab13756cc7a27.tar.gz",
"hash": "1k99smax7zpa5cdw9afa4v4y4155amy21a8z5z8x3cikdz3gyx5p"
},
"nixpkgs": { "nixpkgs": {
"type": "Channel", "type": "Channel",
"name": "nixpkgs-unstable", "name": "nixpkgs-unstable",
+6 -6
View File
@@ -3,7 +3,7 @@
# Simple script for uploading a base64 encoded image into our database. For # Simple script for uploading a base64 encoded image into our database. For
# grafana business image panels. # grafana business image panels.
if [ $# -ne 2 ] if [[ $# -ne 2 ]]
then then
echo "Usage: $0 <image-name> <file>.png" echo "Usage: $0 <image-name> <file>.png"
exit 1 exit 1
@@ -12,9 +12,9 @@ fi
filename=$1 filename=$1
file=$2 file=$2
if [ ! -e $file ] if [[ ! -e "${file}" ]]
then then
echo "file $file does not exist" echo "file ${file} does not exist"
exit 1 exit 1
fi fi
@@ -22,9 +22,9 @@ function create_image() {
local filename=$1 local filename=$1
local data=$2 local data=$2
cat << EOF cat << EOF
INSERT INTO images VALUES('$filename', '$data'); INSERT INTO images VALUES('${filename}', '${data}');
EOF EOF
} }
data=$(cat $file | base64 -w0) data=$(base64 -w0 < "${file}")
create_image $filename $data create_image "${filename}" "${data}"
-1
View File
@@ -1,4 +1,3 @@
// -*- mode: jsonc -*-
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": [
+31 -21
View File
@@ -6,35 +6,45 @@ let
config = { }; config = { };
overlays = [ ]; overlays = [ ];
}; };
checks = import ./nix/checks.nix;
in in
pkgs.mkShellNoCC { pkgs.mkShellNoCC {
name = "clstr"; name = "clstr";
packages = with pkgs; [ packages =
just with pkgs;
npins [
# dev tools
just
npins
# helm # helm
helmfile helmfile
kubernetes-helm kubernetes-helm
# kubectl tools # kubectl tools
kubectl-cnpg kubectl-cnpg
kubectl-neat kubectl-neat
kubelogin kubelogin
kubelogin-oidc kubelogin-oidc
kubectl-rook-ceph kubectl-rook-ceph
# other tools # other tools
step-cli step-cli
linkerd linkerd
velero velero
cmctl cmctl
renovate
# dapr # dapr
dapr-cli dapr-cli
]; ]
++ checks.enabledPackages;
ARGOCD_ENV_CLUSTER_NAME = "rossby"; ARGOCD_ENV_CLUSTER_NAME = "hel1";
HELM_GIT_ACCESS_TOKEN = "glpat-xxx"; HELM_GIT_ACCESS_TOKEN = "glpat-xxx";
shellHook = builtins.concatStringsSep "\n" [
checks.shellHook
];
} }
@@ -73,7 +73,7 @@
"connString": "Username=postgres;Password=secret;Host=localhost;Port=5432;Database=app;Pooling=true;", "connString": "Username=postgres;Password=secret;Host=localhost;Port=5432;Database=app;Pooling=true;",
"sorcerer" : "https://sorcerer.data.oceanbox.io", "sorcerer" : "https://sorcerer.data.oceanbox.io",
"allowedOrigins": [ "allowedOrigins": [
"https://maps.oceanbox.io", "https://maps.oceanbox.io"
], ],
"appName": "atlantis", "appName": "atlantis",
"appEnv": "prod", "appEnv": "prod",
+4 -4
View File
@@ -4,14 +4,14 @@ identity:
scheme: {{ .Values.linkerd.secretScheme }} scheme: {{ .Values.linkerd.secretScheme }}
{{- if .Values.linkerd.identityIssuerPEM }} {{- if .Values.linkerd.identityIssuerPEM }}
tls: tls:
crtPEM: {{- .Values.linkerd.identityIssuerPEM | toYaml | indent 14 }} crtPEM: {{- .Values.linkerd.identityIssuerPEM | toYaml | indent 14 }}
{{- end }} {{- end }}
policyValidator: policyValidator:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
proxyInjector: proxyInjector:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
profileValidator: profileValidator:
externalSecret: true externalSecret: true
caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }} caBundle: {{- .Values.linkerd.webhookPEM | toYaml | indent 9 }}
@@ -1,5 +1,5 @@
containerPort: 10250 containerPort: 10250
resources: resources:
requests: requests:
cpu: 100m cpu: 100m
memory: 200Mi memory: 200Mi
@@ -6,7 +6,7 @@ metadata:
namespace: argocd namespace: argocd
spec: spec:
destination: destination:
namespace: kube-system namespace: kube-system
server: 'https://kubernetes.default.svc' server: 'https://kubernetes.default.svc'
sources: sources:
- repoURL: {{ .Values.clusterConfig.manifests }} - repoURL: {{ .Values.clusterConfig.manifests }}
+1 -1
View File
@@ -6,5 +6,5 @@
"appVersion": "1.0.0", "appVersion": "1.0.0",
"cacheDir": "/data/archives/cache/prod", "cacheDir": "/data/archives/cache/prod",
"otelCollector": "http://10.255.241.12:4317", "otelCollector": "http://10.255.241.12:4317",
"sentryUrl": "https://2b68ecf0c4d02e6cc9433c371321ac9d@o4509530141622272.ingest.de.sentry.io/4509910315237456", "sentryUrl": "https://2b68ecf0c4d02e6cc9433c371321ac9d@o4509530141622272.ingest.de.sentry.io/4509910315237456"
} }
@@ -24,7 +24,7 @@ spec:
grafana_folder: Prometheus-stack grafana_folder: Prometheus-stack
targets: targets:
- apiVersion: v1 - apiVersion: v1
kind: ConfigMap kind: ConfigMap
name: "{{`{{ request.object.metadata.name }}`}}" name: "{{`{{ request.object.metadata.name }}`}}"
name: generate-dashboard-folder-annotation name: generate-dashboard-folder-annotation
skipBackgroundRequests: true skipBackgroundRequests: true
+1 -1
View File
@@ -1,5 +1,5 @@
redis: redis:
enabled: true enabled: true
envs: envs:
- prod - prod
- staging - staging
+1 -1
View File
@@ -3,7 +3,7 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: {{ . }}-redis name: {{ . }}-redis
namespace: argocd namespace: argocd
annotations: annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
@@ -60,7 +60,7 @@
"https://maps.beta.oceanbox.io", "https://maps.beta.oceanbox.io",
"https://atlantis.beta.oceanbox.io", "https://atlantis.beta.oceanbox.io",
"https://jonas-atlantis.dev.oceanbox.io", "https://jonas-atlantis.dev.oceanbox.io",
"https://stig-atlantis.dev.oceanbox.io", "https://stig-atlantis.dev.oceanbox.io"
], ],
"appName": "sorcerer", "appName": "sorcerer",
"appEnv": "prod", "appEnv": "prod",
+1 -1
View File
@@ -13,7 +13,7 @@ metadata:
is time consuming and error prone. This policy will copy a is time consuming and error prone. This policy will copy a
Secret called `regcred` which exists in the `default` Namespace to Secret called `regcred` which exists in the `default` Namespace to
new Namespaces when they are created. It will also push updates to new Namespaces when they are created. It will also push updates to
the copied Secrets should the source Secret be changed. the copied Secrets should the source Secret be changed.
spec: spec:
rules: rules:
- name: sync-image-pull-secret - name: sync-image-pull-secret
+1 -1
View File
@@ -37,7 +37,7 @@ rules:
resources: resources:
- events - events
verbs: ["*"] verbs: ["*"]
- nonResourceURLs: ["*"] - nonResourceURLs: ["*"]
verbs: ["*"] verbs: ["*"]
- apiGroups: - apiGroups:
@@ -13,7 +13,7 @@ metadata:
is time consuming and error prone. This policy will copy a is time consuming and error prone. This policy will copy a
Secret called `regcred` which exists in the `default` Namespace to Secret called `regcred` which exists in the `default` Namespace to
new Namespaces when they are created. It will also push updates to new Namespaces when they are created. It will also push updates to
the copied Secrets should the source Secret be changed. the copied Secrets should the source Secret be changed.
spec: spec:
rules: rules:
- name: sync-image-pull-secret - name: sync-image-pull-secret
+4 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ $# -ne 1 ] if [[ $# -ne 1 ]]
then then
echo "Usage: $0 <file>.sql" echo "Usage: $0 <file>.sql"
exit 1 exit 1
@@ -8,11 +8,11 @@ fi
file=$1 file=$1
if [ ! -e $file ] if [[ ! -e "${file}" ]]
then then
echo "file $file does not exist" echo "file ${file} does not exist"
exit 1 exit 1
fi fi
cat $file | kubectl -n analytics exec -i svc/prod-umami-db-rw -c postgres -- psql app kubectl -n analytics exec -i svc/prod-umami-db-rw -c postgres -- psql app < "${file}"
+1 -1
View File
@@ -32,7 +32,7 @@ GROUP BY
SELECT SELECT
* *
FROM FROM
crosstab_integer_5_cols( crosstab_integer_5_cols(
'SELECT * FROM simulations 'SELECT * FROM simulations
WHERE WHERE
+2 -2
View File
@@ -1,4 +1,4 @@
select select
s.distinct_id, s.distinct_id,
count(distinct w.visit_id) count(distinct w.visit_id)
from from
@@ -9,7 +9,7 @@ join
where where
w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153' w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153'
and w.event_type = 1 and w.event_type = 1
and w.created_at between '2025-10-13' and '2025-10-19' and w.created_at between '2025-10-13' and '2025-10-19'
and s.distinct_id is not null and s.distinct_id is not null
and substring(s.distinct_id similar '%#"@%#"' escape '#') not in ('@oceanbox.io') and substring(s.distinct_id similar '%#"@%#"' escape '#') not in ('@oceanbox.io')
group by group by
+1 -1
View File
@@ -9,7 +9,7 @@ join
where where
w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153' w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153'
and w.event_type = 1 and w.event_type = 1
and w.created_at between '2025-10-06' and '2025-10-10' and w.created_at between '2025-10-06' and '2025-10-10'
and s.distinct_id is not null and s.distinct_id is not null
and s.distinct_id like '%@%' and s.distinct_id like '%@%'
group by group by
@@ -21,7 +21,7 @@
SELECT SELECT
* *
FROM FROM
crosstab( crosstab(
'SELECT "group", sim_type, count::text FROM weekly_sim_submit_count_v2 ORDER BY 1, 2', 'SELECT "group", sim_type, count::text FROM weekly_sim_submit_count_v2 ORDER BY 1, 2',
'SELECT DISTINCT sim_type FROM weekly_sim_submit_count_v2 ORDER BY 1' 'SELECT DISTINCT sim_type FROM weekly_sim_submit_count_v2 ORDER BY 1'