Skip to content

Commit

Permalink
Change extensions array type to object
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg.skovpen committed Nov 27, 2023
1 parent 830ead0 commit b0f1be8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion charts/app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ description: Deployment for base pinup app
maintainers:
- email: d7561985@gmail.com
name: DevOps
version: 3.2.0
version: 3.3.0
apiVersion: v2
8 changes: 4 additions & 4 deletions charts/app/templates/configfiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ data:

{{- if .Values.extensions }}
---
{{- range .Values.extensions}}
{{- if .configfiles }}
{{- range $name, $spec := .Values.extensions}}
{{- if $spec.configfiles }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s-config" $appname .name }}
name: {{ printf "%s-%s-config" $appname $name }}
namespace: {{ $.Release.Namespace }}
labels:
app: {{ $appname }}
Expand All @@ -41,7 +41,7 @@ metadata:
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook-weight": "-5"
data:
{{- range $key, $value := .configfiles.data }}
{{- range $key, $value := $spec.configfiles.data }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
Expand Down
45 changes: 23 additions & 22 deletions charts/app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ spec:
configMap:
name: {{ printf "%s-config" $appname }}
{{- end }}
{{- range .Values.extensions }}
{{- if .configfiles }}
- name: {{ printf "%s-%s-config" $appname .name }}
{{- range $name, $spec := .Values.extensions }}
{{- if $spec.configfiles }}
{{- $name := printf "%s-%s-config" $appname $name }}
- name: {{ $name }}
configMap:
name: {{ printf "%s-%s-config" $appname .name }}
name: {{ $name }}
{{- end }}
{{- end }}
{{- if .Values.initContainers -}}
Expand Down Expand Up @@ -265,17 +266,17 @@ spec:
- {{ . }}
{{- end }}
{{- end }}
{{- range .Values.extensions }}
{{- $name := .nameOverride | default (printf "%s-%s" $appname .name) }}
{{- range $name, $spec := .Values.extensions }}
{{- $name := printf "%s-%s" $appname $name }}
- name: {{ $name }}
image: "{{ .image.repository | default "" }}{{- if and .image.repository .image.name -}}/{{- end -}}{{ .image.name | default "" }}:{{ .image.tag | default "" }}"
{{- if .command }}
image: "{{ $spec.image.repository | default "" }}{{- if and $spec.image.repository $spec.image.name -}}/{{- end -}}{{ $spec.image.name | default "" }}:{{ $spec.image.tag | default "" }}"
{{- if $spec.command }}
command:
{{- toYaml .command | nindent 10 }}
{{- toYaml $spec.command | nindent 10 }}
{{- end }}
{{- if .args }}
{{- if $spec.args }}
args:
{{- toYaml .args | nindent 10 }}
{{- toYaml $spec.args | nindent 10 }}
{{- end }}
env:
- name: BUILD_ID
Expand All @@ -285,17 +286,17 @@ spec:
- name: OTEL_SERVICE_NAME
value: {{ $name }}
- name: VERSION
value: {{ .image.tag | default $.Values.version | quote }}
{{- range $k, $v := .env }}
value: {{ $spec.image.tag | default $.Values.version | quote }}
{{- range $k, $v := $spec.env }}
- name: {{ $k | upper }}
value: {{ $v | quote }}
{{- end }}
{{- if .lifecycle }}
{{- if $spec.lifecycle }}
lifecycle:
{{- toYaml .lifecycle | nindent 10 }}
{{- toYaml $spec.lifecycle | nindent 10 }}
{{- end }}
{{- if .livenessProbe }}
{{- with .livenessProbe }}
{{- if $spec.livenessProbe }}
{{- with $spec.livenessProbe }}
livenessProbe:
failureThreshold: {{ .failureThreshold | default 3 }}
{{- if hasKey . "httpGet" }}
Expand Down Expand Up @@ -323,8 +324,8 @@ spec:
timeoutSeconds: {{ .timeoutSeconds | default 5 }}
{{- end }}
{{- end }}
{{- if .readinessProbe }}
{{- with .readinessProbe }}
{{- if $spec.readinessProbe }}
{{- with $spec.readinessProbe }}
readinessProbe:
failureThreshold: {{ .failureThreshold | default 3 }}
{{- if hasKey . "httpGet" }}
Expand All @@ -351,10 +352,10 @@ spec:
successThreshold: {{ .successThreshold | default 1 }}
timeoutSeconds: {{ .timeoutSeconds | default 5 }}
{{- end }}
{{- if .configfiles }}
{{- if $spec.configfiles }}
volumeMounts:
- name: {{ printf "%s-%s-config" $appname .name }}
mountPath: {{ .configfiles.mountPath }}
- name: {{ printf "%s-config" $name }}
mountPath: {{ $spec.configfiles.mountPath }}
readOnly: true
{{- end }}
{{- end }}
Expand Down
5 changes: 2 additions & 3 deletions charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ configfiles: {}
# config.yaml: |-
# foo: bar

extensions: []
# - name: "sidecar"
# nameOverride: ""
extensions: {}
# authz:
# image:
# repository: "example.org"
# name: "sidecar"
Expand Down

0 comments on commit b0f1be8

Please sign in to comment.