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 support for powerscale 2.2.0 #47

Merged
merged 7 commits into from
Feb 24, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Run unit tests and check package coverage
uses: dell/common-github-actions/go-code-tester@csm-operator-controllers
with:
threshold: 50
threshold: 64
test_driver:
name: Run Go unit tests on driver and check package coverage
runs-on: ubuntu-latest
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Run unit tests and check package coverage
uses: dell/common-github-actions/go-code-tester@csm-operator-drivers
with:
threshold: 90
threshold: 77
go_security_scan:
name: Go security
runs-on: ubuntu-latest
Expand Down
9 changes: 9 additions & 0 deletions api/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ type Driver struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CSI Driver Type"
CSIDriverType DriverType `json:"csiDriverType" yaml:"csiDriverType"`

// CSIDriverSpec is the specification for CSIDriver
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CSI Driver Spec"
CSIDriverSpec CSIDriverSpec `json:"csiDriverSpec" yaml:"csiDriverSpec"`

// ConfigVersion is the configuration version of the driver
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Config Version"
ConfigVersion string `json:"configVersion" yaml:"configVersion"`
Expand Down Expand Up @@ -230,3 +234,8 @@ type SnapshotClass struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Snapshot Class Parameters"
Parameters map[string]string `json:"parameters,omitempty" yaml:"parameters"`
}

//CSIDriverSpec struct
type CSIDriverSpec struct {
FSGroupPolicy string `json:"fSGroupPolicy,omitempty" yaml:"fSGroupPolicy,omitempty"`
}
16 changes: 16 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ metadata:
"value": "debug"
}
],
"image": "dellemc/csi-isilon:v2.0.0",
"image": "dellemc/csi-isilon:v2.x.y",
"imagePullPolicy": "IfNotPresent"
},
"configVersion": "v2.0.0",
"configVersion": "v2.x.y",
"controller": {
"envs": [
{
Expand Down Expand Up @@ -112,7 +112,7 @@ metadata:
"image": "dellemc/csm-authorization-sidecar:v1.0.0"
}
],
"configVersion": "v2.0.0",
"configVersion": "v2.x.y",
"enabled": false,
"name": "authorization"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ spec:
type: object
type: array
type: object
csiDriverSpec:
description: CSIDriverSpec is the specification for CSIDriver
properties:
fSGroupPolicy:
type: string
type: object
csiDriverType:
description: CSIDriverType is the CSI Driver type for Dell EMC
- e.g, powermax, powerflex,...
Expand Down
4 changes: 4 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ configMapGenerator:
name: manager-config
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: dellemc/dell-csm-operator
newTag: 0.1.0
4 changes: 1 addition & 3 deletions controllers/csm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,10 @@ func (r *ContainerStorageModuleReconciler) PreChecks(ctx context.Context, cr *cs
if cr.Spec.Driver.Common.Image == "" {
return fmt.Errorf("driver image not specified in spec")
}
if cr.Spec.Driver.ConfigVersion == "" || cr.Spec.Driver.ConfigVersion != "v2.1.0" {
if cr.Spec.Driver.ConfigVersion == "" || cr.Spec.Driver.ConfigVersion != "v2.2.0" {
return fmt.Errorf("driver version not specified in spec or driver version is not valid")
}

// add check for version

// Check drivers
switch cr.Spec.Driver.CSIDriverType {
case csmv1.PowerScale:
Expand Down
7 changes: 7 additions & 0 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
name: dell-csm-operator
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ spec:
- name: socket-dir
mountPath: /var/run/csi
- name: driver
image: dellemc/csi-isilon:v2.1.0
image: dellemc/csi-isilon:v2.2.0
imagePullPolicy: IfNotPresent
command: [ "/csi-isilon" ]
args:
Expand Down Expand Up @@ -285,4 +285,4 @@ spec:
secretName: <DriverDefaultReleaseName>-creds
- name: csi-isilon-config-params
configMap:
name: <DriverDefaultReleaseName>-config-params
name: <DriverDefaultReleaseName>-config-params
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
spec:
attachRequired: true
podInfoOnMount: true
fsGroupPolicy: ReadWriteOnceWithFSType
volumeLifecycleModes:
- Persistent
- Ephemeral
- Ephemeral
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: dellemc/csi-isilon:v2.1.0
image: dellemc/csi-isilon:v2.2.0
imagePullPolicy: IfNotPresent
env:
- name: CSI_ENDPOINT
Expand Down
2 changes: 1 addition & 1 deletion operatorconfig/moduleconfig/common/version-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ powerscale:
# List of Driver versions and modules that supports the version
v2.0.0:
authorization: "v1.0.0"
v2.1.0:
v2.2.0:
authorization: "v1.0.0"
11 changes: 11 additions & 0 deletions pkg/drivers/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,16 @@ func GetCSIDriver(ctx context.Context, cr csmv1.ContainerStorageModule, operator
return nil, err
}

if cr.Spec.Driver.CSIDriverSpec.FSGroupPolicy != "" {
fsGroupPolicy := storagev1.NoneFSGroupPolicy
if cr.Spec.Driver.CSIDriverSpec.FSGroupPolicy == "ReadWriteOnceWithFSType" {
fsGroupPolicy = storagev1.ReadWriteOnceWithFSTypeFSGroupPolicy
} else if cr.Spec.Driver.CSIDriverSpec.FSGroupPolicy == "File" {
fsGroupPolicy = storagev1.FileFSGroupPolicy
}
csidriver.Spec.FSGroupPolicy = &fsGroupPolicy
log.Debugw("GetCSIDriver", "fsGroupPolicy", fsGroupPolicy)
}

return &csidriver, nil
}
4 changes: 2 additions & 2 deletions pkg/modules/testdata/cr_powerscale_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
spec:
driver:
csiDriverType: "isilon"
configVersion: v2.1.0
configVersion: v2.2.0
authSecret: test-isilon-creds-custom
replicas: 1
common:
image: "dellemc/csi-isilon:v2.1.0"
image: "dellemc/csi-isilon:v2.2.0"
imagePullPolicy: IfNotPresent

modules:
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func getDaemonSetStatus(ctx context.Context, instance *csmv1.ContainerStorageMod
failedCount++
for _, cs := range pod.Status.ContainerStatuses {
if cs.State.Waiting != nil && cs.State.Waiting.Reason != constants.ContainerCreating {
//message: Back-off pulling image "dellec/csi-isilon:v2.1.0"
//message: Back-off pulling image "dellec/csi-isilon:xxxx"
//reason: ImagePullBackOff
log.Infow("daemonset pod container", "message", cs.State.Waiting.Message, constants.Reason, cs.State.Waiting.Reason)
shortMsg := strings.Replace(cs.State.Waiting.Message,
Expand Down
13 changes: 9 additions & 4 deletions samples/storage_csm_powerscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ metadata:
spec:
driver:
csiDriverType: "isilon"
# Config version for CSI PowerScale v2.1.0 driver
configVersion: v2.1.0
csiDriverSpec:
# fsGroupPolicy: Defines if the underlying volume supports changing ownership and permission of the volume before being mounted.
# Allowed values: ReadWriteOnceWithFSType, File , None
# Default value: ReadWriteOnceWithFSType
fSGroupPolicy: "ReadWriteOnceWithFSType"
# Config version for CSI PowerScale v2.2.0 driver
configVersion: v2.2.0
authSecret: test-isilon-creds
replicas: 1
dnsPolicy: ClusterFirstWithHostNet
forceUpdate: false
# Uninstall CSI Driver and/or modules when CR is deleted
forceRemoveDriver: false
common:
# Image for CSI PowerScale driver v2.1.0
image: "dellemc/csi-isilon:v2.1.0"
# Image for CSI PowerScale driver v2.2.0
image: "dellemc/csi-isilon:nightly"
imagePullPolicy: IfNotPresent
envs:
# X_CSI_VERBOSE: Indicates what content of the OneFS REST API message should be logged in debug level logs
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test for CSM Operator
This is the test directory for CSM operator.

`config` directory includes yaml files consumed by test cases. For example `driverconfig/powerscale/v2.1.0/node.yaml` is consumed by `pkg/drivers/commonconfig_test.go`.
`config` directory includes yaml files consumed by test cases. For example `driverconfig/powerscale/v2.x.y/node.yaml` is consumed by `pkg/drivers/commonconfig_test.go`.

`shared/clientgoclient` implements kubernetes client from client-go package. It has a getter function for each API version like `AppsV1Interface` or `CoreV1Interface`. `AppsV1Interface` is the one that we need as it has getter function for `daemonsetInterface`. The `daemonsetInterface` has all `Create`, `Apply`, `Delete` etc. methods that we will be using to manipulate Kubernetes runtime objects.

Expand Down
14 changes: 0 additions & 14 deletions tests/config/driverconfig/powerscale/v2.1.0/csidriver.yaml

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: dellemc/csi-isilon:v2.1.0
image: dellemc/csi-isilon:v2.2.0
imagePullPolicy: IfNotPresent
env:
- name: CSI_ENDPOINT
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/testfiles/storage_csm_powerscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ spec:
driver:
csiDriverType: "isilon"

# Config version for CSI PowerScale v2.1.0 driver
configVersion: v2.1.0
# Config version for CSI PowerScale v2.2.0 driver
configVersion: v2.2.0

authSecret: test-isilon-creds

replicas: 1
dnsPolicy: ClusterFirstWithHostNet
forceUpdate: false
common:
# Image for CSI PowerScale driver v2.1.0
# Image for CSI PowerScale driver v2.2.0
image: "dellemc/csi-isilon:nightly"
imagePullPolicy: IfNotPresent
envs:
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/testfiles/storage_csm_powerscale_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ spec:
driver:
csiDriverType: "isilon"

# Config version for CSI PowerScale v2.1.0 driver
configVersion: v2.1.0
# Config version for CSI PowerScale v2.2.0 driver
configVersion: v2.2.0

authSecret: test-isilon-creds-auth

replicas: 1
dnsPolicy: ClusterFirstWithHostNet
forceUpdate: false
common:
# Image for CSI PowerScale driver v2.1.0
# Image for CSI PowerScale driver v2.2.0
image: "dellemc/csi-isilon:nightly"
imagePullPolicy: IfNotPresent
envs:
Expand Down
2 changes: 1 addition & 1 deletion tests/shared/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const (
// ConfigVersion - used in all unit test
ConfigVersion string = "v2.1.0"
ConfigVersion string = "v2.2.0"
)

// StorageKey is used to store a runtime object. It's used for both clientgo client and controller runtime client
Expand Down