blob: 0016ab3044c85ab07e8d19e7ccedd14e43dc35aa [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---
Hyunsun Moondea0cb52021-02-19 16:53:22 -080037apiVersion: rbac.authorization.k8s.io/v1
Jeremy Ronquillo223db002020-06-05 10:28:22 -070038kind: 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---
Hyunsun Moondea0cb52021-02-19 16:53:22 -080053apiVersion: rbac.authorization.k8s.io/v1
Jeremy Ronquillo223db002020-06-05 10:28:22 -070054kind: Role
55metadata:
56 name: {{ $saName }}
57 namespace: {{ $saNamespace }}
58 labels:
59{{ tuple $saName $context | include "accelleran-cu.metadata_labels" | indent 4 }}
60{{- end -}}