mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 16:37: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
|
@ -3,83 +3,80 @@ This template serves as a blueprint for all Service objects that are created
|
|||
within the common library.
|
||||
*/}}
|
||||
{{- define "bjw-s.common.class.service" -}}
|
||||
{{- $values := .Values.service -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.service -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $serviceObject := .object -}}
|
||||
|
||||
{{- $serviceName := include "bjw-s.common.lib.chart.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $svcType := $values.type | default "" -}}
|
||||
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "serviceName" $serviceName "values" $values) | fromYaml }}
|
||||
{{- $primaryPort := get $values.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $values)) }}
|
||||
{{- $svcType := $serviceObject.type | default "" -}}
|
||||
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "rootContext" $rootContext "serviceObject" $serviceObject) | fromYaml }}
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/service" $serviceObject.name)
|
||||
($serviceObject.labels | default dict)
|
||||
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
|
||||
-}}
|
||||
{{- $annotations := merge
|
||||
($serviceObject.annotations | default dict)
|
||||
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
|
||||
-}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $serviceName }}
|
||||
labels:
|
||||
app.kubernetes.io/service: {{ $serviceName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if eq ( $primaryPort.protocol | default "" ) "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
name: {{ $serviceObject.name }}
|
||||
{{- with $labels }}
|
||||
labels: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- with $annotations }}
|
||||
annotations: {{- toYaml . | nindent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }}
|
||||
type: ClusterIP
|
||||
{{- if $values.clusterIP }}
|
||||
clusterIP: {{ $values.clusterIP }}
|
||||
{{- if $serviceObject.clusterIP }}
|
||||
clusterIP: {{ $serviceObject.clusterIP }}
|
||||
{{end}}
|
||||
{{- else if eq $svcType "LoadBalancer" }}
|
||||
type: {{ $svcType }}
|
||||
{{- if $values.loadBalancerIP }}
|
||||
loadBalancerIP: {{ $values.loadBalancerIP }}
|
||||
{{- if $serviceObject.loadBalancerIP }}
|
||||
loadBalancerIP: {{ $serviceObject.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if $values.loadBalancerSourceRanges }}
|
||||
{{- if $serviceObject.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml $values.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{ toYaml $serviceObject.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
type: {{ $svcType }}
|
||||
{{- end }}
|
||||
{{- if $values.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $values.externalTrafficPolicy }}
|
||||
{{- if $serviceObject.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $serviceObject.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if $values.sessionAffinity }}
|
||||
sessionAffinity: {{ $values.sessionAffinity }}
|
||||
{{- if $values.sessionAffinityConfig }}
|
||||
{{- if hasKey $serviceObject "allocateLoadBalancerNodePorts" }}
|
||||
allocateLoadBalancerNodePorts: {{ $serviceObject.allocateLoadBalancerNodePorts }}
|
||||
{{- end }}
|
||||
{{- if $serviceObject.sessionAffinity }}
|
||||
sessionAffinity: {{ $serviceObject.sessionAffinity }}
|
||||
{{- if $serviceObject.sessionAffinityConfig }}
|
||||
sessionAffinityConfig:
|
||||
{{ toYaml $values.sessionAffinityConfig | nindent 4 }}
|
||||
{{ toYaml $serviceObject.sessionAffinityConfig | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- with $values.externalIPs }}
|
||||
{{- with $serviceObject.externalIPs }}
|
||||
externalIPs:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $values.publishNotReadyAddresses }}
|
||||
publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }}
|
||||
{{- if $serviceObject.publishNotReadyAddresses }}
|
||||
publishNotReadyAddresses: {{ $serviceObject.publishNotReadyAddresses }}
|
||||
{{- end }}
|
||||
{{- if $values.ipFamilyPolicy }}
|
||||
ipFamilyPolicy: {{ $values.ipFamilyPolicy }}
|
||||
{{- if $serviceObject.ipFamilyPolicy }}
|
||||
ipFamilyPolicy: {{ $serviceObject.ipFamilyPolicy }}
|
||||
{{- end }}
|
||||
{{- with $values.ipFamilies }}
|
||||
{{- with $serviceObject.ipFamilies }}
|
||||
ipFamilies:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- range $name, $port := $enabledPorts }}
|
||||
- port: {{ $port.port }}
|
||||
targetPort: {{ $port.targetPort | default $name }}
|
||||
targetPort: {{ $port.targetPort | default $port.port }}
|
||||
{{- if $port.protocol }}
|
||||
{{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }}
|
||||
protocol: TCP
|
||||
|
@ -94,7 +91,11 @@ spec:
|
|||
nodePort: {{ $port.nodePort }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- with (merge ($values.extraSelectorLabels | default dict) (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }}
|
||||
{{- with (merge
|
||||
($serviceObject.extraSelectorLabels | default dict)
|
||||
(dict "app.kubernetes.io/component" $serviceObject.controller)
|
||||
(include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | fromYaml)
|
||||
) }}
|
||||
selector: {{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue