Skip to content

Commit

Permalink
Add schemas for all values files
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Nov 21, 2024
1 parent 1cb3437 commit 936934a
Show file tree
Hide file tree
Showing 13 changed files with 622 additions and 10 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/helm-charts-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 15 additions & 6 deletions charts/cron-jobs/ci/sleep-values.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
109 changes: 109 additions & 0 deletions charts/cron-jobs/values.schema.json
Original file line number Diff line number Diff line change
@@ -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"
}
31 changes: 31 additions & 0 deletions charts/cron-jobs/values.yaml
Original file line number Diff line number Diff line change
@@ -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
88 changes: 88 additions & 0 deletions charts/default-backend/values.schema.json
Original file line number Diff line number Diff line change
@@ -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"
}
64 changes: 64 additions & 0 deletions charts/docker-hub-exporter/values.schema.json
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 4 additions & 1 deletion charts/horizontal-pod-autoscalers/ci/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
replicas: 2
name: default-backend # @schema required:true
replicas:
min: 2 # @schema required:false
max: 1024 # @schema required:false
1 change: 0 additions & 1 deletion charts/horizontal-pod-autoscalers/library-ci/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spec:
selector:
matchLabels:
app: default-backend
replicas: {{ .Values.replicas }}
template:
metadata:
annotations:
Expand Down
Loading

0 comments on commit 936934a

Please sign in to comment.