Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Extra environment variables of node (#16)
Browse files Browse the repository at this point in the history
* Extra environment variables of node

* Review items

* E2e test for extra environment
  • Loading branch information
mhmxs authored Sep 27, 2021
1 parent 9511bfb commit 19b46bb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apis/v1/storageoscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions apis/v1/zz_generated.deepcopy.go

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

6 changes: 6 additions & 0 deletions config/crd/bases/storageos.com_storageosclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/manager/related_images_config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions controllers/storageoscluster/node_operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/deployment-test/03-deploy-storageos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions tests/e2e/deployment-test/04-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 19b46bb

Please sign in to comment.