Skip to content

Commit b4da55c

Browse files
Thomas Michaelschnatterer
authored andcommitted
diasble override some helm values
1 parent c24cc9e commit b4da55c

File tree

5 files changed

+162
-128
lines changed

5 files changed

+162
-128
lines changed

docs/configuration.schema.json

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,10 @@
188188
"type" : [ "string", "null" ],
189189
"description" : "Sets cainjector Image for Cert Manager"
190190
},
191-
"chart" : {
192-
"type" : [ "string", "null" ],
193-
"description" : "Name of the Helm chart"
194-
},
195191
"image" : {
196192
"type" : [ "string", "null" ],
197193
"description" : "Sets image for Cert Manager"
198194
},
199-
"repoURL" : {
200-
"type" : [ "string", "null" ],
201-
"description" : "Repository url from which the Helm chart should be obtained"
202-
},
203195
"startupAPICheckImage" : {
204196
"type" : [ "string", "null" ],
205197
"description" : "Sets startupAPICheck Image for Cert Manager"
@@ -208,10 +200,6 @@
208200
"$ref" : "#/$defs/Map(String,Object)-nullable",
209201
"description" : "Helm values of the chart, allows overriding defaults and setting values that are not exposed as explicit configuration"
210202
},
211-
"version" : {
212-
"type" : [ "string", "null" ],
213-
"description" : "The version of the Helm chart to be installed"
214-
},
215203
"webhookImage" : {
216204
"type" : [ "string", "null" ],
217205
"description" : "Sets webhook Image for Cert Manager"
@@ -249,25 +237,13 @@
249237
"helm" : {
250238
"type" : [ "object", "null" ],
251239
"properties" : {
252-
"chart" : {
253-
"type" : [ "string", "null" ],
254-
"description" : "Name of the Helm chart"
255-
},
256240
"image" : {
257241
"type" : [ "string", "null" ],
258242
"description" : "The image of the Helm chart to be installed"
259243
},
260-
"repoURL" : {
261-
"type" : [ "string", "null" ],
262-
"description" : "Repository url from which the Helm chart should be obtained"
263-
},
264244
"values" : {
265245
"$ref" : "#/$defs/Map(String,Object)-nullable",
266246
"description" : "Helm values of the chart, allows overriding defaults and setting values that are not exposed as explicit configuration"
267-
},
268-
"version" : {
269-
"type" : [ "string", "null" ],
270-
"description" : "The version of the Helm chart to be installed"
271247
}
272248
},
273249
"additionalProperties" : false,
@@ -283,21 +259,9 @@
283259
"helm" : {
284260
"type" : [ "object", "null" ],
285261
"properties" : {
286-
"chart" : {
287-
"type" : [ "string", "null" ],
288-
"description" : "Name of the Helm chart"
289-
},
290262
"image" : {
291263
"type" : [ "string", "null" ],
292264
"description" : "The image of the Helm chart to be installed"
293-
},
294-
"repoURL" : {
295-
"type" : [ "string", "null" ],
296-
"description" : "Repository url from which the Helm chart should be obtained"
297-
},
298-
"version" : {
299-
"type" : [ "string", "null" ],
300-
"description" : "The version of the Helm chart to be installed"
301265
}
302266
},
303267
"additionalProperties" : false,
@@ -353,10 +317,6 @@
353317
"helm" : {
354318
"type" : [ "object", "null" ],
355319
"properties" : {
356-
"chart" : {
357-
"type" : [ "string", "null" ],
358-
"description" : "Name of the Helm chart"
359-
},
360320
"grafanaImage" : {
361321
"type" : [ "string", "null" ],
362322
"description" : "Sets image for grafana"
@@ -377,17 +337,9 @@
377337
"type" : [ "string", "null" ],
378338
"description" : "Sets image for prometheus-operator"
379339
},
380-
"repoURL" : {
381-
"type" : [ "string", "null" ],
382-
"description" : "Repository url from which the Helm chart should be obtained"
383-
},
384340
"values" : {
385341
"$ref" : "#/$defs/Map(String,Object)-nullable",
386342
"description" : "Helm values of the chart, allows overriding defaults and setting values that are not exposed as explicit configuration"
387-
},
388-
"version" : {
389-
"type" : [ "string", "null" ],
390-
"description" : "The version of the Helm chart to be installed"
391343
}
392344
},
393345
"additionalProperties" : false,
@@ -410,22 +362,10 @@
410362
"type" : [ "string", "null" ],
411363
"description" : "Sets image for external secrets operator's controller"
412364
},
413-
"chart" : {
414-
"type" : [ "string", "null" ],
415-
"description" : "Name of the Helm chart"
416-
},
417365
"image" : {
418366
"type" : [ "string", "null" ],
419367
"description" : "Sets image for external secrets operator"
420368
},
421-
"repoURL" : {
422-
"type" : [ "string", "null" ],
423-
"description" : "Repository url from which the Helm chart should be obtained"
424-
},
425-
"version" : {
426-
"type" : [ "string", "null" ],
427-
"description" : "The version of the Helm chart to be installed"
428-
},
429369
"webhookImage" : {
430370
"type" : [ "string", "null" ],
431371
"description" : "Sets image for external secrets operator's webhook"
@@ -444,21 +384,9 @@
444384
"helm" : {
445385
"type" : [ "object", "null" ],
446386
"properties" : {
447-
"chart" : {
448-
"type" : [ "string", "null" ],
449-
"description" : "Name of the Helm chart"
450-
},
451387
"image" : {
452388
"type" : [ "string", "null" ],
453389
"description" : "Sets image for vault"
454-
},
455-
"repoURL" : {
456-
"type" : [ "string", "null" ],
457-
"description" : "Repository url from which the Helm chart should be obtained"
458-
},
459-
"version" : {
460-
"type" : [ "string", "null" ],
461-
"description" : "The version of the Helm chart to be installed"
462390
}
463391
},
464392
"additionalProperties" : false,
@@ -590,20 +518,6 @@
590518
},
591519
"helm" : {
592520
"type" : [ "object", "null" ],
593-
"properties" : {
594-
"chart" : {
595-
"type" : [ "string", "null" ],
596-
"description" : "Name of the Helm chart"
597-
},
598-
"repoURL" : {
599-
"type" : [ "string", "null" ],
600-
"description" : "Repository url from which the Helm chart should be obtained"
601-
},
602-
"version" : {
603-
"type" : [ "string", "null" ],
604-
"description" : "The version of the Helm chart to be installed"
605-
}
606-
},
607521
"additionalProperties" : false,
608522
"description" : "Common Config parameters for the Helm package manager: Name of Chart (chart), URl of Helm-Repository (repoURL) and Chart Version (version). Note: These config is intended to obtain the chart from a different source (e.g. in air-gapped envs), not to use a different version of a helm chart. Using a different helm chart or version to the one used in the GOP version will likely cause errors."
609523
},
@@ -680,21 +594,9 @@
680594
"helm" : {
681595
"type" : [ "object", "null" ],
682596
"properties" : {
683-
"chart" : {
684-
"type" : [ "string", "null" ],
685-
"description" : "Name of the Helm chart"
686-
},
687-
"repoURL" : {
688-
"type" : [ "string", "null" ],
689-
"description" : "Repository url from which the Helm chart should be obtained"
690-
},
691597
"values" : {
692598
"$ref" : "#/$defs/Map(String,Object)-nullable",
693599
"description" : "Helm values of the chart, allows overriding defaults and setting values that are not exposed as explicit configuration"
694-
},
695-
"version" : {
696-
"type" : [ "string", "null" ],
697-
"description" : "The version of the Helm chart to be installed"
698600
}
699601
},
700602
"additionalProperties" : false,

src/main/groovy/com/cloudogu/gitops/config/Config.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.cloudogu.gitops.config
22

3-
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
44
import com.fasterxml.jackson.annotation.JsonPropertyDescription
55
import com.fasterxml.jackson.core.JsonGenerator
66
import com.fasterxml.jackson.databind.*
7+
import com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder
78
import com.fasterxml.jackson.databind.module.SimpleModule
89
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter
910
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier
@@ -81,12 +82,10 @@ class Config {
8182
@Mixin
8283
FeaturesSchema features = new FeaturesSchema()
8384

85+
@JsonIgnoreProperties
8486
static class HelmConfig {
85-
@JsonPropertyDescription(HELM_CONFIG_CHART_DESCRIPTION)
8687
String chart = ''
87-
@JsonPropertyDescription(HELM_CONFIG_REPO_URL_DESCRIPTION)
8888
String repoURL = ''
89-
@JsonPropertyDescription(HELM_CONFIG_VERSION_DESCRIPTION)
9089
String version = ''
9190
}
9291

src/test/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCliTest.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ class GitopsPlaygroundCliTest {
6969
// Check application starts
7070
verify(application).start()
7171
}
72+
@Test
73+
void 'fails on starts because config file with helm overrides, not allowed'() {
74+
String pathToConfigFile = "./src/test/resources/errorConfig.yaml"
75+
76+
assertThat(new File(pathToConfigFile).isFile()).withFailMessage("config file for test do not exists anymore.").isTrue()
77+
78+
def exception = shouldFail(RuntimeException) {
79+
cli.run('--config-file=' + pathToConfigFile)
80+
}
81+
assertThat(exception.message).contains('Config file invalid')
82+
83+
}
7284

7385
@Test
7486
void 'Starts with config map'() {
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
registry:
2+
internalPort: 30000
3+
url: "localhost:30000"
4+
path: ""
5+
username: ""
6+
password: ""
7+
proxyUrl: ""
8+
proxyUsername: ""
9+
proxyPassword: ""
10+
readOnlyUsername: ""
11+
readOnlyPassword: ""
12+
createImagePullSecrets: false
13+
helm:
14+
chart: "docker-registry"
15+
repoURL: "https://helm.twun.io"
16+
version: "2.2.3"
17+
jenkins:
18+
url: "http://172.18.0.2:9090"
19+
username: "admin"
20+
password: "admin"
21+
metricsUsername: "metrics"
22+
metricsPassword: "metrics"
23+
mavenCentralMirror: ""
24+
helm:
25+
version: "5.5.11"
26+
scmm:
27+
url: "http://172.18.0.2:9091/scm"
28+
username: "admin"
29+
password: "admin"
30+
helm:
31+
chart: "scm-manager"
32+
repoURL: "https://packages.scm-manager.org/repository/helm-v2-releases/"
33+
version: "3.2.1"
34+
application:
35+
remote: false
36+
insecure: false
37+
openshift: false
38+
username: "admin"
39+
password: "admin"
40+
"yes": true
41+
namePrefix: ""
42+
destroy: false
43+
podResources: false
44+
gitName: "Cloudogu"
45+
gitEmail: "[email protected]"
46+
baseUrl: ""
47+
urlSeparatorHyphen: false
48+
mirrorRepos: false
49+
skipCrds: false
50+
namespaceIsolation: false
51+
netpols: false
52+
images:
53+
kubectl: "bitnami/kubectl:1.29"
54+
helm: "ghcr.io/cloudogu/helm:3.15.4-1"
55+
kubeval: "ghcr.io/cloudogu/helm:3.15.4-1"
56+
helmKubeval: "ghcr.io/cloudogu/helm:3.15.4-1"
57+
yamllint: "cytopia/yamllint:1.25-0.7"
58+
nginx: ""
59+
petclinic: "eclipse-temurin:11-jre-alpine"
60+
maven: ""
61+
repositories:
62+
springBootHelmChart:
63+
url: "/gitops/repos/spring-boot-helm-chart.git"
64+
ref: "0.3.2"
65+
springPetclinic:
66+
url: "/gitops/repos/spring-petclinic.git"
67+
ref: "b0e0d18"
68+
gitopsBuildLib:
69+
url: "/gitops/repos/gitops-build-lib.git"
70+
cesBuildLib:
71+
url: "/gitops/repos/ces-build-lib.git"
72+
features:
73+
argocd:
74+
active: false
75+
url: ""
76+
emailFrom: "[email protected]"
77+
emailToUser: "[email protected]"
78+
emailToAdmin: "[email protected]"
79+
mail:
80+
mailhog: false
81+
mailhogUrl: ""
82+
smtpAddress: ""
83+
smtpPort: 22222
84+
smtpUser: ""
85+
smtpPassword: ""
86+
helm:
87+
chart: "mailhog"
88+
repoURL: "https://codecentric.github.io/helm-charts"
89+
version: "5.0.1"
90+
image: "ghcr.io/cloudogu/mailhog:v1.0.1"
91+
monitoring:
92+
active: false
93+
grafanaUrl: ""
94+
grafanaEmailFrom: "[email protected]"
95+
grafanaEmailTo: "[email protected]"
96+
helm:
97+
chart: "kube-prometheus-stack"
98+
repoURL: "https://prometheus-community.github.io/helm-charts"
99+
version: "58.2.1"
100+
values: {}
101+
grafanaImage: ""
102+
grafanaSidecarImage: ""
103+
prometheusImage: ""
104+
prometheusOperatorImage: ""
105+
prometheusConfigReloaderImage: ""
106+
secrets:
107+
externalSecrets:
108+
helm:
109+
chart: "external-secrets"
110+
repoURL: "https://charts.external-secrets.io"
111+
version: "0.9.16"
112+
image: ""
113+
certControllerImage: ""
114+
webhookImage: ""
115+
vault:
116+
mode: "dev"
117+
url: ""
118+
helm:
119+
chart: "vault"
120+
repoURL: "https://helm.releases.hashicorp.com"
121+
version: "0.25.0"
122+
image: ""
123+
ingressNginx:
124+
active: false
125+
helm:
126+
chart: "ingress-nginx"
127+
repoURL: "https://kubernetes.github.io/ingress-nginx"
128+
version: "4.11.3"
129+
values: {}
130+
image: ""
131+
exampleApps:
132+
petclinic:
133+
baseDomain: ""
134+
nginx:
135+
baseDomain: ""
136+
certManager:
137+
active: false
138+
helm:
139+
chart: "cert-manager"
140+
repoURL: "https://charts.jetstack.io"
141+
version: "1.16.1"
142+
values: {}
143+
image: ""
144+
webhookImage: ""
145+
cainjectorImage: ""
146+
acmeSolverImage: ""
147+
startupAPICheckImage: ""

0 commit comments

Comments
 (0)