|
| 1 | +{{/* |
| 2 | +Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "team.name" -}} |
| 5 | +{{- default .Chart.Name .Values.name | trunc 63 | trimSuffix "-" }} |
| 6 | +{{- end }} |
| 7 | + |
| 8 | +{{/* |
| 9 | +Create a default fully qualified app name. |
| 10 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 11 | +If release name contains chart name it will be used as a full name. |
| 12 | +*/}} |
| 13 | +{{- define "team.fullname" -}} |
| 14 | +{{- if .Values.name }} |
| 15 | +{{- .Values.name | trunc 63 | trimSuffix "-" }} |
| 16 | +{{- else }} |
| 17 | +{{- $name := default .Chart.Name .Values.nameOverride }} |
| 18 | +{{- if contains $name .Release.Name }} |
| 19 | +{{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 20 | +{{- else }} |
| 21 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 22 | +{{- end }} |
| 23 | +{{- end }} |
| 24 | +{{- end }} |
| 25 | + |
| 26 | +{{/* |
| 27 | +Create chart name and version as used by the chart label. |
| 28 | +*/}} |
| 29 | +{{- define "team.chart" -}} |
| 30 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 31 | +{{- end }} |
| 32 | + |
| 33 | +{{/* |
| 34 | +Common Helm and Kubernetes labels |
| 35 | +*/}} |
| 36 | +{{- define "team.labels" -}} |
| 37 | +helm.sh/chart: {{ include "team.chart" . }} |
| 38 | +app.kubernetes.io/name: {{ include "team.name" . }} |
| 39 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 40 | +{{- if .Chart.AppVersion }} |
| 41 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 42 | +{{- end }} |
| 43 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 44 | +{{- if .Values.labels }} |
| 45 | +{{ toYaml .Values.labels }} |
| 46 | +{{- end }} |
| 47 | +{{- end }} |
| 48 | + |
| 49 | +{{/* |
| 50 | +Common Helm and Kubernetes labels |
| 51 | +*/}} |
| 52 | +{{- define "team.annotations" -}} |
| 53 | +helm.sh/chart: {{ include "team.chart" . }} |
| 54 | +{{- if .Values.annotations }} |
| 55 | +{{ toYaml .Values.annotations }} |
| 56 | +{{- end }} |
| 57 | +{{- end }} |
| 58 | + |
| 59 | + |
| 60 | +{{/* |
| 61 | +Create the name of the NetworkPolicy to deny all outgoing traffic |
| 62 | +*/}} |
| 63 | +{{- define "team.networkPolicy.egress.deny.all.name" }} |
| 64 | +{{- printf "%s-%s" ((include "team.fullname" .) | trunc 47 | trimSuffix "-") "egress-deny-all" }} |
| 65 | +{{- end }} |
| 66 | + |
| 67 | +{{/* |
| 68 | +Create the name of the NetworkPolicy to allow outgoing traffic to the Kubernetes DNS |
| 69 | +*/}} |
| 70 | +{{- define "team.networkPolicy.egress.allow.dns.name" }} |
| 71 | +{{- printf "%s-%s" ((include "team.fullname" .) | trunc 47 | trimSuffix "-") "egress-allow-dns" }} |
| 72 | +{{- end }} |
| 73 | + |
| 74 | +{{/* |
| 75 | +Create the name of the NetworkPolicy to deny all incoming traffic |
| 76 | +*/}} |
| 77 | +{{- define "team.networkPolicy.ingress.deny.all.name" }} |
| 78 | +{{- printf "%s-%s" ((include "team.fullname" .) | trunc 46 | trimSuffix "-") "ingress-deny-all" }} |
| 79 | +{{- end }} |
| 80 | + |
0 commit comments