Skip to content

Commit 45524ed

Browse files
committed
feat: API for custom helm chart configuration
1 parent a209459 commit 45524ed

File tree

6 files changed

+148
-0
lines changed

6 files changed

+148
-0
lines changed

api/v1alpha1/addon_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ type NutanixAddons struct {
8686
}
8787

8888
type GenericAddons struct {
89+
// +kubebuilder:validation:Optional
90+
HelmChartConfig *HelmChartConfig `json:"helmChartConfig,omitempty"`
91+
8992
// +kubebuilder:validation:Optional
9093
CNI *CNI `json:"cni,omitempty"`
9194

@@ -102,6 +105,12 @@ type GenericAddons struct {
102105
ServiceLoadBalancer *ServiceLoadBalancer `json:"serviceLoadBalancer,omitempty"`
103106
}
104107

108+
type HelmChartConfig struct {
109+
// The name of the ConfigMap containing the Helm configuration for addons charts.
110+
// +kubebuilder:validation:Required
111+
ConfigMapRef LocalObjectReference `json:"configMapRef"`
112+
}
113+
105114
type AddonStrategy string
106115

107116
// CNI required for providing CNI configuration.

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,23 @@ spec:
201201
- defaultStorage
202202
- providers
203203
type: object
204+
helmChartConfig:
205+
properties:
206+
configMapRef:
207+
description: The name of the ConfigMap containing the Helm configuration for addons charts.
208+
properties:
209+
name:
210+
description: |-
211+
Name of the referent.
212+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
213+
minLength: 1
214+
type: string
215+
required:
216+
- name
217+
type: object
218+
required:
219+
- configMapRef
220+
type: object
204221
nfd:
205222
description: NFD tells us to enable or disable the node feature discovery addon.
206223
properties:

api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ spec:
210210
- defaultStorage
211211
- providers
212212
type: object
213+
helmChartConfig:
214+
properties:
215+
configMapRef:
216+
description: The name of the ConfigMap containing the Helm configuration for addons charts.
217+
properties:
218+
name:
219+
description: |-
220+
Name of the referent.
221+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
222+
minLength: 1
223+
type: string
224+
required:
225+
- name
226+
type: object
227+
required:
228+
- configMapRef
229+
type: object
213230
nfd:
214231
description: NFD tells us to enable or disable the node feature discovery addon.
215232
properties:

api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ spec:
210210
- defaultStorage
211211
- providers
212212
type: object
213+
helmChartConfig:
214+
properties:
215+
configMapRef:
216+
description: The name of the ConfigMap containing the Helm configuration for addons charts.
217+
properties:
218+
name:
219+
description: |-
220+
Name of the referent.
221+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
222+
minLength: 1
223+
type: string
224+
required:
225+
- name
226+
type: object
227+
required:
228+
- configMapRef
229+
type: object
213230
nfd:
214231
description: NFD tells us to enable or disable the node feature discovery addon.
215232
properties:

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
+++
2+
title = "Custom Helm Chart Configuration"
3+
icon = "fa-solid fa-eye"
4+
+++
5+
6+
A default helm chart configuration is provided with a ConfigMap `default-helm-addons-config`. This ConfigMap contains helm chart URL and version for each addon.
7+
If a user want to customize the default configuration with different helm chart repository URL or version for one or more addons, the user can create a ConfigMap with their customized addon configuration and provide it as a reference in the `Cluster` object.
8+
9+
The helm chart configuration for an addon included in the custom ConfigMap will be installed on the cluster.
10+
If configuration for an addon is not included in the the customized addon configuration ConfigMap, it will be defauled from the `default-helm-addons-config` configmap.
11+
12+
The content of the ConfigMap must follow following specification.
13+
14+
```yaml
15+
addon-name: |
16+
ChartName: addon-chart-name
17+
ChartVersion: 1.0.0
18+
RepositoryURL: https://my-chart-repository.example.com/charts/
19+
```
20+
21+
Example configmap `custom-helm-addons-config.yaml`:
22+
```yaml
23+
apiVersion: v1
24+
kind: ConfigMap
25+
metadata:
26+
name: <CLUSTER_NAME>-helm-addons-config
27+
namespace: <CLUSTER_NAMESPACE>
28+
labels:
29+
clusterctl.cluster.x-k8s.io/move: ""
30+
data:
31+
nutanix-ccm: |
32+
ChartName: nutanix-cloud-provider
33+
ChartVersion: 0.4.2
34+
RepositoryURL: https://nutanix.github.io/helm/
35+
nutanix-storage-csi: |
36+
ChartName: nutanix-csi-storage
37+
ChartVersion: 3.2.0
38+
RepositoryURL: https://nutanix.github.io/helm-releases/
39+
```
40+
41+
create the custom configmap in the same namespace as the `Cluster`
42+
43+
```shell
44+
kubectl create -f custom-helm-addons-config.yaml
45+
```
46+
47+
The deployment of the addons referenced in the custom configmap is applied via the [provider-specific cluster configuration]({{< ref ".." >}}).
48+
49+
## Example
50+
51+
To install addons using custom helm configuration, specify following values:
52+
53+
```yaml
54+
apiVersion: cluster.x-k8s.io/v1beta1
55+
kind: Cluster
56+
metadata:
57+
name: <NAME>
58+
spec:
59+
topology:
60+
variables:
61+
- name: clusterConfig
62+
value:
63+
addons:
64+
helmChartConfig:
65+
configMapRef:
66+
name: <NAME>-helm-addons-config
67+
```

0 commit comments

Comments
 (0)