Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | {{- /* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame^] | 2 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | # Copyright 2020-present Open Networking Foundation |
| 4 | # |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame^] | 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only |
| 7 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 8 | */ -}} |
| 9 | |
| 10 | {{/* |
| 11 | Renders a set of standardised labels. |
| 12 | */}} |
| 13 | {{- define "omec-user-plane.metadata_labels" -}} |
| 14 | {{- $application := index . 0 -}} |
| 15 | {{- $context := index . 1 -}} |
| 16 | release: {{ $context.Release.Name }} |
| 17 | app: {{ $application }} |
| 18 | {{- end -}} |
| 19 | |
| 20 | {{/* |
| 21 | Render the given template. |
| 22 | */}} |
| 23 | {{- define "omec-user-plane.template" -}} |
| 24 | {{- $name := index . 0 -}} |
| 25 | {{- $context := index . 1 -}} |
| 26 | {{- $last := base $context.Template.Name }} |
| 27 | {{- $wtf := $context.Template.Name | replace $last $name -}} |
| 28 | {{ include $wtf $context }} |
| 29 | {{- end -}} |
| 30 | |
| 31 | {{/* |
| 32 | Render init container for coredump. |
| 33 | */}} |
| 34 | {{- define "omec-user-plane.coredump_init" -}} |
| 35 | {{- $pod := index . 0 -}} |
| 36 | {{- $context := index . 1 -}} |
| 37 | - name: {{ $pod }}-coredump-init |
| 38 | image: {{ $context.Values.images.tags.init | quote }} |
| 39 | imagePullPolicy: {{ $context.Values.images.pullPolicy }} |
| 40 | securityContext: |
| 41 | privileged: true |
| 42 | runAsUser: 0 |
| 43 | command: ["bash", "-xc"] |
| 44 | args: |
| 45 | - echo '/tmp/coredump/core.%h.%e.%t' > /mnt/host-rootfs/proc/sys/kernel/core_pattern |
| 46 | volumeMounts: |
| 47 | - name: host-rootfs |
| 48 | mountPath: /mnt/host-rootfs |
| 49 | {{- end -}} |