Skip to content

Commit

Permalink
PWX-33087 : CsiWindowsDriver image is not populating is storagecluste…
Browse files Browse the repository at this point in the history
…r desired images (#1219)

* Update yaml tag for csiWindowsDriver to match with spec generator

* update csiWindowsDriver tag in storagecluster crd

* correct nodeaffinity format

* rename toleration from windows to Windows

* build fix
  • Loading branch information
nikita-bhatia committed Aug 22, 2023
1 parent ecf4c35 commit 3e81379
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 47 deletions.
2 changes: 1 addition & 1 deletion deploy/crds/core_v1_storagecluster_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3828,7 +3828,7 @@ spec:
csiLivenessProbe:
type: string
description: Desired image for Liveness probe.
csiDriverWin:
csiWindowsDriver:
type: string
description: Desired image for csi driver for windows.
csiDriverRegistrar:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,21 @@ spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: name
operator: In
values:
- portworx-operator
topologyKey: kubernetes.io/hostname
- labelSelector:
matchExpressions:
- key: name
operator: In
values:
- portworx-operator
topologyKey: kubernetes.io/hostname
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: portworx-operator
image: docker.io/portworx/px-operator:23.7.1-dev
Expand Down
12 changes: 0 additions & 12 deletions deploy/windows/px-csi-node-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,11 @@ spec:
name: registration-dir
dnsPolicy: ClusterFirst
hostNetwork: true
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- windows
priorityClassName: system-node-critical
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
tolerations:
- key: os
value: Windows
volumes:
- hostPath:
path: 'C:\var\lib\kubelet\plugins_registry\'
Expand Down
4 changes: 2 additions & 2 deletions drivers/storage/portworx/component/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func (w *windows) getDesiredLivenessImage(cluster *corev1.StorageCluster) string

func (w *windows) getDesiredInstallerImage(cluster *corev1.StorageCluster) string {
var imageName string
if cluster.Status.DesiredImages != nil && cluster.Status.DesiredImages.CsiWinDriver != "" {
imageName = cluster.Status.DesiredImages.CsiWinDriver
if cluster.Status.DesiredImages != nil && cluster.Status.DesiredImages.CsiWindowsDriver != "" {
imageName = cluster.Status.DesiredImages.CsiWindowsDriver
}
imageName = util.GetImageURN(cluster, imageName)
return imageName
Expand Down
4 changes: 2 additions & 2 deletions drivers/storage/portworx/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type Release struct {
DynamicPlugin string `yaml:"dynamicPlugin,omitempty"`
DynamicPluginProxy string `yaml:"dynamicPluginProxy,omitempty"`
CsiLivenessProbe string `yaml:"csiLivenessProbe,omitempty"`
CsiWinDriver string `yaml:"csiWinDriver,omitempty"`
CsiWindowsDriver string `yaml:"csiWindowsDriver,omitempty"`
}

// Version is the response structure from a versions source
Expand Down Expand Up @@ -285,7 +285,7 @@ func fillCSIDefaults(
rel.Components.CSISnapshotController = csiImages.SnapshotController
rel.Components.CSIHealthMonitorController = csiImages.HealthMonitorController
rel.Components.CsiLivenessProbe = csiImages.LivenessProbe
rel.Components.CsiWinDriver = csiImages.CsiDriverInstaller
rel.Components.CsiWindowsDriver = csiImages.CsiDriverInstaller
}

func fillPrometheusDefaults(
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/portworx/portworx.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (p *portworx) SetDefaultsOnStorageCluster(toUpdate *corev1.StorageCluster)
toUpdate.Status.DesiredImages.CSISnapshotter = release.Components.CSISnapshotter
toUpdate.Status.DesiredImages.CSIHealthMonitorController = release.Components.CSIHealthMonitorController
toUpdate.Status.DesiredImages.CsiLivenessProbe = release.Components.CsiLivenessProbe
toUpdate.Status.DesiredImages.CsiWinDriver = release.Components.CsiWinDriver
toUpdate.Status.DesiredImages.CsiWindowsDriver = release.Components.CsiWindowsDriver
}
if autoUpdateCSISnapshotController(toUpdate) &&
(toUpdate.Status.DesiredImages.CSISnapshotController == "" ||
Expand Down
8 changes: 4 additions & 4 deletions drivers/storage/portworx/portworx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2191,8 +2191,8 @@ func TestStorageClusterDefaultsForWindows(t *testing.T) {

err := driver.SetDefaultsOnStorageCluster(cluster)
require.NoError(t, err)
require.Equal(t, cluster.Status.DesiredImages.CsiWinDriver, "docker.io/portworx/pxwincsidriver:v0.1")
require.Equal(t, cluster.Status.DesiredImages.CsiLivenessProbe, "registry.k8s.io/sig-storage/livenessprobe:v2.7.0")
require.Equal(t, cluster.Status.DesiredImages.CsiWindowsDriver, "docker.io/portworx/px-windows-csi-driver:v0.1")
require.Equal(t, cluster.Status.DesiredImages.CsiLivenessProbe, "registry.k8s.io/sig-storage/livenessprobe:v2.10.0")
require.Equal(t, cluster.Status.DesiredImages.CSIDriverRegistrar, "quay.io/k8scsi/driver-registrar:v1.2.3")

}
Expand Down Expand Up @@ -8554,8 +8554,8 @@ func (m *fakeManifest) GetVersions(
TelemetryProxy: "purestorage/envoy:1.2.3",
DynamicPlugin: "portworx/portworx-dynamic-plugin:1.1.0",
DynamicPluginProxy: "nginxinc/nginx-unprivileged:1.23",
CsiLivenessProbe: "registry.k8s.io/sig-storage/livenessprobe:v2.7.0",
CsiWinDriver: "docker.io/portworx/pxwincsidriver:v0.1",
CsiLivenessProbe: "registry.k8s.io/sig-storage/livenessprobe:v2.10.0",
CsiWindowsDriver: "docker.io/portworx/px-windows-csi-driver:v0.1",
},
}
if m.k8sVersion != nil && m.k8sVersion.GreaterThanOrEqual(k8sutil.K8sVer1_22) {
Expand Down
6 changes: 1 addition & 5 deletions drivers/storage/portworx/testspec/px-csi-node-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
value: 'unix://C:\\csi\\csi.sock'
imagePullPolicy: IfNotPresent
name: liveness-probe
image: registry.k8s.io/sig-storage/livenessprobe:v2.7.0
image: registry.k8s.io/sig-storage/livenessprobe:v2.10.0
resources:
limits:
memory: 100Mi
Expand Down Expand Up @@ -67,7 +67,6 @@ spec:
timeoutSeconds: 30
name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.3

resources:
limits:
memory: 100Mi
Expand Down Expand Up @@ -99,9 +98,6 @@ spec:
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
tolerations:
- key: os
value: Windows
volumes:
- hostPath:
path: 'C:\var\lib\kubelet\plugins_registry\'
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/portworx/testspec/px-csi-win-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
serviceAccountName: portworx
containers:
- name: windowsinstaller
image: docker.io/portworx/pxwincsidriver:v0.1
image: docker.io/portworx/px-windows-csi-driver:v0.1
imagePullPolicy: Always
securityContext:
windowsOptions:
Expand Down
4 changes: 2 additions & 2 deletions drivers/storage/portworx/util/csi_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ func (g *CSIGenerator) getSidecarContainerVersionsV1_0() *CSIImages {
Resizer: k8sutil.DefaultK8SRegistryPath + "/sig-storage/csi-resizer:v1.8.0",
SnapshotController: snapshotControllerImage,
HealthMonitorController: k8sutil.DefaultK8SRegistryPath + "/sig-storage/csi-external-health-monitor-controller:v0.7.0",
LivenessProbe: k8sutil.DefaultK8SRegistryPath + "/sig-storage/livenessprobe:v2.7.0",
CsiDriverInstaller: "docker.io/portworx/pxwincsidriver:v0.1",
LivenessProbe: k8sutil.DefaultK8SRegistryPath + "/sig-storage/livenessprobe:v2.10.0",
CsiDriverInstaller: "docker.io/portworx/px-windows-csi-driver:v0.1",
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/portworx/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ func ApplyWindowsSettingsToPodSpec(podSpec *v1.PodSpec) {

toleration := v1.Toleration{
Key: "os",
Value: WindowsOsName,
Value: "Windows",
}

podSpec.Tolerations = append(podSpec.Tolerations, toleration)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/core/v1/storagecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ type ComponentImages struct {
DynamicPlugin string `json:"dynamicPlugin,omitempty"`
DynamicPluginProxy string `json:"dynamicPluginProxy,omitempty"`
CsiLivenessProbe string `json:"csiLivenessProbe,omitempty"`
CsiWinDriver string `json:"csiWinDriver,omitempty"`
CsiWindowsDriver string `json:"csiWindowsDriver,omitempty"`
}

// Storage represents cluster storage details
Expand Down
4 changes: 2 additions & 2 deletions pkg/migration/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ func (h *Handler) handleCustomImageRegistry(cluster *corev1.StorageCluster) erro
DynamicPlugin: h.removeCustomImageRegistry(cluster.Spec.CustomImageRegistry, cluster.Status.DesiredImages.DynamicPlugin),
DynamicPluginProxy: h.removeCustomImageRegistry(cluster.Spec.CustomImageRegistry, cluster.Status.DesiredImages.DynamicPluginProxy),
CsiLivenessProbe: h.removeCustomImageRegistry(cluster.Spec.CustomImageRegistry, cluster.Status.DesiredImages.CsiLivenessProbe),
CsiWinDriver: h.removeCustomImageRegistry(cluster.Spec.CustomImageRegistry, cluster.Status.DesiredImages.CsiWinDriver),
CsiWindowsDriver: h.removeCustomImageRegistry(cluster.Spec.CustomImageRegistry, cluster.Status.DesiredImages.CsiWindowsDriver),
}
cluster.Status.Version = pxutil.GetImageTag(cluster.Spec.Image)
return nil
Expand Down Expand Up @@ -1337,7 +1337,7 @@ func (h *Handler) createManifestConfigMap(cluster *corev1.StorageCluster) error
DynamicPlugin: cluster.Status.DesiredImages.DynamicPlugin,
DynamicPluginProxy: cluster.Status.DesiredImages.DynamicPluginProxy,
CsiLivenessProbe: cluster.Status.DesiredImages.CsiLivenessProbe,
CsiWinDriver: cluster.Status.DesiredImages.CsiWinDriver,
CsiWindowsDriver: cluster.Status.DesiredImages.CsiWindowsDriver,
},
}

Expand Down

0 comments on commit 3e81379

Please sign in to comment.