mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common): Release version 2.0.0-beta.1 (#173)
This commit is contained in:
parent
19767d668c
commit
7b6ee00be6
189 changed files with 3110 additions and 3023 deletions
|
@ -0,0 +1,30 @@
|
|||
{{/*
|
||||
Return the primary service object for a controller
|
||||
*/}}
|
||||
{{- define "bjw-s.common.lib.service.primaryForController" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $controllerIdentifier := .controllerIdentifier -}}
|
||||
|
||||
{{- $identifier := "" -}}
|
||||
{{- $result := dict -}}
|
||||
|
||||
{{- /* Loop over all enabled services */ -}}
|
||||
{{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- if $enabledServices -}}
|
||||
{{- range $name, $service := $enabledServices -}}
|
||||
{{- /* Determine the Service that has been marked as primary */ -}}
|
||||
{{- if and (hasKey $service "primary") $service.primary -}}
|
||||
{{- $identifier = $name -}}
|
||||
{{- $result = $service -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Return the first Service if none has been explicitly marked as primary */ -}}
|
||||
{{- if not $result -}}
|
||||
{{- $identifier = keys $enabledServices | first -}}
|
||||
{{- $result = get $enabledServices $identifier -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "bjw-s.common.lib.service.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $result) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue