From 0cb43a039fbbb41462d910206791977ece3a7b06 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine <5779804+AshleyDumaine@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:54:56 -0500 Subject: [PATCH] [feat] add HelmChartProxies for linode-ccm and linode-csi-driver, install ccm and cilium for default template (#116) * add HelmChartProxies for linode-ccm and linode-csi-driver * install CCM and cilium by default --- Tiltfile | 13 +--- templates/addons/cilium-helm.yaml | 22 ------ .../linode-blockstorage-csi-driver-helm.yaml | 19 +++++ templates/cluster-template.yaml | 74 +++++++++++++++++++ 4 files changed, 94 insertions(+), 34 deletions(-) delete mode 100644 templates/addons/cilium-helm.yaml create mode 100644 templates/addons/linode-blockstorage-csi-driver-helm.yaml diff --git a/Tiltfile b/Tiltfile index 6415c9a37..6c13782ae 100644 --- a/Tiltfile +++ b/Tiltfile @@ -4,7 +4,7 @@ docker_build("controller", ".", only=("Dockerfile", "Makefile", "vendor","go.mod local_resource( 'capi-controller-manager', - cmd='clusterctl init --addon helm', + cmd='EXP_CLUSTER_RESOURCE_SET=true clusterctl init --addon helm', ) k8s_yaml(kustomize('config/default')) @@ -29,14 +29,3 @@ k8s_resource( "%s:secret" % token_secret_name ] ) - -k8s_attach("caaph-controller-manager", "deployment.apps/caaph-controller-manager", namespace="caaph-system") - -k8s_yaml("./templates/addons/cilium-helm.yaml") -k8s_resource( - new_name="addon-cilium-helm", - objects=[ - "cilium:helmchartproxy" - ], - resource_deps=["capi-controller-manager", "cluster-api-provider-linode-controller-manager", "caaph-controller-manager"] -) diff --git a/templates/addons/cilium-helm.yaml b/templates/addons/cilium-helm.yaml deleted file mode 100644 index da0f2bfa1..000000000 --- a/templates/addons/cilium-helm.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: addons.cluster.x-k8s.io/v1alpha1 -kind: HelmChartProxy -metadata: - name: cilium -spec: - clusterSelector: - matchLabels: - cni: cilium - repoURL: https://helm.cilium.io/ - chartName: cilium - version: 1.15.0 - options: - waitForJobs: true - wait: true - timeout: 5m - valuesTemplate: | - hubble: - relay: - enabled: true - ui: - enabled: true ---- diff --git a/templates/addons/linode-blockstorage-csi-driver-helm.yaml b/templates/addons/linode-blockstorage-csi-driver-helm.yaml new file mode 100644 index 000000000..ebbb1e220 --- /dev/null +++ b/templates/addons/linode-blockstorage-csi-driver-helm.yaml @@ -0,0 +1,19 @@ +apiVersion: addons.cluster.x-k8s.io/v1alpha1 +kind: HelmChartProxy +metadata: + name: linode-blockstorage-csi-driver +spec: + clusterSelector: + matchLabels: + csi-driver: linode + repoURL: https://linode.github.io/linode-blockstorage-csi-driver/ + chartName: linode-blockstorage-csi-driver + namespace: kube-system + version: v0.6.3 + options: + waitForJobs: true + wait: true + timeout: 5m + valuesTemplate: | + secretRef: + name: "linode-token-region" diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 8a3730426..1abc7e072 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -5,6 +5,7 @@ metadata: labels: cni: cilium ccm: linode + crs: ${CLUSTER_NAME}-crs spec: clusterNetwork: pods: @@ -209,3 +210,76 @@ stringData: sysctl --system sed -i '/swap/d' /etc/fstab swapoff -a +--- +apiVersion: v1 +kind: Secret +type: addons.cluster.x-k8s.io/resource-set +metadata: + name: linode-${CLUSTER_NAME}-crs-0 +stringData: + linode-token-region.yaml: |- + kind: Secret + apiVersion: v1 + metadata: + name: linode-token-region + namespace: kube-system + stringData: + apiToken: ${LINODE_TOKEN} + region: ${LINODE_REGION} +--- +apiVersion: addons.cluster.x-k8s.io/v1beta1 +kind: ClusterResourceSet +metadata: + name: ${CLUSTER_NAME}-crs-0 +spec: + clusterSelector: + matchLabels: + crs: ${CLUSTER_NAME}-crs + resources: + - kind: Secret + name: linode-${CLUSTER_NAME}-crs-0 + strategy: ApplyOnce +--- +apiVersion: addons.cluster.x-k8s.io/v1alpha1 +kind: HelmChartProxy +metadata: + name: cilium +spec: + clusterSelector: + matchLabels: + cni: cilium + repoURL: https://helm.cilium.io/ + chartName: cilium + version: 1.15.0 + options: + waitForJobs: true + wait: true + timeout: 5m + valuesTemplate: | + hubble: + relay: + enabled: true + ui: + enabled: true +--- +apiVersion: addons.cluster.x-k8s.io/v1alpha1 +kind: HelmChartProxy +metadata: + name: linode-cloud-controller-manager +spec: + clusterSelector: + matchLabels: + ccm: linode + repoURL: https://linode.github.io/linode-cloud-controller-manager/ + chartName: ccm-linode + namespace: kube-system + version: v0.3.24 + options: + waitForJobs: true + wait: true + timeout: 5m + valuesTemplate: | + secretRef: + name: "linode-token-region" + image: + pullPolicy: IfNotPresent