Skip to content

Commit

Permalink
Use lookup function to remove .createNamespace
Browse files Browse the repository at this point in the history
Hopefully simplify the UX
  • Loading branch information
DavidMarchant committed Mar 23, 2022
1 parent 27f4860 commit 2f05f44
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion charts/ondat-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ Parameter | Description | Default
`cluster.name` | Name of the storageos deployment | `storageos`
`cluster.namespace` | Namespace to install the StorageOS cluster into |
`storageos`
`cluster.createNamespace` | If true, create the namespace used by the cluster | `true`
`cluster.secretRefName` | Name of the secret containing StorageOS API credentials | `storageos-api`
`cluster.admin.username` | Username to authenticate to the StorageOS API with | `storageos`
`cluster.admin.password` | Password to authenticate to the StorageOS API with |
Expand Down
6 changes: 0 additions & 6 deletions charts/ondat-operator/questions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ questions:
description: "Namespace of the StorageOS cluster deployment"
type: string
label: Cluster Namespace
- variable: cluster.createNamespace
default: true
description: "If true, create the namespace for the cluster deployment"
type: boolean
label: Create Cluster Namespace


# Node container image.
- variable: cluster.images.node.repository
Expand Down
10 changes: 6 additions & 4 deletions charts/ondat-operator/templates/namespaces.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{{- if .Values.cluster.createNamespace }}
# We want to create the storageoscluster namespace if and only if it isn't the
# same namespace as used for the release AND it doesn't already exist in the
# cluster.
# The 'lookup' function takes the state of the cluster before the start of the
# helm install.
{{- if not (lookup "v1" "Namespace" "" .Values.cluster.namespace) }}

# Don't want to attempt to create the ns if user has specificied the same ns
# for both the release and the StorageOS cluster.
# As otherwise it would fail & this could be confusing UX for them.
{{- if not (eq .Release.Namespace .Values.cluster.namespace) }}

apiVersion: v1
Expand Down
2 changes: 0 additions & 2 deletions charts/ondat-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ cluster:
# This is opposed to the namespace of the operator, which is refered to
# with .Release.Namespace
namespace: storageos
# Set to false if you'd like to use a pre-existing namespace
createNamespace: true

# Name of the secret containing StorageOS API credentials.
secretRefName: storageos-api
Expand Down

0 comments on commit 2f05f44

Please sign in to comment.