diff --git a/.github/workflows/helm-charts-test.yaml b/.github/workflows/helm-charts-test.yaml index 4758772..593a554 100644 --- a/.github/workflows/helm-charts-test.yaml +++ b/.github/workflows/helm-charts-test.yaml @@ -18,10 +18,33 @@ jobs: - name: Lint charts id: lint run: ct lint --all - +# collect-values-files-to-validate: +# runs-on: ubuntu-latest +# name: Validate values schema json +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - name: Validate values schema json +# uses: losisin/helm-values-schema-json-action@v1 +# with: +# input: values.yaml +# fail-on-diff: true + validate-values-schema: + runs-on: ubuntu-latest + name: Validate values schema json + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Validate values schema json + uses: losisin/helm-values-schema-json-action@v1 + with: + input: values.yaml + fail-on-diff: true test: runs-on: ubuntu-latest - needs: lint + needs: + - lint + - validate-values-schema strategy: fail-fast: false matrix: diff --git a/charts/cron-jobs/ci/sleep-values.yaml b/charts/cron-jobs/ci/sleep-values.yaml index d054bec..c1b6665 100644 --- a/charts/cron-jobs/ci/sleep-values.yaml +++ b/charts/cron-jobs/ci/sleep-values.yaml @@ -1,12 +1,17 @@ +# List of cronjobs to create jobs: - - name: sleep - schedule: "* * * * *" + # Cronjob's name + - name: sleep # @schema required:true + # Cronjob's schedule following [https://crontab.guru/](crontab syntax) + schedule: "* * * * *" # @schema required:true + # Any labels to apply to the created cronjob labels: cronjob: key: value jobTemplate: key: value - container: + # Anything to apply to the container spec + container: # @schema required:true command: ["sleep"] args: ["1"] resources: @@ -16,7 +21,11 @@ jobs: requests: cpu: 1m memory: 12Mi + # Image configuration image: - repository: alpine - tag: 3.12 - pullPolicy: IfNotPresent + # Image repository + repository: alpine # @schema required:true + # The image tag to use + tag: 3.12 # @schema required:true + # The pod's image pull policy + pullPolicy: IfNotPresent # @schema required:true diff --git a/charts/cron-jobs/values.schema.json b/charts/cron-jobs/values.schema.json new file mode 100644 index 0000000..7de042e --- /dev/null +++ b/charts/cron-jobs/values.schema.json @@ -0,0 +1,109 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "jobs": { + "items": { + "properties": { + "container": { + "properties": { + "args": { + "items": { + "type": "string" + }, + "type": "array" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "number" + } + }, + "required": [ + "repository", + "tag", + "pullPolicy" + ], + "type": "object" + }, + "labels": { + "properties": { + "cronjob": { + "properties": { + "key": { + "type": "string" + } + }, + "type": "object" + }, + "jobTemplate": { + "properties": { + "key": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "schedule": { + "type": "string" + } + }, + "required": [ + "name", + "schedule", + "container" + ], + "type": "object" + }, + "type": "array" + } + }, + "type": "object" +} diff --git a/charts/cron-jobs/values.yaml b/charts/cron-jobs/values.yaml index e69de29..d955af9 100644 --- a/charts/cron-jobs/values.yaml +++ b/charts/cron-jobs/values.yaml @@ -0,0 +1,31 @@ +# List of cronjobs to create +jobs: [] +# # Cronjob's name +# - name: sleep # @schema required:true +# # Cronjob's schedule following [https://crontab.guru/](crontab syntax) +# schedule: "* * * * *" # @schema required:true +# # Any labels to apply to the created cronjob +# labels: +# cronjob: +# key: value +# jobTemplate: +# key: value +# # Anything to apply to the container spec +# container: # @schema required:true +# command: ["sleep"] +# args: ["1"] +# resources: +# limits: +# cpu: 1m +# memory: 12Mi +# requests: +# cpu: 1m +# memory: 12Mi +# # Image configuration +# image: +# # Image repository +# repository: alpine # @schema required:true +# # The image tag to use +# tag: 3.12 # @schema required:true +# # The pod's image pull policy +# pullPolicy: IfNotPresent # @schema required:true diff --git a/charts/default-backend/values.schema.json b/charts/default-backend/values.schema.json new file mode 100644 index 0000000..65e6a25 --- /dev/null +++ b/charts/default-backend/values.schema.json @@ -0,0 +1,88 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "cron": { + "properties": { + "replaceOldestPodHourly": { + "type": "boolean" + } + }, + "type": "object" + }, + "hpa": { + "properties": { + "enable": { + "type": "boolean" + }, + "maxReplicas": { + "type": "integer" + } + }, + "type": "object" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "ingress": { + "properties": { + "annotations": { + "properties": { + "kubernetes.io/ingress.class": { + "type": "string" + }, + "kubernetes.io/tls-acme": { + "type": "string" + } + }, + "type": "object" + }, + "hosts": { + "type": "array" + } + }, + "type": "object" + }, + "replicas": { + "type": "integer" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" +} diff --git a/charts/docker-hub-exporter/values.schema.json b/charts/docker-hub-exporter/values.schema.json new file mode 100644 index 0000000..89938ea --- /dev/null +++ b/charts/docker-hub-exporter/values.schema.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "grafana": { + "properties": { + "influxdb": { + "type": "boolean" + }, + "prometheus": { + "type": "boolean" + } + }, + "type": "object" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "organisations": { + "type": "string" + }, + "replicas": { + "type": "integer" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" +} diff --git a/charts/horizontal-pod-autoscalers/ci/hpa.yaml b/charts/horizontal-pod-autoscalers/ci/hpa.yaml index eb5c267..2752610 100644 --- a/charts/horizontal-pod-autoscalers/ci/hpa.yaml +++ b/charts/horizontal-pod-autoscalers/ci/hpa.yaml @@ -1 +1,4 @@ -replicas: 2 +name: default-backend # @schema required:true +replicas: + min: 2 # @schema required:false + max: 1024 # @schema required:false diff --git a/charts/horizontal-pod-autoscalers/library-ci/hpa.yaml b/charts/horizontal-pod-autoscalers/library-ci/hpa.yaml index 8e4c93b..97d28e6 100644 --- a/charts/horizontal-pod-autoscalers/library-ci/hpa.yaml +++ b/charts/horizontal-pod-autoscalers/library-ci/hpa.yaml @@ -9,7 +9,6 @@ spec: selector: matchLabels: app: default-backend - replicas: {{ .Values.replicas }} template: metadata: annotations: @@ -21,7 +20,6 @@ spec: containers: - name: default-backend image: "wyrihaximusnet/default-backend:random" - imagePullPolicy: Always ports: - name: default-backend containerPort: 6969 @@ -29,20 +27,4 @@ spec: - name: metrics containerPort: 9696 protocol: TCP - livenessProbe: - failureThreshold: 6 - httpGet: - path: / - port: metrics - readinessProbe: - failureThreshold: 6 - httpGet: - path: / - port: metrics - startupProbe: - httpGet: - path: / - port: metrics - failureThreshold: 90 - periodSeconds: 1 {{ include "horizontal-pod-autoscalers.hpa" (dict "name" "default-backend" "replicas" (dict "min" .Values.replicas)) }} diff --git a/charts/horizontal-pod-autoscalers/values.schema.json b/charts/horizontal-pod-autoscalers/values.schema.json new file mode 100644 index 0000000..3bd9108 --- /dev/null +++ b/charts/horizontal-pod-autoscalers/values.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "name": { + "type": "string" + }, + "replicas": { + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + }, + "type": "object" + } + }, + "required": [ + "name" + ], + "type": "object" +} diff --git a/charts/horizontal-pod-autoscalers/values.yaml b/charts/horizontal-pod-autoscalers/values.yaml index e69de29..c0a6912 100644 --- a/charts/horizontal-pod-autoscalers/values.yaml +++ b/charts/horizontal-pod-autoscalers/values.yaml @@ -0,0 +1,4 @@ +name: your-applications-deployment-name # Required, this MUST match the deployment we're autoscaling +replicas: + min: 2 # Optional, defaults to 2, but strongly suggest unsetting the deployment replica count + max: 1024 # Optional, defaults to 1024 diff --git a/charts/pi-hole-exporter/values.schema.json b/charts/pi-hole-exporter/values.schema.json new file mode 100644 index 0000000..038c6b0 --- /dev/null +++ b/charts/pi-hole-exporter/values.schema.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "configurationSecret": { + "type": "string" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "replicas": { + "type": "integer" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" +} diff --git a/charts/redirect/values.schema.json b/charts/redirect/values.schema.json new file mode 100644 index 0000000..e113191 --- /dev/null +++ b/charts/redirect/values.schema.json @@ -0,0 +1,159 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "cron": { + "properties": { + "replaceOldestPodWeekly": { + "type": "boolean" + } + }, + "type": "object" + }, + "grafana": { + "properties": { + "influxdb": { + "type": "boolean" + }, + "prometheus": { + "type": "boolean" + } + }, + "type": "object" + }, + "hpa": { + "properties": { + "enable": { + "type": "boolean" + }, + "maxReplicas": { + "type": "integer" + } + }, + "type": "object" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "ingress": { + "properties": { + "annotations": { + "properties": { + "kubernetes.io/ingress.class": { + "type": "string" + }, + "kubernetes.io/tls-acme": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "labels": { + "properties": { + "language": { + "type": "string" + } + }, + "type": "object" + }, + "podSecurityContext": { + "properties": {}, + "type": "object" + }, + "redirect": { + "properties": { + "buildin": { + "type": "string" + }, + "defaultFallbackTarget": { + "type": "string" + }, + "enforceHttps": { + "type": "boolean" + }, + "hosts": { + "properties": { + "www.ceesjankiewiet.nl": { + "type": "string" + } + }, + "type": "object" + }, + "ingressHosts": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "replicas": { + "type": "integer" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "securityContext": { + "properties": {}, + "type": "object" + }, + "service": { + "properties": { + "type": { + "type": "string" + } + }, + "type": "object" + }, + "serviceAccount": { + "properties": { + "create": { + "type": "boolean" + }, + "name": { + "type": "null" + } + }, + "type": "object" + } + }, + "type": "object" +} diff --git a/charts/redis-db-assignment-operator/values.schema.json b/charts/redis-db-assignment-operator/values.schema.json new file mode 100644 index 0000000..858e730 --- /dev/null +++ b/charts/redis-db-assignment-operator/values.schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" +}