Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ socketLB:
envoy:
image:
useDigest: false
k8sServiceHost: auto
{{- with .ControlPlane }}
{{- range $key, $val := .metadata.annotations }}
{{- if eq $key "controlplane.cluster.x-k8s.io/skip-kube-proxy" }}
kubeProxyReplacement: true{{ break }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions examples/capi-quick-start/aws-cluster-cilium-helm-addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
topology:
class: aws-quick-start
controlPlane:
metadata:
annotations:
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: clusterConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ spec:
topology:
class: nutanix-quick-start
controlPlane:
metadata: {}
metadata:
annotations:
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: clusterConfig
Expand Down
4 changes: 3 additions & 1 deletion hack/addons/kustomize/cilium/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ helmCharts:
skipTests: true
namespace: kube-system
kubeVersion: ${E2E_KUBERNETES_VERSION}
valuesFile: ../../../../charts/cluster-api-runtime-extensions-nutanix/addons/cni/cilium/values-template.yaml
# This values file will be created by the update-cilium-manifests.sh script when generating the CRS manifests.
valuesFile: helm-values.yaml
# The CRS manifests are generated from the Cilium Helm chart using Kustomize. The Cilium
# Helm chart uses a Helm hook to generate TLS certificates for Hubble. As the
# CRS manifests are static those Helm hooks don't apply and so for now Hubble is
Expand All @@ -29,5 +30,6 @@ helmCharts:
enabled: false
relay:
enabled: false
k8sServiceHost: ""

namespace: kube-system
13 changes: 9 additions & 4 deletions hack/addons/update-cilium-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ readonly FILE_NAME="cilium.yaml"

readonly KUSTOMIZE_BASE_DIR="${SCRIPT_DIR}/kustomize/cilium"
mkdir -p "${ASSETS_DIR}/cilium"
envsubst -no-unset <"${KUSTOMIZE_BASE_DIR}/kustomization.yaml.tmpl" >"${KUSTOMIZE_BASE_DIR}/kustomization.yaml"
trap_add "rm -f ${KUSTOMIZE_BASE_DIR}/kustomization.yaml" EXIT
envsubst -no-unset <"${KUSTOMIZE_BASE_DIR}/kustomization.yaml.tmpl" >"${ASSETS_DIR}/kustomization.yaml"

cat <<EOF >"${ASSETS_DIR}/gomplate-context.yaml"
ControlPlane: {}
EOF
gomplate -f "${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/addons/cni/cilium/values-template.yaml" \
--context .="${ASSETS_DIR}/gomplate-context.yaml" \
>"${ASSETS_DIR}/helm-values.yaml"

kustomize build \
--load-restrictor LoadRestrictionsNone \
--enable-helm "${KUSTOMIZE_BASE_DIR}/" >"${ASSETS_DIR}/${FILE_NAME}"
trap_add "rm -rf ${KUSTOMIZE_BASE_DIR}/charts/" EXIT
--enable-helm "${ASSETS_DIR}/" >"${ASSETS_DIR}/${FILE_NAME}"

# The operator manifest in YAML format is pretty big. It turns out that much of that is whitespace. Converting the
# manifest to JSON without indentation allows us to remove most of the whitespace, reducing the size by more than half.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ patches:
- target:
kind: Cluster
path: ../../../../../patches/cilium.yaml
- target:
kind: Cluster
path: ../../../../../patches/skip-kube-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ patches:
- target:
kind: Cluster
path: ../../../../../patches/cilium.yaml
- target:
kind: Cluster
path: ../../../../../patches/skip-kube-proxy.yaml
13 changes: 13 additions & 0 deletions hack/examples/patches/skip-kube-proxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: not-used
spec:
topology:
controlPlane:
metadata:
annotations:
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
26 changes: 25 additions & 1 deletion hack/tools/fetch-images/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,31 @@ func getValuesFileForChartIfNeeded(chartName, carenChartDirectory string) (strin
case "snapshot-controller":
return filepath.Join(carenChartDirectory, "addons", "csi", "snapshot-controller", defaultHelmAddonFilename), nil
case "cilium":
return filepath.Join(carenChartDirectory, "addons", "cni", "cilium", defaultHelmAddonFilename), nil
f := filepath.Join(carenChartDirectory, "addons", "cni", "cilium", defaultHelmAddonFilename)
tempFile, err := os.CreateTemp("", "")
if err != nil {
return "", fmt.Errorf("failed to create temp file: %w", err)
}

type input struct {
ControlPlane map[string]interface{}
}
templateInput := input{
ControlPlane: map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]interface{}{
"controlplane.cluster.x-k8s.io/skip-kube-proxy": "",
},
},
},
}

err = template.Must(template.New(defaultHelmAddonFilename).ParseFiles(f)).Execute(tempFile, &templateInput)
if err != nil {
return "", fmt.Errorf("failed to execute helm values template %w", err)
}

return tempFile.Name(), nil
// Calico values differ slightly per provider, but that does not have a material imapct on the images required
// so we can use the default values file for AWS provider.
case "tigera-operator":
Expand Down
Loading