openstack-helm-infra/kafka/templates/job-generate-acl.yaml

73 lines
3.0 KiB
YAML

{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.job_generate_acl }}
{{- $envAll := . }}
{{- $KafkaUserSecret := .Values.secrets.kafka.admin }}
{{- $serviceAccountName := "kafka-generate-acl" }}
{{ tuple $envAll "generate_acl" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: kafka-generate-acl
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
backoffLimit: {{ .Values.jobs.generate_acl.backoffLimit }}
template:
metadata:
labels:
{{ tuple $envAll "kafka" "generate-acl" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
{{ dict "envAll" $envAll "application" "generate-acl" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
activeDeadlineSeconds: {{ .Values.jobs.generate_acl.activeDeadlineSeconds }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value | quote }}
initContainers:
{{ tuple $envAll "generate_acl" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: generate-acl
{{ tuple $envAll "generate_acl" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.generate_acl | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "generate_acl" "container" "generate_acl" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
env:
- name: KAFKA_ZOOKEEPER_CONNECT
value: "{{ tuple "zookeeper" "internal" "client" $envAll | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}"
command:
- /tmp/generate-acl.sh
volumeMounts:
- name: kafka-bin
mountPath: /tmp/generate-acl.sh
subPath: generate-acl.sh
readOnly: true
- name: kafka-etc
mountPath: /opt/kafka/config/jaas.conf
subPath: jaas.conf
readOnly: true
volumes:
- name: kafka-bin
configMap:
name: kafka-bin
defaultMode: 0555
- name: kafka-etc
secret:
secretName: kafka-etc
defaultMode: 0444
{{- end }}