Yi Tseng | 3256142 | 2021-10-07 15:03:21 -0700 | [diff] [blame] | 1 | {{- /* |
| 2 | |
| 3 | # Copyright 2020-present Open Networking Foundation |
| 4 | # |
Charles Chan | d1b4bf9 | 2022-02-02 16:27:10 -0800 | [diff] [blame] | 5 | # SPDX-License-Identifier: Apache-2.0 |
Yi Tseng | 3256142 | 2021-10-07 15:03:21 -0700 | [diff] [blame] | 6 | |
| 7 | */ -}} |
| 8 | |
| 9 | {{/* |
| 10 | Renders a set of standardised labels. |
| 11 | */}} |
| 12 | {{- define "pfcp-agent.metadata_labels" -}} |
| 13 | {{- $application := index . 0 -}} |
| 14 | {{- $context := index . 1 -}} |
| 15 | release: {{ $context.Release.Name }} |
| 16 | app: {{ $application }} |
| 17 | {{- end -}} |
| 18 | |
| 19 | {{/* |
| 20 | Render the given template. |
| 21 | */}} |
| 22 | {{- define "pfcp-agent.template" -}} |
| 23 | {{- $name := index . 0 -}} |
| 24 | {{- $context := index . 1 -}} |
| 25 | {{- $last := base $context.Template.Name }} |
| 26 | {{- $wtf := $context.Template.Name | replace $last $name -}} |
| 27 | {{ include $wtf $context }} |
| 28 | {{- end -}} |
| 29 | |
| 30 | {{/* |
| 31 | Render init container for coredump. |
| 32 | */}} |
| 33 | {{- define "pfcp-agent.coredump_init" -}} |
| 34 | {{- $pod := index . 0 -}} |
| 35 | {{- $context := index . 1 -}} |
| 36 | - name: {{ $pod }}-coredump-init |
| 37 | image: {{ $context.Values.images.tags.init | quote }} |
| 38 | imagePullPolicy: {{ $context.Values.images.pullPolicy }} |
| 39 | securityContext: |
| 40 | privileged: true |
| 41 | runAsUser: 0 |
| 42 | command: ["sh", "-xc"] |
| 43 | args: |
| 44 | - echo '/tmp/coredump/core.%h.%e.%t' > /mnt/host-rootfs/proc/sys/kernel/core_pattern |
| 45 | volumeMounts: |
| 46 | - name: host-rootfs |
| 47 | mountPath: /mnt/host-rootfs |
| 48 | {{- end -}} |
| 49 | |
| 50 | {{/* |
| 51 | Create a default fully qualified app name. |
| 52 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 53 | If release name contains chart name it will be used as a full name. |
| 54 | */}} |
| 55 | {{- define "pfcp-agent.fullname" -}} |
| 56 | {{- if .Values.fullnameOverride }} |
| 57 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} |
| 58 | {{- else }} |
| 59 | {{- $name := default .Chart.Name .Values.nameOverride }} |
| 60 | {{- if contains $name .Release.Name }} |
| 61 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 62 | {{- else }} |
| 63 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 64 | {{- end }} |
| 65 | {{- end }} |
| 66 | {{- end }} |