Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resiliency support powermax #569

Merged
merged 2 commits into from
Jun 25, 2024
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
44 changes: 44 additions & 0 deletions config/samples/storage_v1_csm_powermax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,47 @@ spec:
# configMap name which has all array/endpoint related info
- name: "X_CSI_CONFIG_MAP_NAME"
value: "powermax-reverseproxy-config"
- name: resiliency
# enabled: Enable/Disable Resiliency feature
# Allowed values:
# true: enable Resiliency feature(deploy podmon sidecar)
# false: disable Resiliency feature(do not deploy podmon sidecar)
# Default value: false
enabled: false
configVersion: v1.9.0
components:
- name: podmon-controller
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--skipArrayConnectionValidation=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
- "--arrayConnectivityConnectionLossThreshold=3"
# Below 4 args should not be modified.
- "--csisock=unix:/var/run/csi/csi.sock"
- "--mode=controller"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"
- name: podmon-node
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
envs:
# podmonAPIPort: Defines the port to be used within the kubernetes cluster
# Allowed values: Any valid and free port (string)
# Default value: 8083
- name: "X_CSI_PODMON_API_PORT"
value: "8083"
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--leaderelection=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
# Below 4 args should not be modified.
- "--csisock=unix:/var/lib/kubelet/plugins/powermax.emc.dell.com/csi_sock"
- "--mode=node"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"
19 changes: 19 additions & 0 deletions operatorconfig/driverconfig/powermax/v2.10.0/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ spec:
- name: pods-path
mountPath: <KUBELET_CONFIG_DIR>/pods
mountPropagation: "Bidirectional"
- name: csi-path
mountPath: <KUBELET_CONFIG_DIR>/plugins/kubernetes.io/csi
mountPropagation: "Bidirectional"
- name: dev
mountPath: /dev
- name: sys
Expand Down Expand Up @@ -228,6 +231,9 @@ spec:
hostPath:
path: <KUBELET_CONFIG_DIR>/plugins/kubernetes.io/csi/volumeDevices
type: DirectoryOrCreate
- name: csi-path
hostPath:
path: <KUBELET_CONFIG_DIR>/plugins/kubernetes.io/csi
- name: pods-path
hostPath:
path: <KUBELET_CONFIG_DIR>/pods
Expand Down Expand Up @@ -259,3 +265,16 @@ spec:
configMap:
name: node-topology-config
optional: true
- name: kubelet-pods
hostPath:
path: /var/lib/kubelet/pods
type: Directory
- name: usr-bin
hostPath:
path: /usr/bin
type: Directory
- name: var-run
hostPath:
path: /var/run
type: Directory

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
#
# Copyright © 2023 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
name: podmon
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: socket-dir
mountPath: /var/run/csi
- name: powermax-config-params
mountPath: /powermax-config-params
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
#
# Copyright © 2023 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
name: podmon
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: X_CSI_PRIVATE_MOUNT_DIR
value: /var/lib/kubelet
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: kubelet-pods
mountPath: <KUBELET_CONFIG_DIR>/pods
mountPropagation: "Bidirectional"
- name: driver-path
mountPath: <KUBELET_CONFIG_DIR>/plugins/powermax.emc.dell.com
mountPropagation: "Bidirectional"
- name: csi-path
mountPath: <KUBELET_CONFIG_DIR>/plugins/kubernetes.io/csi
mountPropagation: "Bidirectional"
- name: dev
mountPath: /dev
- name: usr-bin
mountPath: /usr-bin
- name: var-run
mountPath: /var/run
- name: powermax-config-params
mountPath: /powermax-config-params
8 changes: 6 additions & 2 deletions pkg/modules/resiliency.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ var ResiliencySupportedDrivers = map[string]SupportedDriverParam{
PluginIdentifier: drivers.PowerFlexPluginIdentifier,
DriverConfigParamsVolumeMount: drivers.PowerFlexConfigParamsVolumeMount,
},
string(csmv1.PowerMax): {
PluginIdentifier: drivers.PowerMaxPluginIdentifier,
DriverConfigParamsVolumeMount: drivers.PowerMaxConfigParamsVolumeMount,
},
}

// ResiliencyPrecheck - Resiliency module precheck for supported versions
Expand Down Expand Up @@ -217,8 +221,8 @@ func ResiliencyInjectDeployment(dp applyv1.DeploymentApplyConfiguration, cr csmv
if driverType == string(csmv1.PowerScale) {
driverType = string(csmv1.PowerScaleName)
}
// we need to set these ENV for PowerStore & PowerScale only
if driverType == string(csmv1.PowerScaleName) || driverType == string(csmv1.PowerStore) {
// we need to set these ENV for PowerStore, PowerMax & PowerScale only
if driverType == string(csmv1.PowerScaleName) || driverType == string(csmv1.PowerStore) || driverType == string(csmv1.PowerMax) {
for i, cnt := range dp.Spec.Template.Spec.Containers {
if *cnt.Name == "driver" {
podmonAPIPort := getResiliencyEnv(*resiliencyModule, cr.Spec.Driver.CSIDriverType)
Expand Down
28 changes: 28 additions & 0 deletions pkg/modules/resiliency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,34 @@ func TestResiliencyInjectDeployment(t *testing.T) {
}
return true, *newDeployment, operatorConfig, customResource
},
"success - valid PowerMax driver name": func(*testing.T) (bool, applyv1.DeploymentApplyConfiguration, utils.OperatorConfig, csmv1.ContainerStorageModule) {
customResource, err := getCustomResource("./testdata/cr_powermax_resiliency.yaml")
if err != nil {
panic(err)
}
controllerYAML, err := drivers.GetController(ctx, customResource, operatorConfig, csmv1.PowerMax)
if err != nil {
panic(err)
}
newDeployment, err := ResiliencyInjectDeployment(controllerYAML.Deployment, customResource, operatorConfig, string(csmv1.PowerMax))
if err != nil {
panic(err)
}
return true, *newDeployment, operatorConfig, customResource
},
"fail - bad PowerMax config path": func(*testing.T) (bool, applyv1.DeploymentApplyConfiguration, utils.OperatorConfig, csmv1.ContainerStorageModule) {
customResource, err := getCustomResource("./testdata/cr_powermax_resiliency.yaml")
if err != nil {
panic(err)
}
controllerYAML, err := drivers.GetController(ctx, customResource, operatorConfig, csmv1.PowerMax)
if err != nil {
panic(err)
}
tmpOperatorConfig := operatorConfig
tmpOperatorConfig.ConfigDirectory = "bad/path"
return false, controllerYAML.Deployment, tmpOperatorConfig, customResource
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
Expand Down
54 changes: 54 additions & 0 deletions pkg/modules/testdata/cr_powermax_resiliency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: storage.dell.com/v1
kind: ContainerStorageModule
metadata:
name: powermax
namespace: powermax
spec:
driver:
csiDriverType: "powermax"
configVersion: v2.10.0
authSecret: powermax-creds
replicas: 1
common:
image: "dellemc/csi-powermax:v2.10.0"
imagePullPolicy: IfNotPresent

modules:
- name: resiliency
configVersion: "v1.10.0"
enabled: true
components:
- name: podmon-controller
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--skipArrayConnectionValidation=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
- "--arrayConnectivityConnectionLossThreshold=3"
- "--csisock=unix:/var/run/csi/csi.sock"
- "--mode=controller"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"
- name: podmon-node
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
envs:
# podmonAPIPort: Defines the port to be used within the kubernetes cluster
# Allowed values: Any valid and free port (string)
# Default value: 8083
- name: "X_CSI_PODMON_API_PORT"
value: "8083"
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--leaderelection=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
- "--csisock=unix:/var/lib/kubelet/plugins/powermax.emc.dell.com/csi_sock"
- "--mode=node"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"

43 changes: 43 additions & 0 deletions tests/e2e/testfiles/scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1505,3 +1505,46 @@ List of E2E Tests Scenarios
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"

- scenario: "Install Powermax Driver(Standalone), Enable Resiliency"
paths:
- "testfiles/storage_csm_powermax.yaml"
tags:
- "powermax"
- "resiliency"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Validate [resiliency] module from CR [1] is not installed"
- "Enable [resiliency] module from CR [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Validate [resiliency] module from CR [1] is installed"
- "Run custom test"
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
customTest:
name: CustomTest
run:
- "echo Todo"

- scenario: "Install Powermax Driver(With Resiliency), Disable Resiliency module"
paths:
- "testfiles/storage_csm_powermax_resiliency.yaml"
tags:
- "powermax"
- "resiliency"
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Apply custom resource [1]"
- "Validate custom resource [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Validate [resiliency] module from CR [1] is installed"
- "Disable [resiliency] module from CR [1]"
- "Validate [powermax] driver from CR [1] is installed"
- "Validate [resiliency] module from CR [1] is not installed"
# cleanup
- "Enable forceRemoveDriver on CR [1]"
- "Delete custom resource [1]"
44 changes: 44 additions & 0 deletions tests/e2e/testfiles/storage_csm_powermax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,47 @@ spec:
value: "2222"
- name: X_CSI_CONFIG_MAP_NAME
value: "powermax-reverseproxy-config"
- name: resiliency
# enabled: Enable/Disable Resiliency feature
# Allowed values:
# true: enable Resiliency feature(deploy podmon sidecar)
# false: disable Resiliency feature(do not deploy podmon sidecar)
# Default value: false
enabled: false
configVersion: v1.10.0
components:
- name: podmon-controller
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--skipArrayConnectionValidation=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
- "--arrayConnectivityConnectionLossThreshold=3"
# Below 4 args should not be modified.
- "--csisock=unix:/var/run/csi/csi.sock"
- "--mode=controller"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"
- name: podmon-node
image: dellemc/podmon:v1.9.0
imagePullPolicy: IfNotPresent
envs:
# podmonAPIPort: Defines the port to be used within the kubernetes cluster
# Allowed values: Any valid and free port (string)
# Default value: 8083
- name: "X_CSI_PODMON_API_PORT"
value: "8083"
args:
- "--labelvalue=csi-powermax"
- "--arrayConnectivityPollRate=60"
- "--leaderelection=false"
- "--driverPodLabelValue=dell-storage"
- "--ignoreVolumelessPods=false"
# Below 4 args should not be modified.
- "--csisock=unix:/var/lib/kubelet/plugins/powermax.emc.dell.com/csi_sock"
- "--mode=node"
- "--driver-config-params=/powermax-config-params/driver-config-params.yaml"
- "--driverPath=csi-powermax.dellemc.com"
Loading
Loading