blob: 5a22b26cff9868ac0bd2c1ba26f82793176db434 [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{- /*
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003# Copyright 2018 Intel Corporation
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07004# Copyright 2018-present Open Networking Foundation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07005#
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07006# SPDX-License-Identifier: Apache-2.0
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07007# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07008
Jeremy Ronquillo223db002020-06-05 10:28:22 -07009*/ -}}
10
11{{/*
12Renders a set of standardised labels
13*/}}
14{{- define "accelleran-cu.metadata_labels" -}}
15{{- $application := index . 0 -}}
16{{- $context := index . 1 -}}
17release: {{ $context.Release.Name }}
18app: {{ $application }}
19{{- end -}}
20
21{{/*
22Render 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---
29apiVersion: v1
30kind: ServiceAccount
31metadata:
32 name: {{ $saName }}
33 namespace: {{ $saNamespace }}
34 labels:
35{{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }}
36---
37apiVersion: rbac.authorization.k8s.io/v1beta1
38kind: RoleBinding
39metadata:
40 name: {{ $saName }}
41 namespace: {{ $saNamespace }}
42 labels:
43{{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }}
44roleRef:
45 apiGroup: rbac.authorization.k8s.io
46 kind: Role
47 name: {{ $saName }}
48subjects:
49 - kind: ServiceAccount
50 name: {{ $saName }}
51 namespace: {{ $saNamespace }}
52---
53apiVersion: rbac.authorization.k8s.io/v1beta1
54kind: Role
55metadata:
56 name: {{ $saName }}
57 namespace: {{ $saNamespace }}
58 labels:
59{{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }}
60{{- end -}}