Skip to content

Commit 9baeddf

Browse files
committed
MAJOR: kubernetes-ingress: Add CRD job w/ RBAC
Signed-off-by: Dinko Korunic <[email protected]>
1 parent 9f250fa commit 9baeddf

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

kubernetes-ingress/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,11 @@ Create a FQDN for the Service metrics.
152152
{{- printf "%s-%s" (include "kubernetes-ingress.fullname" . | trunc 56 | trimSuffix "-") "metrics" }}
153153
{{- end -}}
154154
155+
{{/*
156+
Create a default fully qualified default CRD job name.
157+
*/}}
158+
{{- define "kubernetes-ingress.crdjob.fullname" -}}
159+
{{- printf "%s-%s" (include "kubernetes-ingress.fullname" .) "crdjob" | trunc 63 | trimSuffix "-" -}}
160+
{{- end -}}
161+
155162
{{/* vim: set filetype=mustache: */}}

kubernetes-ingress/templates/clusterrole.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ rules:
9595
- get
9696
- list
9797
- watch
98+
- create
9899
- update
100+
- patch
101+
- delete
99102
{{- if .Values.controller.kubernetesGateway.enabled }}
100103
- apiGroups:
101104
- "gateway.networking.k8s.io"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Copyright 2023 HAProxy Technologies LLC
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+
17+
apiVersion: batch/v1
18+
kind: Job
19+
metadata:
20+
name: {{ include "kubernetes-ingress.crdjob.fullname" . }}
21+
namespace: {{ include "kubernetes-ingress.namespace" . }}
22+
labels:
23+
app.kubernetes.io/name: {{ include "kubernetes-ingress.name" . }}
24+
helm.sh/chart: {{ include "kubernetes-ingress.chart" . }}
25+
app.kubernetes.io/managed-by: {{ .Release.Service }}
26+
app.kubernetes.io/instance: {{ .Release.Name }}
27+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
28+
spec:
29+
template:
30+
metadata:
31+
labels:
32+
app.kubernetes.io/name: {{ include "kubernetes-ingress.name" . }}
33+
app.kubernetes.io/instance: {{ .Release.Name }}
34+
{{- if .Values.controller.podLabels }}
35+
{{ toYaml .Values.controller.podLabels | indent 8 }}
36+
{{- end }}
37+
{{- if .Values.controller.podAnnotations }}
38+
annotations:
39+
{{ toYaml .Values.controller.podAnnotations | indent 8 }}
40+
{{- end }}
41+
spec:
42+
serviceAccountName: {{ include "kubernetes-ingress.serviceAccountName" . }}
43+
containers:
44+
- name: {{ include "kubernetes-ingress.name" . }}-{{ .Values.controller.name }}
45+
image: "{{ .Values.controller.image.repository }}:{{ tpl .Values.controller.image.tag . }}"
46+
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
47+
command:
48+
- /haproxy-ingress-controller
49+
- --job-check-crd
50+
restartPolicy: Never
51+
backoffLimit: 0

0 commit comments

Comments
 (0)