Skip to content

Commit

Permalink
chore: move values from codezero object to root (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
viters committed Aug 4, 2023
1 parent 43e3a51 commit 02d74eb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.
39 changes: 14 additions & 25 deletions charts/codezero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
Expand the name of the chart.
*/}}
{{- define "codezero.name" -}}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if hasSuffix .Values.codezero.name $name }}
{{- $name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" $name .Values.codezero.name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- .Values.nameOverride | default .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Expand All @@ -16,22 +11,16 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
If release name contains chart name it will be used as a full name.
*/}}
{{- define "codezero.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if .Values.fullnameOverride }}
{{- $name = .Values.fullnameOverride }}
{{- else }}
{{- if contains $name .Release.Name }}
{{- $name = .Release.Name }}
{{- else }}
{{- $name = printf "%s-%s" .Release.Name $name }}
{{- end }}
{{- end }}
{{- if hasSuffix .Values.codezero.name $name }}
{{- $name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" $name .Values.codezero.name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- if contains .Values.nameOverride .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
Expand All @@ -50,7 +39,7 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: codezero
{{- with .Values.codezero.labels }}
{{- with .Values.labels }}
{{ . | toYaml }}
{{- end }}
{{- end }}
Expand All @@ -60,7 +49,7 @@ Pod labels
*/}}
{{- define "codezero.podLabels" -}}
{{ include "codezero.labels" . }}
{{- with .Values.codezero.podLabels }}
{{- with .Values.podLabels }}
{{ . | toYaml }}
{{- end }}
{{- end }}
Expand All @@ -69,7 +58,7 @@ Pod labels
Pod annotations
*/}}
{{- define "codezero.podAnnotations" -}}
{{- with .Values.codezero.podAnnotations }}
{{- with .Values.podAnnotations }}
{{ . | toYaml }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/codezero/templates/orchestrator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: {{ include "orchestrator.name" . }}
securityContext:
{{- toYaml .Values.orchestrator.securityContext | nindent 12 }}
image: "c6oio/orchestrator:{{ .Values.orchestrator.image.tag | default .Chart.AppVersion }}"
image: "c6oio/orchestrator:{{ .Values.orchestrator.image.tag | default .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.orchestrator.image.pullPolicy }}
env:
- name: CZ_SPACE_ID
Expand All @@ -38,9 +38,9 @@ spec:
value: /etc/ssl/certs/space/tls.pem
- name: CZ_CLUSTER_CERT_KEY
value: /etc/ssl/certs/space/tls.key
{{- if .Values.codezero.hub.url }}
{{- if .Values.hub.url }}
- name: CZ_HUB_URL
value: {{ printf "%s/" .Values.codezero.hub.url }}
value: {{ printf "%s/" .Values.hub.url }}
{{- end }}
- name: CZ_PORT
value: '8900'
Expand Down
8 changes: 4 additions & 4 deletions charts/codezero/templates/system/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: {{ include "system.name" . }}
securityContext:
{{- toYaml .Values.system.securityContext | nindent 12 }}
image: "c6oio/system:{{ .Values.system.image.tag | default .Chart.AppVersion }}"
image: "c6oio/system:{{ .Values.system.image.tag | default .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.system.image.pullPolicy }}
env:
- name: CZ_SPACE_CA_CERT
Expand All @@ -32,9 +32,9 @@ spec:
value: /etc/ssl/certs/space/tls.pem
- name: CZ_CLUSTER_CERT_KEY
value: /etc/ssl/certs/space/tls.key
{{- if .Values.codezero.hub.url }}
{{- if .Values.hub.url }}
- name: CZ_HUB_URL
value: {{ .Values.codezero.hub.url }}
value: {{ .Values.hub.url }}
{{- end }}
- name: CZ_SPACE_ID
valueFrom:
Expand All @@ -47,7 +47,7 @@ spec:
- name: CZ_PORT
value: "8800"
- name: CZ_ROUTER_IMAGE
value: "c6oio/router:{{ .Values.system.image.tag | default .Chart.AppVersion }}"
value: "c6oio/router:{{ .Values.system.image.tag | default .Values.image.tag | default .Chart.AppVersion }}"
envFrom:
- secretRef:
name: {{ include "system.fullname" . }}
Expand Down
4 changes: 2 additions & 2 deletions charts/codezero/templates/system/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.codezero.space.token "" }}
{{- if eq .Values.space.token "" }}
{{- fail "A Values.token is required" }}
{{- end }}

Expand All @@ -7,4 +7,4 @@ kind: Secret
metadata:
name: {{ include "system.fullname" . }}
data:
CZ_HUB_SPACE_TOKEN: {{ .Values.codezero.space.token | b64enc }}
CZ_HUB_SPACE_TOKEN: {{ .Values.space.token | b64enc }}
22 changes: 11 additions & 11 deletions charts/codezero/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
nameOverride: ""
fullnameOverride: ""

codezero:
name: codezero
hub:
url: https://api.codezero.io
space:
token: ""
image:
tag: pasley
hub:
url: https://api.codezero.io
space:
token: ""

podAnnotations: { }
labels: { }
podLabels: { }
podAnnotations: { }
labels: { }
podLabels: { }

system:
name: system
image:
tag: pasley
tag: ""
pullPolicy: Always
replicaCount: 1

Expand All @@ -43,7 +43,7 @@ system:
orchestrator:
name: orchestrator
image:
tag: pasley
tag: ""
pullPolicy: Always
replicaCount: 1

Expand Down

0 comments on commit 02d74eb

Please sign in to comment.