|
| 1 | +{{- /* deployment specific wrapping for normalize.versions */}} |
| 2 | +{{- define "normalize.versions.ksvc" }} |
| 3 | +{{- $versions := include "normalize.versions" . | mustFromJson }} |
| 4 | + {{- $normalizedVersions := list }} |
| 5 | + {{- range $i, $v := $versions -}} |
| 6 | + {{- $version := merge $v }} |
| 7 | + |
| 8 | + {{- $version = set $version "port" (pluck "port" (dict "port" 80) $.Values.application $v | last) }} |
| 9 | + {{- if (and $v.ksvcSpecification $v.ksvcSpecification.ports) }} |
| 10 | + {{- $version = set $version "port" (pluck "port" $v (index $v.ksvcSpecification.ports 0) | last) }} |
| 11 | + {{- end }} |
| 12 | + |
| 13 | + {{- $normalizedVersions = append $normalizedVersions $version }} |
| 14 | + {{- end }} {{- /* range $i, $v := $versions */}} |
| 15 | + {{- mustToJson $normalizedVersions }} |
| 16 | +{{- end }} {{- /* define "normalize.versions.ksvc" */}} |
| 17 | + |
| 18 | +{{- /* Identify the name of a Knative Service object */ -}} |
| 19 | +{{- define "ksvc.name" -}} |
| 20 | +{{- if (and .ksvcSpecification .ksvcSpecification.metadata .ksvcSpecification.metadata.name) -}} |
| 21 | +{{ .ksvcSpecification.metadata.name }} |
| 22 | +{{- else -}} |
| 23 | +{{ .VERSION_NAME }} |
| 24 | +{{- end -}} |
| 25 | +{{- end }} {{- /* define "ksvc.name" */ -}} |
| 26 | + |
| 27 | +{{- /* Identify the namespace of a Knative Service object */ -}} |
| 28 | +{{- define "ksvc.namespace" -}} |
| 29 | +{{- if (and .ksvcSpecification .ksvcSpecification.metadata .ksvcSpecification.metadata.namespace) -}} |
| 30 | +{{ .ksvcSpecification.metadata.namespace }} |
| 31 | +{{- else -}} |
| 32 | +{{ .VERSION_NAMESPACE }} |
| 33 | +{{- end -}} |
| 34 | +{{- end }} {{- /* define "ksvc.namespace" */ -}} |
0 commit comments