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 2018 Intel Corporation |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 4 | # Copyright 2018-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | # |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 6 | # SPDX-License-Identifier: Apache-2.0 |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 7 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 8 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 9 | */ -}} |
| 10 | |
| 11 | {{/* |
| 12 | Renders a set of standardised labels |
| 13 | */}} |
| 14 | {{- define "accelleran-cu.metadata_labels" -}} |
| 15 | {{- $application := index . 0 -}} |
| 16 | {{- $context := index . 1 -}} |
| 17 | release: {{ $context.Release.Name }} |
| 18 | app: {{ $application }} |
| 19 | {{- end -}} |
| 20 | |
| 21 | {{/* |
| 22 | Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint. |
| 23 | */}} |
| 24 | {{- define "accelleran-cu.service_account" -}} |
| 25 | {{- $context := index . 1 -}} |
| 26 | {{- $saName := index . 0 -}} |
| 27 | {{- $saNamespace := $context.Release.Namespace }} |
| 28 | --- |
| 29 | apiVersion: v1 |
| 30 | kind: ServiceAccount |
| 31 | metadata: |
| 32 | name: {{ $saName }} |
| 33 | namespace: {{ $saNamespace }} |
| 34 | labels: |
| 35 | {{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }} |
| 36 | --- |
Hyunsun Moon | dea0cb5 | 2021-02-19 16:53:22 -0800 | [diff] [blame] | 37 | apiVersion: rbac.authorization.k8s.io/v1 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 38 | kind: RoleBinding |
| 39 | metadata: |
| 40 | name: {{ $saName }} |
| 41 | namespace: {{ $saNamespace }} |
| 42 | labels: |
| 43 | {{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }} |
| 44 | roleRef: |
| 45 | apiGroup: rbac.authorization.k8s.io |
| 46 | kind: Role |
| 47 | name: {{ $saName }} |
| 48 | subjects: |
| 49 | - kind: ServiceAccount |
| 50 | name: {{ $saName }} |
| 51 | namespace: {{ $saNamespace }} |
| 52 | --- |
Hyunsun Moon | dea0cb5 | 2021-02-19 16:53:22 -0800 | [diff] [blame] | 53 | apiVersion: rbac.authorization.k8s.io/v1 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 54 | kind: Role |
| 55 | metadata: |
| 56 | name: {{ $saName }} |
| 57 | namespace: {{ $saNamespace }} |
| 58 | labels: |
| 59 | {{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }} |
| 60 | {{- end -}} |