Skip to content

Commit

Permalink
Merge branch 'master' into PTX-19346
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaypopov committed Aug 3, 2023
2 parents 91dbdd0 + 7c09e47 commit 4ce7d7b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/integration_test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func setup() error {
"portworx-env-vars",
"",
"List of comma separated environment variables that will be added to StorageCluster spec")
flag.StringVar(&ci_utils.PxCustomAnnotations,
"portworx-custom-annotations",
"",
"List of comma separated custom annotations that will be added to StorageCluster spec")
flag.StringVar(&ci_utils.PxDeviceSpecs,
"portworx-device-specs",
"",
Expand Down
1 change: 1 addition & 0 deletions test/integration_test/operator-test-pod-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
- -portworx-device-specs=PORTWORX_DEVICE_SPECS
- -portworx-kvdb-spec=PORTWORX_KVDB_SPEC
- -portworx-env-vars=PORTWORX_ENV_VARS
- -portworx-custom-annotations=PORTWORX_CUSTOM_ANNOTATIONS
- -is-ocp=IS_OCP
- -is-eks=IS_EKS
- -is-aks=IS_AKS
Expand Down
15 changes: 15 additions & 0 deletions test/integration_test/test-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ is_oke=false
portworx_device_specs=""
portworx_kvdb_spec=""
portworx_env_vars=""
portworx_custom_annotations=""
log_level="debug"
for i in "$@"
do
Expand Down Expand Up @@ -148,6 +149,12 @@ case $i in
shift
shift
;;
--portworx-custom-annotations)
echo "Flag for Portworx Custom Annotations: $2"
portworx_custom_annotations=$2
shift
shift
;;
--short-test)
echo "Skip tests that are long/not supported: $2"
short_test=$2
Expand Down Expand Up @@ -211,6 +218,14 @@ else
sed -i '/PORTWORX_ENV_VARS/d' $test_pod_spec
fi

# Portworx custom annotations
if [ "$portworx_custom_annotations" != "" ]; then
echo "Portworx Custom Annotations: $portworx_custom_annotations"
sed -i 's|'PORTWORX_CUSTOM_ANNOTATIONS'|'"$portworx_custom_annotations"'|g' $test_pod_spec
else
sed -i '/PORTWORX_CUSTOM_ANNOTATIONS/d' $test_pod_spec
fi

# Set OCP
if [ "$is_ocp" != "" ]; then
echo "This is OCP cluster: $is_ocp"
Expand Down
3 changes: 3 additions & 0 deletions test/integration_test/utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ var (
// PxEnvVars is a string of comma separated ENV vars
PxEnvVars string

// PxCustomAnnotations is a string of comma separated annotations
PxCustomAnnotations string

// CloudProvider is a cloud provider name
CloudProvider string

Expand Down
12 changes: 12 additions & 0 deletions test/integration_test/utils/storagecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ func ConstructStorageCluster(cluster *corev1.StorageCluster, specGenURL string,
cluster.Annotations["portworx.io/is-oke"] = "true"
}

// Add custom annotations
if len(PxCustomAnnotations) != 0 {
if cluster.Annotations == nil {
cluster.Annotations = make(map[string]string)
}
annotations := strings.Split(PxCustomAnnotations, ",")
for _, annotation := range annotations {
keyvalue := strings.Split(annotation, ":")
cluster.Annotations[keyvalue[0]] = strings.TrimSpace(keyvalue[1])
}
}

// Populate cloud storage
if len(PxDeviceSpecs) != 0 {
pxDeviceSpecs := strings.Split(PxDeviceSpecs, ";")
Expand Down

0 comments on commit 4ce7d7b

Please sign in to comment.