clearml-helm-charts/charts/clearml-agent/templates/agentk8sglue-rbac.yaml
Valeriano Manassero 5540188db1
Add job support for task pod (#162)
* Added: task as job support

* Added: template generator

* Fixed: typo

* Changed: bump version

* Added: changelog reference

* Fixed: include function name

* Fixed: checksum generator

* Added: nindent

* Added: changelog item

* Fixed: job env var switch

* Fixed: double Restart policy removed

* Fixed: job template apiVersion
2023-02-15 15:27:59 +01:00

89 lines
2.1 KiB
YAML

{{- if not .Values.agentk8sglue.serviceExistingAccountName }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "clearmlAgent.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- if .Values.enterpriseFeatures.serviceAccountClusterAccess }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "clearmlAgent.name" . }}-kpa
rules:
- apiGroups:
- ""
resources:
- pods
- secrets
- services
verbs: ["get", "list", "watch", "create", "patch", "delete"]
- apiGroups:
- ""
resources:
- namespaces
verbs: ["list"]
{{- if .Values.agentk8sglue.taskAsJob }}
- apiGroups:
- batch
- extensions
resources:
- jobs
verbs: ["get", "list", "watch", "create", "patch", "delete"]
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "clearmlAgent.name" . }}-kpa
subjects:
- kind: ServiceAccount
name: {{ include "clearmlAgent.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "clearmlAgent.name" . }}-kpa
{{- else }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "clearmlAgent.name" . }}-kpa
rules:
- apiGroups:
- ""
resources:
- pods
- secrets
- services
verbs: ["get", "list", "watch", "create", "patch", "delete"]
- apiGroups:
- ""
resources:
- namespaces
verbs: ["list"]
{{- if .Values.agentk8sglue.taskAsJob }}
- apiGroups:
- batch
- extensions
resources:
- jobs
verbs: ["get", "list", "watch", "create", "patch", "delete"]
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "clearmlAgent.name" . }}-kpa
subjects:
- kind: ServiceAccount
name: {{ include "clearmlAgent.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "clearmlAgent.name" . }}-kpa
{{- end }}