Skip to content
Open
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
14 changes: 9 additions & 5 deletions charts/portworx/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,15 @@ Generate a random token for storage provisioning


{{- define "px.getDeploymentNamespace" -}}
{{- if (.Release.Namespace) -}}
{{- if (eq "default" .Release.Namespace) -}}
{{- printf "portworx" -}}
{{- else -}}
{{- printf "%s" .Release.Namespace -}}
{{- if not .Values.namespaceOverride | empty -}}
{{- printf "%s" .Values.namespaceOverride -}}
{{- else -}}
{{- if (.Release.Namespace) -}}
{{- if (eq "default" .Release.Namespace) -}}
{{- printf "portworx" -}}
{{- else -}}
{{- printf "%s" .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/portworx/templates/portworx-k8s-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (eq .Release.Namespace "default") (not (lookup "v1" "Namespace" "portworx" "portworx")) }}
{{- if or (and (eq .Release.Namespace "default") (not (lookup "v1" "Namespace" "portworx" "portworx"))) (not .Values.namespaceOverride | empty)}}
apiVersion: v1
kind: Namespace
metadata:
Expand Down
4 changes: 3 additions & 1 deletion charts/portworx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
deployOperator: true # Deploy the Portworx operator
deployCluster: true # Deploy the Portworx cluster

namespaceOverride: ~ # Override the namespace the chart deploys to

imageVersion: 3.2.2 # Version of the PX Image.
pxOperatorImageVersion: 24.2.3 # Version of the PX operator image.

Expand Down Expand Up @@ -266,4 +268,4 @@ updateStrategy:
# where the size of the pod batch is specified through the spec.updateStrategy.rollingUpdate.maxUnavailable flag.

autoUpdateComponents: # Indicates the update strategy for the component images
# valid values None,Once,Always
# valid values None,Once,Always
7 changes: 7 additions & 0 deletions test/portworx/storagecluster_helm_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ func TestStorageClusterHelmTemplate(t *testing.T) {
ValuesFiles: []string{"./testValues/storagecluster_custom_registry.yaml"},
},
},
{
name: "TestOverrideNamespace",
resultFileName: "storagecluster_override_namespace.yaml",
helmOption: &helm.Options{
ValuesFiles: []string{"./testValues/storagecluster_override_namespace.yaml"},
},
},
{
name: "TestExternalETCD",
resultFileName: "storagecluster_external_etcd.yaml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespaceOverride: custom-namespace
30 changes: 30 additions & 0 deletions test/portworx/testspec/storagecluster_override_namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
kind: StorageCluster
apiVersion: core.libopenstorage.org/v1
metadata:
name: "mycluster"
namespace: custom-namespace
annotations:
labels:
heritage: "Helm"
release: "my-release"
app.kubernetes.io/managed-by: "Helm"
app.kubernetes.io/instance: "my-release"
spec:
image: portworx/oci-monitor:3.2.1.1
imagePullPolicy: Always

kvdb:
internal: true
storage:
useAll: true
secretsProvider: k8s

stork:
enabled: true
monitoring:
telemetry:
enabled: true
csi:
enabled: true
autopilot:
enabled: true