Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 36a3934

Browse files
Merge pull request #3950 from swisscom/feature/more-helm-options
Add more Helm options
2 parents 77cb056 + 173e740 commit 36a3934

File tree

4 files changed

+69
-8
lines changed

4 files changed

+69
-8
lines changed

Diff for: .changelog/3950.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:breaking-change
2+
plugins/k8s: add support for create_namespace and skip_crds (default is now false)
3+
```

Diff for: builtin/k8s/helm/platform.go

+24-6
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ func (p *Platform) Deploy(
117117
client.NameTemplate = ""
118118
client.OutputDir = ""
119119
client.Atomic = false
120-
client.SkipCRDs = false
120+
client.SkipCRDs = p.config.SkipCRDs
121121
client.SubNotes = true
122122
client.DisableOpenAPIValidation = false
123123
client.Replace = false
124124
client.Description = ""
125-
client.CreateNamespace = true
125+
client.CreateNamespace = p.config.CreateNamespace
126126

127127
s.Update("Installing Chart...")
128128
rel, err := client.Run(c, values)
@@ -149,7 +149,7 @@ func (p *Platform) Deploy(
149149
client.Timeout = 300 * time.Second
150150
client.Namespace = p.config.Namespace
151151
client.Atomic = false
152-
client.SkipCRDs = false
152+
client.SkipCRDs = p.config.SkipCRDs
153153
client.SubNotes = true
154154
client.DisableOpenAPIValidation = false
155155
client.Description = ""
@@ -231,8 +231,10 @@ type Config struct {
231231
Driver string `hcl:"driver,optional"`
232232
Namespace string `hcl:"namespace,optional"`
233233

234-
KubeconfigPath string `hcl:"kubeconfig,optional"`
235-
Context string `hcl:"context,optional"`
234+
KubeconfigPath string `hcl:"kubeconfig,optional"`
235+
Context string `hcl:"context,optional"`
236+
CreateNamespace bool `hcl:"create_namespace,optional"`
237+
SkipCRDs bool `hcl:"skip_crds,optional"`
236238
}
237239

238240
func (p *Platform) Documentation() (*docs.Documentation, error) {
@@ -376,11 +378,27 @@ deploy {
376378
"namespace",
377379
"Namespace to deploy the Helm chart.",
378380
docs.Summary(
379-
"This will be created if it does not exist. This defaults to the ",
381+
"This will be created if it does not exist (see create_namespace). This defaults to the ",
380382
"current namespace of the auth settings.",
381383
),
382384
)
383385

386+
doc.SetField(
387+
"create_namespace",
388+
"Create Namespace if it doesn't exist.",
389+
docs.Summary(
390+
"This option will instruct Helm to create a namespace if it doesn't exist.",
391+
),
392+
)
393+
394+
doc.SetField(
395+
"skip_crds",
396+
"Do not create CRDs",
397+
docs.Summary(
398+
"This option will tell Helm to skip the creation of CRDs.",
399+
),
400+
)
401+
384402
doc.SetField(
385403
"kubeconfig",
386404
"Path to the kubeconfig file to use.",

Diff for: embedJson/gen/platform-helm.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
"Category": false,
1616
"SubFields": null
1717
},
18+
{
19+
"Field": "create_namespace",
20+
"Type": "bool",
21+
"Synopsis": "Create Namespace if it doesn't exist.",
22+
"Summary": "This option will instruct Helm to create a namespace if it doesn't exist.",
23+
"Optional": true,
24+
"Default": "",
25+
"EnvVar": "",
26+
"Category": false,
27+
"SubFields": null
28+
},
1829
{
1930
"Field": "devel",
2031
"Type": "bool",
@@ -52,7 +63,7 @@
5263
"Field": "namespace",
5364
"Type": "string",
5465
"Synopsis": "Namespace to deploy the Helm chart.",
55-
"Summary": "This will be created if it does not exist. This defaults to the current namespace of the auth settings.",
66+
"Summary": "This will be created if it does not exist (see create_namespace). This defaults to the current namespace of the auth settings.",
5667
"Optional": true,
5768
"Default": "",
5869
"EnvVar": "",
@@ -70,6 +81,17 @@
7081
"Category": false,
7182
"SubFields": null
7283
},
84+
{
85+
"Field": "skip_crds",
86+
"Type": "bool",
87+
"Synopsis": "Do not create CRDs",
88+
"Summary": "This option will tell Helm to skip the creation of CRDs.",
89+
"Optional": true,
90+
"Default": "",
91+
"EnvVar": "",
92+
"Category": false,
93+
"SubFields": null
94+
},
7395
{
7496
"Field": "values",
7597
"Type": "list of string",

Diff for: website/content/partials/components/platform-helm.mdx

+19-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ The kubectl context to use, as defined in the kubeconfig file.
9292
- Type: **string**
9393
- **Optional**
9494

95+
#### create_namespace
96+
97+
Create Namespace if it doesn't exist.
98+
99+
This option will instruct Helm to create a namespace if it doesn't exist.
100+
101+
- Type: **bool**
102+
- **Optional**
103+
95104
#### devel
96105

97106
True to considered non-released chart versions for installation.
@@ -126,7 +135,7 @@ If this isn't set, the default lookup used by `kubectl` will be used.
126135

127136
Namespace to deploy the Helm chart.
128137

129-
This will be created if it does not exist. This defaults to the current namespace of the auth settings.
138+
This will be created if it does not exist (see create_namespace). This defaults to the current namespace of the auth settings.
130139

131140
- Type: **string**
132141
- **Optional**
@@ -140,6 +149,15 @@ This only needs to be set if you're NOT using a local chart.
140149
- Type: **string**
141150
- **Optional**
142151

152+
#### skip_crds
153+
154+
Do not create CRDs.
155+
156+
This option will tell Helm to skip the creation of CRDs.
157+
158+
- Type: **bool**
159+
- **Optional**
160+
143161
#### values
144162

145163
Values in raw YAML to configure the Helm chart.

0 commit comments

Comments
 (0)