-
Notifications
You must be signed in to change notification settings - Fork 144
kubernetes-ingress: add extraObjects templating #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| extraObjects: | ||
| - apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: "{{ .Release.Name }}-extra-conf" | ||
| data: | ||
| extra.conf: | | ||
| example config |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -260,4 +260,25 @@ Create a name for the auxiliary configmap. | |
| {{- printf "%s-%s" (include "kubernetes-ingress.fullname" . | trunc 54 | trimSuffix "-") "auxiliary" }} | ||
| {{- end -}} | ||
|
|
||
| {{/* | ||
| Create extra raw objects labels | ||
| */}} | ||
| {{- define "kubernetes-ingress.extraRawLabels" -}} | ||
| metadata: | ||
| labels: | ||
| {{- include "kubernetes-ingress.labels" $ | nindent 4 }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Render extra raw objects that might contain templates | ||
| */}} | ||
| {{- define "kubernetes-ingress.renderExtraObjects" -}} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $value is always coerced to a string
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe something like ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I decided to complicate the original design that served as an inspiration https://github.com/CloudPirates-io/helm-charts/blob/aff6783b21ce92155849464eb612551d2e8788d5/charts/common/templates/_helpers.tpl#L231-L241 and botched it a bit, but your suggestion seems to be working, so accepted, thanks! |
||
| {{- $labels := fromYaml (include "kubernetes-ingress.extraRawLabels" .context) -}} | ||
| {{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} | ||
| {{- if contains "{{" (toString $value) }} | ||
| {{- $value = tpl $value .context }} | ||
| {{- end }} | ||
| {{- toYaml (merge (fromYaml $value) $labels) }} | ||
| {{- end -}} | ||
|
|
||
| {{/* vim: set filetype=mustache: */}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| {{- range .Values.extraObjects }} | ||
| --- | ||
| {{ include "kubernetes-ingress.renderExtraObjects" (dict "value" . "context" $) }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
table is missing its header row
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, my bad, added missing table header