Skip to content

Commit 08334bc

Browse files
feat: Add values json schema (#1110)
Auto-generate json schema for values.yaml Fixed #1095 --------- Co-authored-by: Joseph Ware <[email protected]>
1 parent 6eca7b8 commit 08334bc

File tree

13 files changed

+1409
-4
lines changed

13 files changed

+1409
-4
lines changed

.github/workflows/_test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
with:
5454
python-version: ${{ inputs.python-version }}
5555
pip-install: ".[dev]"
56-
5756
- name: Run tests
5857
run: tox -e tests
5958

.github/workflows/_tox.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717

1818
- name: Install python packages
1919
uses: ./.github/actions/install_requirements
20-
20+
21+
- name: Install helm plugins
22+
run: helm plugin install https://github.com/losisin/helm-values-schema-json.git
23+
2124
- name: Run tox
2225
run: tox -e ${{ inputs.tox }}

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
require_serial: true
2727

2828
- repo: https://github.com/norwoodj/helm-docs
29-
rev: ""
29+
rev: ""
3030
hooks:
3131
- id: helm-docs-built
3232
args:
@@ -37,3 +37,11 @@ repos:
3737
rev: v8.28.0
3838
hooks:
3939
- id: gitleaks
40+
41+
- repo: https://github.com/losisin/helm-values-schema-json
42+
rev: v2.2.1
43+
hooks:
44+
- id: helm-schema
45+
args:
46+
- "--config"
47+
- "helm/blueapi/.schema.yaml"

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/s
1515
chmod 700 get_helm.sh; \
1616
./get_helm.sh; \
1717
rm get_helm.sh
18+
RUN helm plugin install https://github.com/losisin/helm-values-schema-json.git
1819

1920
# Set up a virtual environment and put it in PATH
2021
RUN python -m venv /venv

helm/blueapi/.schema.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .schema.yaml
2+
3+
# Define input, output and source for $refs relative to repository root for pre-commit
4+
values:
5+
- helm/blueapi/values.yaml
6+
7+
output: helm/blueapi/values.schema.json
8+
9+
bundleRoot: helm/blueapi/
10+
11+
# Include $refs
12+
bundle: true
13+
14+
# Include comments for the helm-docs plugin into the schema, to allow e.g. documentation in VSCode
15+
useHelmDocs: true
16+
17+
# Allow additional properties for eg. initResources, different types of volumes/volumeMounts
18+
noAdditionalProperties: false
19+
20+
schemaRoot:
21+
title: Blueapi Helm chart scheam
22+
description: Schema to allow validation of values passed to Blueapi Helm chart
23+
# No additional properties in schema root for tighter protection:
24+
additionalProperties: false

helm/blueapi/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ A Helm chart deploying a worker pod that runs Bluesky plans
2222
| initContainer | object | `{"enabled":false,"persistentVolume":{"enabled":false,"existingClaimName":""}}` | Configure the initContainer that checks out the scratch configuration repositories |
2323
| initContainer.persistentVolume.enabled | bool | `false` | Whether to use a persistent volume in the cluster or check out onto the mounted host filesystem If persistentVolume.enabled: False, mounts scratch.root as scratch.root in the container |
2424
| initContainer.persistentVolume.existingClaimName | string | `""` | May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release |
25+
| initResources | object | `{}` | Override resources for init container. By default copies resources of main container. |
2526
| livenessProbe | object | `{"failureThreshold":3,"httpGet":{"path":"/healthz","port":"http"},"periodSeconds":10}` | Liveness probe, if configured kubernetes will kill the pod and start a new one if failed consecutively. This is automatically disabled when in debug mode. |
2627
| nameOverride | string | `""` | |
2728
| nodeSelector | object | `{}` | May be required to run on specific nodes (e.g. the control machine) |

0 commit comments

Comments
 (0)