mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-02-03 07:49:03 +00:00
[common] Add controller labels and annotations (#134)
This commit is contained in:
parent
9a88e697d2
commit
1799d4c057
@ -2,7 +2,7 @@ apiVersion: v2
|
||||
name: common
|
||||
description: Function library for k8s-at-home charts
|
||||
type: library
|
||||
version: 1.0.5
|
||||
version: 1.1.0
|
||||
keywords:
|
||||
- k8s-at-home
|
||||
- common
|
||||
|
@ -5,6 +5,13 @@ metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.controllerLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controllerAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
|
@ -17,8 +17,8 @@
|
||||
{{- if not $ingressValues.nameSuffix -}}
|
||||
{{- $_ := set $ingressValues "nameSuffix" $index -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set . "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- include "common.classes.ingress" . -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@ -1,15 +1,14 @@
|
||||
{{- define "common.pvc" -}}
|
||||
{{- /* Generate pvc as required */ -}}
|
||||
{{- $context := . -}}
|
||||
{{- range $index, $PVC := .Values.persistence }}
|
||||
{{- if and $PVC.enabled (not (or $PVC.emptyDir $PVC.existingClaim)) -}}
|
||||
{{- $persistenceValues := $PVC -}}
|
||||
{{- if not $persistenceValues.nameSuffix -}}
|
||||
{{- $_ := set $persistenceValues "nameSuffix" $index -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $context "ObjectValues" (dict "persistence" $persistenceValues) -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "persistence" $persistenceValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.pvc" $context -}}
|
||||
{{- include "common.classes.pvc" $ -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@ -1,5 +1,19 @@
|
||||
{{- define "common.service" -}}
|
||||
{{- if .Values.service.enabled -}}
|
||||
{{- /* Generate primary service */ -}}
|
||||
{{- include "common.classes.service" . }}
|
||||
|
||||
{{- /* Generate additional services as required */ -}}
|
||||
{{- range $index, $extraService := .Values.service.additionalServices }}
|
||||
{{- if $extraService.enabled -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- $serviceValues := $extraService -}}
|
||||
{{- if not $serviceValues.nameSuffix -}}
|
||||
{{- $_ := set $serviceValues "nameSuffix" $index -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
{{- include "common.classes.service" $ -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@ -5,6 +5,13 @@ metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.controllerLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controllerAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
|
@ -2,12 +2,12 @@
|
||||
The OpenVPN shared volume to be inserted
|
||||
*/}}
|
||||
{{- define "common.addon.vpn.volume" -}}
|
||||
{{- if or .Values.addons.vpn.vpnConf .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}}
|
||||
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}}
|
||||
name: vpnconfig
|
||||
configMap:
|
||||
name: {{ template "common.names.fullname" . }}-vpn
|
||||
items:
|
||||
{{- if .Values.addons.vpn.vpnConf }}
|
||||
{{- if .Values.addons.vpn.configFile }}
|
||||
- key: vpnConfigfile
|
||||
path: vpnConfigfile
|
||||
{{- end }}
|
||||
|
@ -5,11 +5,15 @@
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $serviceName := include "common.names.fullname" . -}}
|
||||
{{- if hasKey $values "nameSuffix" -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameSuffix -}}
|
||||
{{ end -}}
|
||||
{{- $svcType := $values.type -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
name: {{ $serviceName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- if $values.labels }}
|
||||
|
@ -1,5 +1,12 @@
|
||||
# type: options are statefulset or deployment
|
||||
controllerType: deployment
|
||||
# Set annotations on the deployment/statefulset
|
||||
controllerAnnotations: {}
|
||||
# Set labels on the deployment/statefulset
|
||||
controllerLabels: {}
|
||||
|
||||
# Set annotations on the pod
|
||||
podAnnotations: {}
|
||||
|
||||
env: {}
|
||||
|
||||
@ -47,6 +54,21 @@ service:
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
additionalServices: []
|
||||
# - enabled: false
|
||||
# nameSuffix: api
|
||||
# type: ClusterIP
|
||||
# # Specify the default port information
|
||||
# port:
|
||||
# port: ""
|
||||
# name: http
|
||||
# protocol: TCP
|
||||
# targetPort: http
|
||||
# # nodePort:
|
||||
# additionalPorts: []
|
||||
# annotations: {}
|
||||
# labels: {}
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
|
Loading…
Reference in New Issue
Block a user