Skip to content

Commit d2062ec

Browse files
authored
Merge pull request #136 from Lerentis/feat/tt/schema-validation
feat(): added schema validation for chart
2 parents d8a6e92 + f2cfae3 commit d2062ec

3 files changed

Lines changed: 126 additions & 22 deletions

File tree

‎.github/workflows/test-and-lint.yml‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@ jobs:
1414
- name: Set up Helm
1515
uses: azure/setup-helm@v4
1616
with:
17-
version: v3.11.2
17+
version: v4.3.0
18+
19+
- name: Validate Helm values schema
20+
run: |
21+
helm template schema-validation charts/bitwarden-crd-operator >/dev/null
22+
if helm template schema-validation charts/bitwarden-crd-operator --set image.pullPolicy=invalid >/dev/null 2>&1; then
23+
echo "Expected invalid image.pullPolicy to fail schema validation"
24+
exit 1
25+
fi
1826
1927
- uses: actions/setup-python@v6
2028
with:
21-
python-version: '3.9'
29+
python-version: '3.14'
2230
check-latest: true
2331

2432
- name: Set up chart-testing
@@ -38,7 +46,7 @@ jobs:
3846

3947
- name: Install ah cli
4048
run: |
41-
export AH_VERSION=1.17.0
49+
export AH_VERSION=1.23.0
4250
curl -LO https://github.com/artifacthub/hub/releases/download/v${AH_VERSION}/ah_${AH_VERSION}_linux_amd64.tar.gz
4351
tar -xf ah_${AH_VERSION}_linux_amd64.tar.gz
4452
chmod +x ./ah

‎charts/bitwarden-crd-operator/Chart.yaml‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Deploy the Bitwarden CRD Operator
44

55
type: application
66

7-
version: "v0.18.1"
7+
version: "v0.19.0"
88

99
appVersion: "0.18.0"
1010

@@ -112,24 +112,8 @@ annotations:
112112
artifacthub.io/operator: "true"
113113
artifacthub.io/containsSecurityUpdates: "false"
114114
artifacthub.io/changes: |
115-
- kind: changed
116-
description: "updated alpine to 3.24.2"
117-
- kind: changed
118-
description: "updated python to 3.14.7"
119-
- kind: changed
120-
description: "updated pip to 26.1.2"
121-
- kind: changed
122-
description: "updated libcrypto3 to 3.5.8"
123-
- kind: changed
124-
description: "updated nodejs to 24.18.1"
125-
- kind: fixed
126-
description: "fixed auth recovery to reconfigure the bitwarden host instead of falling back to a default"
127-
- kind: changed
128-
description: "updated kopf to 1.44.6"
129-
- kind: changed
130-
description: "updated kubernetes to 36.0.3"
131-
- kind: fixed
132-
description: "fixed termination of operator process after failed authentication recovery"
115+
- kind: added
116+
description: "added schema validation for helm values"
133117
artifacthub.io/images: |
134118
- name: bitwarden-crd-operator
135119
image: ghcr.io/lerentis/bitwarden-crd-operator:0.18.0
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"properties": {
5+
"replicaCount": {
6+
"type": "integer",
7+
"minimum": 0
8+
},
9+
"image": {
10+
"type": "object",
11+
"properties": {
12+
"repository": { "type": "string", "minLength": 1 },
13+
"pullPolicy": { "type": "string", "enum": ["Always", "IfNotPresent", "Never"] },
14+
"tag": { "type": "string" }
15+
},
16+
"required": ["repository", "pullPolicy"],
17+
"additionalProperties": false
18+
},
19+
"imagePullSecrets": {
20+
"type": "array",
21+
"items": {
22+
"type": "object",
23+
"properties": {
24+
"name": { "type": "string", "minLength": 1 }
25+
},
26+
"required": ["name"],
27+
"additionalProperties": false
28+
}
29+
},
30+
"nameOverride": { "type": "string" },
31+
"fullnameOverride": { "type": "string" },
32+
"deploymentStrategy": { "type": "string", "enum": ["Recreate", "RollingUpdate"] },
33+
"env": {
34+
"type": "array",
35+
"items": {
36+
"type": "object",
37+
"properties": {
38+
"name": { "type": "string", "minLength": 1 },
39+
"value": { "type": "string" },
40+
"valueFrom": { "type": "object" }
41+
},
42+
"required": ["name"],
43+
"additionalProperties": false,
44+
"oneOf": [
45+
{ "required": ["value"], "not": { "required": ["valueFrom"] } },
46+
{ "required": ["valueFrom"], "not": { "required": ["value"] } }
47+
]
48+
}
49+
},
50+
"externalConfigSecret": {
51+
"type": "object",
52+
"properties": {
53+
"enabled": { "type": "boolean" },
54+
"name": { "type": "string" }
55+
},
56+
"required": ["enabled", "name"],
57+
"additionalProperties": false,
58+
"if": {
59+
"properties": { "enabled": { "const": true } },
60+
"required": ["enabled"]
61+
},
62+
"then": {
63+
"properties": { "name": { "type": "string", "minLength": 1 } }
64+
}
65+
},
66+
"serviceAccount": {
67+
"type": "object",
68+
"properties": {
69+
"create": { "type": "boolean" },
70+
"annotations": { "type": "object", "additionalProperties": { "type": "string" } },
71+
"name": { "type": "string" }
72+
},
73+
"required": ["create", "annotations", "name"],
74+
"additionalProperties": false
75+
},
76+
"podAnnotations": { "type": "object", "additionalProperties": { "type": "string" } },
77+
"podSecurityContext": { "type": "object" },
78+
"securityContext": { "type": "object" },
79+
"readinessProbe": { "$ref": "#/definitions/probe" },
80+
"livenessProbe": { "$ref": "#/definitions/probe" },
81+
"resources": { "type": "object" },
82+
"autoscaling": {
83+
"type": "object",
84+
"properties": {
85+
"enabled": { "type": "boolean" },
86+
"minReplicas": { "type": "integer", "minimum": 1 },
87+
"maxReplicas": { "type": "integer", "minimum": 1 },
88+
"targetCPUUtilizationPercentage": { "type": "integer", "minimum": 1, "maximum": 100 },
89+
"targetMemoryUtilizationPercentage": { "type": "integer", "minimum": 1, "maximum": 100 }
90+
},
91+
"required": ["enabled", "minReplicas", "maxReplicas"],
92+
"additionalProperties": false
93+
},
94+
"nodeSelector": { "type": "object", "additionalProperties": { "type": "string" } },
95+
"tolerations": { "type": "array", "items": { "type": "object" } },
96+
"affinity": { "type": "object" }
97+
},
98+
"definitions": {
99+
"probe": {
100+
"type": "object",
101+
"properties": {
102+
"failureThreshold": { "type": "integer", "minimum": 1 },
103+
"initialDelaySeconds": { "type": "integer", "minimum": 0 },
104+
"periodSeconds": { "type": "integer", "minimum": 1 },
105+
"successThreshold": { "type": "integer", "minimum": 1 },
106+
"timeoutSeconds": { "type": "integer", "minimum": 1 }
107+
},
108+
"required": ["failureThreshold", "initialDelaySeconds", "periodSeconds", "successThreshold", "timeoutSeconds"],
109+
"additionalProperties": false
110+
}
111+
}
112+
}

0 commit comments

Comments
 (0)