diff --git a/apis/v1/storageoscluster_types.go b/apis/v1/storageoscluster_types.go index 35fe7420..93f0c722 100644 --- a/apis/v1/storageoscluster_types.go +++ b/apis/v1/storageoscluster_types.go @@ -144,6 +144,9 @@ type StorageOSClusterSpec struct { // Disable StorageOS scheduler extender. DisableScheduler bool `json:"disableScheduler,omitempty"` + + // Environment contains environment variables that are passed to StorageOS. + Environment map[string]string `json:"environment,omitempty"` } // ContainerImages contains image names of all the containers used by the operator. diff --git a/apis/v1/zz_generated.deepcopy.go b/apis/v1/zz_generated.deepcopy.go index fd10c1f3..b36f6bd9 100644 --- a/apis/v1/zz_generated.deepcopy.go +++ b/apis/v1/zz_generated.deepcopy.go @@ -221,6 +221,13 @@ func (in *StorageOSClusterSpec) DeepCopyInto(out *StorageOSClusterSpec) { } } in.Resources.DeepCopyInto(&out.Resources) + if in.Environment != nil { + in, out := &in.Environment, &out.Environment + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageOSClusterSpec. diff --git a/config/crd/bases/storageos.com_storageosclusters.yaml b/config/crd/bases/storageos.com_storageosclusters.yaml index 069ec522..ca0a3cf7 100644 --- a/config/crd/bases/storageos.com_storageosclusters.yaml +++ b/config/crd/bases/storageos.com_storageosclusters.yaml @@ -122,6 +122,12 @@ spec: disableTelemetry: description: Disable Telemetry. type: boolean + environment: + additionalProperties: + type: string + description: Environment contains environment variables that are passed + to StorageOS. + type: object forceTCMU: description: "Force TCMU can be set to true to ensure that TCMU is enabled or cause StorageOS to abort startup. \n At startup, StorageOS diff --git a/config/manager/related_images_config.yaml b/config/manager/related_images_config.yaml index c90edbf4..0a93e8aa 100644 --- a/config/manager/related_images_config.yaml +++ b/config/manager/related_images_config.yaml @@ -1,4 +1,4 @@ -RELATED_IMAGE_API_MANAGER=storageos/api-manager:v1.1.3-alpha1 +RELATED_IMAGE_API_MANAGER=storageos/api-manager:v1.1.3-alpha2 RELATED_IMAGE_CSIV1_EXTERNAL_PROVISIONER=storageos/csi-provisioner:v2.1.1-patched RELATED_IMAGE_CSIV1_EXTERNAL_ATTACHER_V3=quay.io/k8scsi/csi-attacher:v3.1.0 RELATED_IMAGE_CSIV1_EXTERNAL_RESIZER=quay.io/k8scsi/csi-resizer:v1.1.0 diff --git a/controllers/storageoscluster/node_operand.go b/controllers/storageoscluster/node_operand.go index 3bf8dfde..73378e2f 100644 --- a/controllers/storageoscluster/node_operand.go +++ b/controllers/storageoscluster/node_operand.go @@ -202,6 +202,11 @@ func getNodeBuilder(fs filesys.FileSystem, obj client.Object, kcl kubectl.Kubect stransform.SetConfigMapData("LOG_LEVEL", cluster.GetLogLevel()), } + // Set extra environment variables for node. + for k, v := range cluster.Spec.Environment { + configmapTransforms = append(configmapTransforms, stransform.SetConfigMapData(k, v)) + } + // If etcd TLS related values are set, mount the secret volume and set the // etcd related configurations. if cluster.Spec.TLSEtcdSecretRefName != "" { diff --git a/tests/e2e/deployment-test/03-deploy-storageos.yaml b/tests/e2e/deployment-test/03-deploy-storageos.yaml index 2538de0e..0f6c6b86 100644 --- a/tests/e2e/deployment-test/03-deploy-storageos.yaml +++ b/tests/e2e/deployment-test/03-deploy-storageos.yaml @@ -23,3 +23,5 @@ spec: storageClassName: "storageos" kvBackend: address: "etcd-client.default.svc.cluster.local:2379" + environment: + ENV_TO_TEST: must exists in storageos-node configmap diff --git a/tests/e2e/deployment-test/04-assert.yaml b/tests/e2e/deployment-test/04-assert.yaml index 2396164d..db0b3708 100644 --- a/tests/e2e/deployment-test/04-assert.yaml +++ b/tests/e2e/deployment-test/04-assert.yaml @@ -11,3 +11,4 @@ data: DISABLE_TELEMETRY: "false" DISABLE_CRASH_REPORTING: "false" DISABLE_VERSION_CHECK: "false" + ENV_TO_TEST: must exists in storageos-node configmap