From 670ead78bd8eaaffe42fd390b8ff53a66897d5b8 Mon Sep 17 00:00:00 2001 From: Serge Logvinov Date: Mon, 5 Feb 2024 11:11:52 +0200 Subject: [PATCH] feat: deploy without cni Run TalosCCM Deployment Without CNI Readines. When the useDaemonSet parameter is set to true, CCM will use the node IP to access Kubernetes and Talos API. Signed-off-by: Serge Logvinov --- charts/talos-cloud-controller-manager/README.md | 2 +- .../templates/deployment.yaml | 13 ++++++++++++- charts/talos-cloud-controller-manager/values.yaml | 3 ++- docs/deploy/cloud-controller-manager-daemonset.yml | 9 +++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/charts/talos-cloud-controller-manager/README.md b/charts/talos-cloud-controller-manager/README.md index e8e3907..e84cb50 100644 --- a/charts/talos-cloud-controller-manager/README.md +++ b/charts/talos-cloud-controller-manager/README.md @@ -80,7 +80,7 @@ helm upgrade -i --namespace=kube-system -f talos-ccm.yaml \ | serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. | | tolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane","operator":"Exists"},{"effect":"NoSchedule","key":"node.cloudprovider.kubernetes.io/uninitialized","operator":"Exists"}]` | Tolerations for data pods assignment. ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | | updateStrategy | object | `{"rollingUpdate":{"maxUnavailable":1},"type":"RollingUpdate"}` | Deployment update stategy type. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment | -| useDaemonSet | bool | `false` | Deploy CCM in Daemonset mode. CCM will use hostNetwork and host resolv.conf | +| useDaemonSet | bool | `false` | Deploy CCM in Daemonset mode. CCM will use hostNetwork and current node to access kubernetes/talos API You can run it without CNI plugin. | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) diff --git a/charts/talos-cloud-controller-manager/templates/deployment.yaml b/charts/talos-cloud-controller-manager/templates/deployment.yaml index ed2d7e2..4765fcf 100644 --- a/charts/talos-cloud-controller-manager/templates/deployment.yaml +++ b/charts/talos-cloud-controller-manager/templates/deployment.yaml @@ -65,6 +65,12 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP + - name: KUBERNETES_SERVICE_HOST + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: KUBERNETES_SERVICE_PORT + value: "6443" {{- end }} ports: - containerPort: {{ .Values.service.containerPort }} @@ -95,10 +101,15 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} tolerations: + {{- with .Values.tolerations }} {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.useDaemonSet }} + - effect: NoSchedule + key: node.kubernetes.io/not-ready + operator: Exists + {{- end }} volumes: - name: cloud-config configMap: diff --git a/charts/talos-cloud-controller-manager/values.yaml b/charts/talos-cloud-controller-manager/values.yaml index e7145c7..4afeb03 100644 --- a/charts/talos-cloud-controller-manager/values.yaml +++ b/charts/talos-cloud-controller-manager/values.yaml @@ -104,7 +104,8 @@ resources: memory: 64Mi # -- Deploy CCM in Daemonset mode. -# CCM will use hostNetwork and host resolv.conf +# CCM will use hostNetwork and current node to access kubernetes/talos API +# You can run it without CNI plugin. useDaemonSet: false # -- Deployment update stategy type. diff --git a/docs/deploy/cloud-controller-manager-daemonset.yml b/docs/deploy/cloud-controller-manager-daemonset.yml index b00f20a..8684408 100644 --- a/docs/deploy/cloud-controller-manager-daemonset.yml +++ b/docs/deploy/cloud-controller-manager-daemonset.yml @@ -236,6 +236,12 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP + - name: KUBERNETES_SERVICE_HOST + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: KUBERNETES_SERVICE_PORT + value: "6443" ports: - containerPort: 50258 name: https @@ -268,6 +274,9 @@ spec: - effect: NoSchedule key: node.cloudprovider.kubernetes.io/uninitialized operator: Exists + - effect: NoSchedule + key: node.kubernetes.io/not-ready + operator: Exists volumes: - name: cloud-config configMap: