diff --git a/charts/capi-runtime-extensions/README.md b/charts/capi-runtime-extensions/README.md index 39f710ccc..bb47ee299 100644 --- a/charts/capi-runtime-extensions/README.md +++ b/charts/capi-runtime-extensions/README.md @@ -31,6 +31,9 @@ A Helm chart for capi-runtime-extensions | deployDefaultClusterClasses | bool | `true` | | | deployment.replicas | int | `1` | | | env | object | `{}` | | +| hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.configMap.content | string | `""` | | +| hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.configMap.name | string | `"calico-cni-installation-awscluster"` | | +| hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.create | bool | `true` | | | hooks.CalicoCNI.defaultInstallationConfigMaps.DockerCluster.configMap.content | string | `""` | | | hooks.CalicoCNI.defaultInstallationConfigMaps.DockerCluster.configMap.name | string | `"calico-cni-installation-dockercluster"` | | | hooks.CalicoCNI.defaultInstallationConfigMaps.DockerCluster.create | bool | `true` | | diff --git a/charts/capi-runtime-extensions/templates/cni/calico/manifests/aws/installation.yaml b/charts/capi-runtime-extensions/templates/cni/calico/manifests/aws/installation.yaml new file mode 100644 index 000000000..bb072239a --- /dev/null +++ b/charts/capi-runtime-extensions/templates/cni/calico/manifests/aws/installation.yaml @@ -0,0 +1,36 @@ +# Copyright 2023 D2iQ, Inc. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.create }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: '{{ .Values.hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.configMap.name }}' +data: + calico-installation: | +{{- if .Values.hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.configMap.content -}} + {{ .Values.hooks.CalicoCNI.defaultInstallationConfigMaps.AWSCluster.configMap.content | nindent 4}} +{{- else -}} + # This section includes base Calico installation configuration. + # For more information, see: https://docs.projectcalico.org/reference/installation/api + apiVersion: operator.tigera.io/v1 + kind: Installation + metadata: + name: default + spec: + cni: + type: Calico + # Configures Calico networking. + calicoNetwork: + # Note: The ipPools section cannot be modified post-install. + ipPools: + - blockSize: 26 + cidr: {{ .Values.hooks.CalicoCNI.defaultPodSubnet }} + encapsulation: IPIP + natOutgoing: Enabled + nodeSelector: all() + bgp: Enabled + nodeMetricsPort: 9091 + typhaMetricsPort: 9093 +{{- end -}} +{{- end -}} diff --git a/charts/capi-runtime-extensions/values.yaml b/charts/capi-runtime-extensions/values.yaml index f59625e27..6ef1b1b1e 100644 --- a/charts/capi-runtime-extensions/values.yaml +++ b/charts/capi-runtime-extensions/values.yaml @@ -12,6 +12,11 @@ hooks: configMap: name: calico-cni-installation-dockercluster content: "" + AWSCluster: + create: true + configMap: + name: calico-cni-installation-awscluster + content: "" deployDefaultClusterClasses: true diff --git a/pkg/handlers/generic/lifecycle/cni/calico/handler.go b/pkg/handlers/generic/lifecycle/cni/calico/handler.go index 8f99b1d4c..5bd50cc61 100644 --- a/pkg/handlers/generic/lifecycle/cni/calico/handler.go +++ b/pkg/handlers/generic/lifecycle/cni/calico/handler.go @@ -60,6 +60,7 @@ func (c *CalicoCNIConfig) AddFlags(prefix string, flags *pflag.FlagSet) { prefix+".default-provider-installation-configmap-names", map[string]string{ "DockerCluster": "calico-cni-installation-dockercluster", + "AWSCluster": "calico-cni-installation-awscluster", }, "map of provider cluster implementation type to default installation ConfigMap name", )