agones.dev/agones@v1.53.0/install/helm/agones/templates/hooks/sa.yaml (about)

     1  {{- if .Values.agones.crds.cleanupOnDelete }}
     2  # Copyright 2018 Google LLC All Rights Reserved.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  apiVersion: v1
    17  kind: ServiceAccount
    18  metadata:
    19    name: helm-hook-cleanup
    20    namespace: {{ .Release.Namespace }}
    21    labels:
    22      app: {{ template "agones.name" . }}
    23      chart: {{ template "agones.chart" . }}
    24      release: {{ .Release.Name }}
    25      heritage: {{ .Release.Service }}
    26    annotations:
    27      "helm.sh/hook": pre-delete
    28      "helm.sh/hook-weight": "-5"
    29      "helm.sh/hook-delete-policy": before-hook-creation
    30  ---
    31  {{- if .Values.agones.rbacEnabled }}
    32  apiVersion: rbac.authorization.k8s.io/v1
    33  kind: ClusterRole
    34  metadata:
    35    name: helm-hook-cleanup
    36    labels:
    37      app: {{ template "agones.name" . }}
    38      chart: {{ template "agones.chart" . }}
    39      release: {{ .Release.Name }}
    40      heritage: {{ .Release.Service }}
    41    annotations:
    42      "helm.sh/hook": pre-delete
    43      "helm.sh/hook-weight": "-5"
    44      "helm.sh/hook-delete-policy": before-hook-creation
    45  rules:
    46  - apiGroups: ["agones.dev", "multicluster.agones.dev", "autoscaling.agones.dev"]
    47    resources: ["fleets", "fleetautoscalers", "gameservers", "gameserversets", "gameserverallocationpolicies"]
    48    verbs: ["delete", "list" ]
    49  - apiGroups: [""]
    50    resources: ["pods"]
    51    verbs: ["get", "list"]
    52  ---
    53  apiVersion: rbac.authorization.k8s.io/v1
    54  kind: ClusterRoleBinding
    55  metadata:
    56    name: helm-hook-cleanup-access
    57    labels:
    58      app: {{ template "agones.name" . }}
    59      chart: {{ template "agones.chart" . }}
    60      release: {{ .Release.Name }}
    61      heritage: {{ .Release.Service }}
    62    annotations:
    63      "helm.sh/hook": pre-delete
    64      "helm.sh/hook-weight": "-4"
    65      "helm.sh/hook-delete-policy": before-hook-creation
    66  subjects:
    67  - kind: User
    68    name: system:serviceaccount:{{ .Release.Namespace }}:helm-hook-cleanup
    69    apiGroup: rbac.authorization.k8s.io
    70  roleRef:
    71    apiGroup: rbac.authorization.k8s.io
    72    kind: ClusterRole
    73    name: helm-hook-cleanup
    74  {{- end }}
    75  {{- end }}