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

Add powerflex 2.6 features(ApproveSdc,RenameSdc) support to csm-operator #176

Merged
merged 5 commits into from
Feb 23, 2023
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
8 changes: 7 additions & 1 deletion operatorconfig/driverconfig/powerflex/v2.6.0/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ spec:
value: /certs
- name: X_CSI_HEALTH_MONITOR_ENABLED
value: false
- name: X_CSI_APPROVE_SDC_ENABLED
value: <X_CSI_APPROVE_SDC_ENABLED>
- name: X_CSI_RENAME_SDC_ENABLED
value: <X_CSI_RENAME_SDC_ENABLED>
- name: X_CSI_RENAME_SDC_PREFIX
value: <X_CSI_RENAME_SDC_PREFIX>
volumeMounts:
- name: driver-path
mountPath: <KUBELET_CONFIG_DIR>/plugins/vxflexos.emc.dell.com
Expand Down Expand Up @@ -257,4 +263,4 @@ spec:
name: <DriverDefaultReleaseName>-certs-0
items:
- key: cert-0
path: cert-0
path: cert-0
3 changes: 3 additions & 0 deletions pkg/drivers/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ func GetNode(ctx context.Context, cr csmv1.ContainerStorageModule, operatorConfi
if cr.Spec.Driver.CSIDriverType == "powerstore" {
YamlString = ModifyPowerstoreCR(YamlString, cr, "Node")
}
if cr.Spec.Driver.CSIDriverType == "powerflex" {
YamlString = ModifyPowerflexCR(YamlString, cr, "Node")
}

driverYAML, err := utils.GetDriverYaml(YamlString, "DaemonSet")
if err != nil {
Expand Down
36 changes: 36 additions & 0 deletions pkg/drivers/powerflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const (

// PowerFlexConfigParamsVolumeMount -
PowerFlexConfigParamsVolumeMount = "vxflexos-config-params"

// CsiApproveSdcEnabled - Flag to enable/disable SDC approval
CsiApproveSdcEnabled = "<X_CSI_APPROVE_SDC_ENABLED>"

// CsiRenameSdcEnabled - Flag to enable/disable rename of SDC
CsiRenameSdcEnabled = "<X_CSI_RENAME_SDC_ENABLED>"

// CsiPrefixRenameSdc - String to rename SDC
CsiPrefixRenameSdc = "<X_CSI_RENAME_SDC_PREFIX>"
)

// PrecheckPowerFlex do input validation
Expand Down Expand Up @@ -203,3 +212,30 @@ var (
func IsIpv4Regex(ipAddress string) bool {
return ipRegex.MatchString(ipAddress)
}

// ModifyPowerflexCR - Set environment variables provided in CR
func ModifyPowerflexCR(yamlString string, cr csmv1.ContainerStorageModule, fileType string) string {

approveSdcEnabled := ""
renameSdcEnabled := ""
renameSdcPrefix := ""

switch fileType {
case "Node":
for _, env := range cr.Spec.Driver.Node.Envs {
if env.Name == "X_CSI_APPROVE_SDC_ENABLED" {
approveSdcEnabled = env.Value
}
if env.Name == "X_CSI_RENAME_SDC_ENABLED" {
renameSdcEnabled = env.Value
}
if env.Name == "X_CSI_RENAME_SDC_PREFIX" {
renameSdcPrefix = env.Value
}
}
yamlString = strings.ReplaceAll(yamlString, CsiApproveSdcEnabled, approveSdcEnabled)
yamlString = strings.ReplaceAll(yamlString, CsiRenameSdcEnabled, renameSdcEnabled)
yamlString = strings.ReplaceAll(yamlString, CsiPrefixRenameSdc, renameSdcPrefix)
}
return yamlString
}
23 changes: 23 additions & 0 deletions samples/storage_csm_powerflex_v260.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,29 @@ spec:
# Default value: false
- name: X_CSI_HEALTH_MONITOR_ENABLED
value: "false"

# X_CSI_APPROVE_SDC_ENABLED: Enables/Disable SDC approval
# Allowed values:
# true: enable SDC approval
# false: disable SDC approval
# Default value: false
- name: X_CSI_APPROVE_SDC_ENABLED
value: "false"

# X_CSI_RENAME_SDC_ENABLED: Enable/Disable rename of SDC
# Allowed values:
# true: enable renaming
# false: disable renaming
# Default value: false
- name: X_CSI_RENAME_SDC_ENABLED
value: "false"

# X_CSI_RENAME_SDC_PREFIX: defines a string for prefix of the SDC name.
# "prefix" + "worker_node_hostname" should not exceed 31 chars.
# Default value: none
# Examples: "rhel-sdc", "sdc-test"
- name: X_CSI_RENAME_SDC_PREFIX
value: ""


# "node.nodeSelector" defines what nodes would be selected for pods of node daemonset
Expand Down