clastix/kamaji

Improve logic for default datastore

Closed this issue · 2 comments

The introduction of dependancy for kamaji-etcd chart has the condition:

version: 2.0.0
dependencies:
- name: kamaji-etcd
  repository: https://clastix.github.io/charts
  version: 0.7.0
  condition: kamaji-etcd.deploy

However, the values.yaml file still report:

etcd:
  # -- (bool) Enable the creation of a local etcd instance as a default Datastore using the kamaji-etcd chart by CLASTIX. (default=true)
  deploy: true

# -- (string) If the creation of an etcd instance is disabled, specify the default DataStore name for the Kamaji instance.
datastoreName: kamaji-etcd

and controller.yaml template uses as:

      containers:
      - args:
        - manager
        - --health-probe-bind-address={{ .Values.healthProbeBindAddress }}
        - --leader-elect
        - --metrics-bind-address={{ .Values.metricsBindAddress }}
        - --tmp-directory={{ .Values.temporaryDirectoryPath }}
        {{- if .Values.etcd.deploy }}
        - --datastore={{ (index .Values "kamaji-etcd" "datastore").name }}
        {{- else }}
        - --datastore={{ required ".Values.etcd.datastoreName is required when etcd sub-chart is enabled!" .Values.etcd.datastoreName }}
        {{- end }}

Let's to refactor and simplify as:

In Chart.yaml:

dependencies:
- name: kamaji-etcd
  repository: https://clastix.github.io/charts
  version: "> 0.7"
  condition: kamaji-etcd.deploy

In values.yaml as:

# remove this
# etcd:
#   # -- (bool) Enable the creation of a local etcd instance as a default Datastore using the kamaji-etcd chart by CLASTIX. (default=true)
#   deploy: true

# -- (string) Specify the default DataStore name for the Kamaji instance.
defaultDatastoreName: default

kamaji-etcd:
  deploy: true             # <<<<<<<<<< currently missing >>>>>>>>>>
  fullnameOverride: kamaji-etcd
  datastore:
    enabled: true
    name: default

In controller.yaml as:

      containers:
      - args:
        - manager
        - --health-probe-bind-address={{ .Values.healthProbeBindAddress }}
        - --leader-elect
        - --metrics-bind-address={{ .Values.metricsBindAddress }}
        - --tmp-directory={{ .Values.temporaryDirectoryPath }}
        {{- $datastoreName := .Values.defaultDatastoreName | required ".Values.defaultDatastoreName is required!" }}
        - --datastore={{ $datastoreName }}
        {{- if .Values.telemetry.disabled }}
        - --disable-telemetry
        {{- end }}

We already provide a way to set the default Data store, as well as defining the name of it.

let's to simplify it as well as corret a missing value