fix(metallb): Ensure metallb is running before creating resources (#4321)
This commit is contained in:
committed by
GitHub
parent
5bb9ba9c0d
commit
fe2782df44
@@ -22,7 +22,7 @@ sources:
|
||||
- https://github.com/metallb/metallb
|
||||
- https://metallb.universe.tf
|
||||
type: application
|
||||
version: 5.0.0
|
||||
version: 5.0.1
|
||||
annotations:
|
||||
truecharts.org/catagories: |
|
||||
- core
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
{{- define "metallb.wait" -}}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ $fullName }}-wait
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install, pre-upgrade
|
||||
"helm.sh/hook-weight": "-1"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: {{ $fullName }}-wait
|
||||
containers:
|
||||
- name: {{ $fullName }}-wait
|
||||
image: {{ .Values.ubuntuImage.repository }}:{{ .Values.ubuntuImage.tag }}
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- |
|
||||
/bin/bash <<'EOF'
|
||||
kubectl wait --namespace metallb-system --for=condition=ready pod --selector=app=metallb --timeout=90s
|
||||
EOF
|
||||
restartPolicy: OnFailure
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ $fullName }}-wait
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install, pre-upgrade
|
||||
"helm.sh/hook-weight": "-2"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
||||
rules:
|
||||
- apiGroups: ["*"]
|
||||
resources: ["pods"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ $fullName }}-wait
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install, pre-upgrade
|
||||
"helm.sh/hook-weight": "-2"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ $fullName }}-wait
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ $fullName }}-wait
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ $fullName }}-wait
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install, pre-upgrade
|
||||
"helm.sh/hook-weight": "-2"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
|
||||
{{- end -}}
|
||||
@@ -13,3 +13,5 @@
|
||||
{{- include "metallb.comm" . }}
|
||||
|
||||
{{- include "metallb.pool" . }}
|
||||
|
||||
{{- include "metallb.wait" . }}
|
||||
|
||||
Reference in New Issue
Block a user