From 2da2ca151d87ff37f33ccc6752fab4b853376082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suraj=20Banakar=28=E0=A4=AC=E0=A4=BE=E0=A4=A8=E0=A4=95?= =?UTF-8?q?=E0=A4=B0=29=20=7C=20=E3=82=B9=E3=83=A9=E3=82=B8?= Date: Fri, 12 Jan 2024 21:15:23 +0530 Subject: [PATCH] feat: make `hostNetwork` configurable (#107) * disable it by default (fixes port conflict issue on the node if another port is trying to acquire the same port) * chore: update `VERSION` in the `Makefile` * chore: replace `hostNetwork: true` with `hostNetwork: false` * fix: template substituion for `hostNetwork` --- Makefile | 2 +- charts/warm-metal-csi-driver/Chart.yaml | 4 ++-- charts/warm-metal-csi-driver/templates/nodeplugin.yaml | 2 +- charts/warm-metal-csi-driver/values.yaml | 1 + cmd/install/main.go | 2 +- pkg/pullexecutor/pullexecutor.go | 3 ++- sample/install/cri-o.yaml | 2 +- sample/install/k3s-containerd.yaml | 2 +- sample/install/minikube-containerd.yaml | 2 +- sample/install/snap-microk8s-containerd.yaml | 2 +- 10 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index f6cc1d5..db60d80 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION ?= v1.0.0 +VERSION ?= v1.0.1 IMAGE_BUILDER ?= docker IMAGE_BUILD_CMD ?= buildx diff --git a/charts/warm-metal-csi-driver/Chart.yaml b/charts/warm-metal-csi-driver/Chart.yaml index 614fd6f..46b2106 100644 --- a/charts/warm-metal-csi-driver/Chart.yaml +++ b/charts/warm-metal-csi-driver/Chart.yaml @@ -15,9 +15,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.0 +version: 1.0.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: v1.0.0 +appVersion: v1.0.1 diff --git a/charts/warm-metal-csi-driver/templates/nodeplugin.yaml b/charts/warm-metal-csi-driver/templates/nodeplugin.yaml index d125159..9918a5a 100644 --- a/charts/warm-metal-csi-driver/templates/nodeplugin.yaml +++ b/charts/warm-metal-csi-driver/templates/nodeplugin.yaml @@ -122,7 +122,7 @@ spec: - mountPath: {{ .Values.crioMountProgram }} name: crio-mount-program {{- end }} - hostNetwork: true + hostNetwork: {{.Values.csiPlugin.hostNetwork}} serviceAccountName: {{ include "warm-metal-csi-driver.fullname" . }}-nodeplugin volumes: - hostPath: diff --git a/charts/warm-metal-csi-driver/values.yaml b/charts/warm-metal-csi-driver/values.yaml index de0e625..cf577ff 100644 --- a/charts/warm-metal-csi-driver/values.yaml +++ b/charts/warm-metal-csi-driver/values.yaml @@ -9,6 +9,7 @@ enableAsyncPullMount: false pullImageSecretForDaemonset: csiPlugin: + hostNetwork: false resources: {} image: tag: "" diff --git a/cmd/install/main.go b/cmd/install/main.go index 8b66de8..2c82a62 100644 --- a/cmd/install/main.go +++ b/cmd/install/main.go @@ -278,7 +278,7 @@ spec: labels: app: csi-image-warm-metal spec: - hostNetwork: true + hostNetwork: false serviceAccountName: csi-image-warm-metal containers: - name: node-driver-registrar diff --git a/pkg/pullexecutor/pullexecutor.go b/pkg/pullexecutor/pullexecutor.go index f72149c..945e32d 100644 --- a/pkg/pullexecutor/pullexecutor.go +++ b/pkg/pullexecutor/pullexecutor.go @@ -102,7 +102,8 @@ func (m *PullExecutor) StartPulling(o *PullOptions) error { c, cancel := context.WithTimeout(context.Background(), pullCtxTimeout) defer cancel() - if pullstatus.Get(o.NamedRef) == pullstatus.StillPulling { + if pullstatus.Get(o.NamedRef) == pullstatus.StillPulling || + pullstatus.Get(o.NamedRef) == pullstatus.Pulled { return } diff --git a/sample/install/cri-o.yaml b/sample/install/cri-o.yaml index 15a75c4..a6fe4d4 100644 --- a/sample/install/cri-o.yaml +++ b/sample/install/cri-o.yaml @@ -126,7 +126,7 @@ spec: - mountPath: /run/containers/storage mountPropagation: Bidirectional name: crio-run-root - hostNetwork: true + hostNetwork: false serviceAccountName: csi-image-warm-metal volumes: - hostPath: diff --git a/sample/install/k3s-containerd.yaml b/sample/install/k3s-containerd.yaml index 9580348..65416d9 100644 --- a/sample/install/k3s-containerd.yaml +++ b/sample/install/k3s-containerd.yaml @@ -117,7 +117,7 @@ spec: - mountPath: /var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.overlayfs mountPropagation: Bidirectional name: snapshot-root-0 - hostNetwork: true + hostNetwork: false serviceAccountName: csi-image-warm-metal volumes: - hostPath: diff --git a/sample/install/minikube-containerd.yaml b/sample/install/minikube-containerd.yaml index e3b469e..ea2c4af 100644 --- a/sample/install/minikube-containerd.yaml +++ b/sample/install/minikube-containerd.yaml @@ -123,7 +123,7 @@ spec: - mountPath: /mnt/vda1/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs mountPropagation: Bidirectional name: snapshot-root-0 - hostNetwork: true + hostNetwork: false serviceAccountName: csi-image-warm-metal volumes: - hostPath: diff --git a/sample/install/snap-microk8s-containerd.yaml b/sample/install/snap-microk8s-containerd.yaml index 230fa67..70472fc 100644 --- a/sample/install/snap-microk8s-containerd.yaml +++ b/sample/install/snap-microk8s-containerd.yaml @@ -117,7 +117,7 @@ spec: - mountPath: /var/snap/microk8s/common/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs mountPropagation: Bidirectional name: snapshot-root-0 - hostNetwork: true + hostNetwork: false serviceAccountName: csi-image-warm-metal volumes: - hostPath: