Skip to content
Merged
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ repos:
hooks:
- id: markdownlint
stages: [pre-commit]
args: ["--fix"]
exclude: ^(CHANGELOG.md|charts/.+/README.md|.github/pull_request_template.md)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
Expand Down
19 changes: 19 additions & 0 deletions api/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,25 @@ type CNI struct {
// +kubebuilder:default=HelmAddon
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
Strategy *AddonStrategy `json:"strategy,omitempty"`

// AddonConfig contains the configuration for the CNI provider.
// +kubebuilder:validation:Optional
AddonConfig `json:",inline"`
}

// AddonConfig contains the configuration for the Addon provider.
type AddonConfig struct {
// Values contains the helm values for the CNI when HelmAddon is the strategy.
// +kubebuilder:validation:Optional
Values *AddonValues `json:"values,omitempty"`
}

// AddonValues contains the configuration values for the Helm Addon.
type AddonValues struct {
// SourceRef is an object reference to Configmap/Secret inside the same namespace
// which contains inline YAML representing the values for the Helm chart.
// +kubebuilder:validation:Optional
SourceRef *corev1.TypedLocalObjectReference `json:"sourceRef,omitempty"`
}

// NFD tells us to enable or disable the node feature discovery addon.
Expand Down
26 changes: 26 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,32 @@ spec:
- ClusterResourceSet
- HelmAddon
type: string
values:
description: Values contains the helm values for the CNI when HelmAddon is the strategy.
properties:
sourceRef:
description: |-
SourceRef is an object reference to Configmap/Secret inside the same namespace
which contains inline YAML representing the values for the Helm chart.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
type: object
required:
- provider
type: object
Expand Down
26 changes: 26 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,32 @@ spec:
- ClusterResourceSet
- HelmAddon
type: string
values:
description: Values contains the helm values for the CNI when HelmAddon is the strategy.
properties:
sourceRef:
description: |-
SourceRef is an object reference to Configmap/Secret inside the same namespace
which contains inline YAML representing the values for the Helm chart.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
type: object
required:
- provider
type: object
Expand Down
26 changes: 26 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,32 @@ spec:
- ClusterResourceSet
- HelmAddon
type: string
values:
description: Values contains the helm values for the CNI when HelmAddon is the strategy.
properties:
sourceRef:
description: |-
SourceRef is an object reference to Configmap/Secret inside the same namespace
which contains inline YAML representing the values for the Helm chart.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
type: object
required:
- provider
type: object
Expand Down
41 changes: 41 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions docs/content/addons/cni.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,70 @@ spec:
strategy: HelmAddon
```

## Cilium Example with custom values

To enable deployment of Cilium on a cluster with custom helm values, specify the following:

```yaml
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: <NAME>
spec:
topology:
variables:
- name: clusterConfig
value:
addons:
cni:
provider: Cilium
strategy: HelmAddon
values:
sourceRef:
name: <name of Configmap/Secret present in same namespace>
kind: <Configmap/Secret>
```

NOTE: Only Configmap/Secret kind objects will be allowed to refer helm values from.

ConfigMap Format -

```yaml
apiVersion: v1
data:
values.yaml: |-
cni:
chainingMode: portmap
exclusive: false
ipam:
mode: kubernetes
kind: ConfigMap
metadata:
name: default-cilium-cni-helm-values-template-mgmt-cluster
namespace: <cluster's namespace>
```

Secret Format -

```yaml
apiVersion: v1
stringData:
values.yaml: |-
cni:
chainingMode: portmap
exclusive: false
ipam:
mode: kubernetes
kind: Secret
metadata:
name: default-cilium-cni-helm-values-template-mgmt-cluster
namespace: <cluster's namespace>
type: Opaque
```

NOTE: Configmap/Secret should contain complete helm values for Cilium as same will be applied
to Cilium helm chart as it is.

To deploy the addon via `ClusterResourceSet` replace the value of `strategy` with `ClusterResourceSet`.

## Calico
Expand Down
Loading