(dev-v2.6-archive) [rancher-monitoring] update the template of rancher-crd chart to handle CRD tgz file

(partially cherry picked from commit 1225dc843a)
pull/1680/head
Jiaqi Luo 2021-10-19 16:37:53 -07:00 committed by Arvind Iyengar
parent 9ac903397d
commit 866376e483
No known key found for this signature in database
GPG Key ID: A8DD9BFD6C811498
2 changed files with 14 additions and 11 deletions

View File

@ -49,8 +49,12 @@ spec:
- -c
- >
echo "Applying CRDs...";
kubectl apply -f /etc/config/crd-manifest.yaml;
mkdir -p /etc/crd-manifest;
base64 -d /etc/config/crd-manifest.tgz > /etc/crd-manifest/crd-manifest.tgz;
tar -xzvf /etc/crd-manifest/crd-manifest.tgz -C /etc/crd-manifest;
rm /etc/crd-manifest/crd-manifest.tgz;
kubectl apply -Rf /etc/crd-manifest;
echo "Waiting for CRDs to be recognized before finishing installation...";
{{- range $path, $_ := (.Files.Glob "crd-manifest/**.yaml") }}
@ -121,7 +125,12 @@ spec:
- /bin/sh
- -c
- >
kubectl delete -f /etc/config/crd-manifest.yaml
echo "Deleting CRDs...";
mkdir -p /etc/crd-manifest;
base64 -d /etc/config/crd-manifest.tgz > /etc/crd-manifest/crd-manifest.tgz;
tar -xzvf /etc/crd-manifest/crd-manifest.tgz -C /etc/crd-manifest;
rm /etc/crd-manifest/crd-manifest.tgz;
kubectl delete -Rf /etc/crd-manifest;
volumeMounts:
- name: crd-manifest
readOnly: true

View File

@ -4,11 +4,5 @@ metadata:
name: {{ .Chart.Name }}-manifest
namespace: {{ .Release.Namespace }}
data:
crd-manifest.yaml: |
{{- $currentScope := . -}}
{{- $crds := (.Files.Glob "crd-manifest/**.yaml") -}}
{{- range $path, $_ := $crds -}}
{{- with $currentScope -}}
{{ .Files.Get $path | nindent 4 }}
---
{{- end -}}{{- end -}}
crd-manifest.tgz:
{{- .Files.Get "files/crd-manifest.tgz" | b64enc | indent 4 }}