Skip to content

Commit 2b759db

Browse files
authored
adding values to helm chart and setting custom value for initialDelaySeconds (#245)
1 parent d8547fb commit 2b759db

File tree

5 files changed

+62
-25
lines changed

5 files changed

+62
-25
lines changed

docs/configuration.schema.json

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
},
1212
"additionalProperties" : false
1313
},
14-
"HelmConfig-nullable" : {
15-
"type" : [ "object", "null" ],
16-
"properties" : {
17-
"chart" : {
18-
"type" : [ "string", "null" ],
19-
"description" : "Name of the Helm chart"
20-
},
21-
"repoURL" : {
22-
"type" : [ "string", "null" ],
23-
"description" : "Repository url from which the Helm chart should be obtained"
24-
},
25-
"version" : {
26-
"type" : [ "string", "null" ],
27-
"description" : "The version of the Helm chart to be installed"
28-
}
29-
},
30-
"additionalProperties" : false
31-
},
3214
"Map(String,Object)-nullable" : {
3315
"type" : [ "object", "null" ]
3416
},
@@ -607,7 +589,22 @@
607589
"description" : "Create image pull secrets for registry and proxy-registry for all GOP namespaces and helm charts. Uses proxy-username, read-only-username or registry-username (in this order). Use this if your cluster is not auto-provisioned with credentials for your private registries or if you configure individual helm images to be pulled from the proxy-registry that requires authentication."
608590
},
609591
"helm" : {
610-
"$ref" : "#/$defs/HelmConfig-nullable",
592+
"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+
},
607+
"additionalProperties" : false,
611608
"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."
612609
},
613610
"internalPort" : {
@@ -681,7 +678,26 @@
681678
"type" : [ "object", "null" ],
682679
"properties" : {
683680
"helm" : {
684-
"$ref" : "#/$defs/HelmConfig-nullable",
681+
"type" : [ "object", "null" ],
682+
"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+
},
691+
"values" : {
692+
"$ref" : "#/$defs/Map(String,Object)-nullable",
693+
"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"
698+
}
699+
},
700+
"additionalProperties" : false,
685701
"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."
686702
},
687703
"password" : {

scm-manager/values.ftl.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
persistence:
22
size: 1Gi
33

4+
<#if helm.values['initialDelaySeconds']??>
5+
livenessProbe:
6+
initialDelaySeconds: ${helm.values.initialDelaySeconds}
7+
</#if>
8+
49
extraEnv: |
510
- name: SCM_WEBAPP_INITIALUSER
611
value: "${username}"
@@ -12,11 +17,12 @@ service:
1217
nodePort: 9091
1318
type: NodePort
1419
</#if>
15-
20+
1621
<#if host?has_content>
1722
ingress:
1823
enabled: true
1924
path: /
2025
hosts:
2126
- ${host}
2227
</#if>
28+

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,13 @@ class Config {
237237
String password = DEFAULT_ADMIN_PW
238238

239239
@JsonPropertyDescription(HELM_CONFIG_DESCRIPTION)
240-
HelmConfig helm = new HelmConfig(
240+
HelmConfigWithValues helm = new HelmConfigWithValues(
241241
chart: 'scm-manager',
242242
repoURL: 'https://packages.scm-manager.org/repository/helm-v2-releases/',
243-
version: '3.2.1')
243+
version: '3.2.1',
244+
values: [
245+
initialDelaySeconds: 120
246+
])
244247
}
245248

246249
static class ApplicationSchema {

src/main/groovy/com/cloudogu/gitops/features/ScmManager.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class ScmManager extends Feature {
5252
host : config.scmm.ingress,
5353
remote: config.application.remote,
5454
username: config.scmm.username,
55-
password: config.scmm.password
55+
password: config.scmm.password,
56+
helm: config.scmm.helm
5657
]).toPath()
5758

5859
deployer.deployFeature(

src/test/groovy/com/cloudogu/gitops/features/ScmManagerTest.groovy

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ class ScmManagerTest {
3333
password: 'scmm-pw',
3434
gitOpsUsername: 'foo-gitops',
3535
urlForJenkins : 'http://scmm4jenkins',
36-
helm : new Config.HelmConfig(
36+
helm : new Config.HelmConfigWithValues(
3737
chart : 'scm-manager-chart',
3838
version: '2.47.0',
3939
repoURL: 'https://packages.scm-manager.org/repository/helm-v2-releases/',
40+
values: [:]
4041
)
4142
),
4243
jenkins: new Config.JenkinsSchema(
@@ -128,6 +129,16 @@ class ScmManagerTest {
128129
assertThat(temporaryYamlFile).isNull()
129130
}
130131

132+
@Test
133+
void 'initialDelaySeconds is set properly'() {
134+
config.scmm.helm.values = [
135+
initialDelaySeconds: 140
136+
]
137+
138+
createScmManager().install()
139+
assertThat(parseActualYaml()['livenessProbe'] as String).contains('initialDelaySeconds:140')
140+
}
141+
131142
protected Map<String, String> getEnvAsMap() {
132143
commandExecutor.environment.collectEntries { it.split('=') }
133144
}

0 commit comments

Comments
 (0)