Skip to content

Commit

Permalink
Regenerate released directory
Browse files Browse the repository at this point in the history
Merge pull request #1131 from aiyengar2/fix_crd_chart

Fix CRD chart regression and fix CRDs for upgrades
  • Loading branch information
actions-user committed Apr 21, 2021
1 parent 98aacb0 commit 3a740f9
Show file tree
Hide file tree
Showing 49 changed files with 561 additions and 5,367 deletions.
5,679 changes: 424 additions & 5,255 deletions index.yaml
100755 → 100644

Large diffs are not rendered by default.

Binary file modified released/assets/fleet-agent/fleet-agent-0.3.500.tgz
Binary file not shown.
Binary file modified released/assets/fleet-crd/fleet-crd-0.3.500.tgz
Binary file not shown.
Binary file modified released/assets/fleet/fleet-0.3.500.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified released/assets/rancher-backup/rancher-backup-1.0.400.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified released/assets/rancher-grafana/rancher-grafana-6.6.401.tgz
Binary file not shown.
Binary file modified released/assets/rancher-istio-1.8/rancher-istio-1.8.301.tgz
Binary file not shown.
Binary file modified released/assets/rancher-istio-1.8/rancher-istio-1.8.400.tgz
Binary file not shown.
Binary file modified released/assets/rancher-istio-1.8/rancher-istio-1.8.500.tgz
Binary file not shown.
Binary file modified released/assets/rancher-istio-1.9/rancher-istio-1.9.200.tgz
Binary file not shown.
Binary file modified released/assets/rancher-istio-1.9/rancher-istio-1.9.300.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-3.9.001.tgz
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-3.9.002.tgz
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-3.9.400.tgz
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-crd-3.9.001.tgz
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-crd-3.9.002.tgz
Binary file not shown.
Binary file modified released/assets/rancher-logging/rancher-logging-crd-3.9.400.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified released/assets/rancher-operator/rancher-operator-0.1.400.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified released/assets/rancher-pushprox/rancher-pushprox-0.1.300.tgz
Binary file not shown.
Binary file modified released/assets/rancher-sachet/rancher-sachet-1.0.100.tgz
Binary file not shown.
Binary file modified released/assets/rancher-tracing/rancher-tracing-1.20.100.tgz
Binary file not shown.
Binary file modified released/assets/rancher-webhook/rancher-webhook-0.1.000.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# rancher-monitoring-crd
A Rancher chart that installs the CRDs used by rancher-monitoring.

## How does this chart work?

This chart marshalls all of the CRD files placed in the `crd-manifest` directory into a ConfigMap that is installed onto a cluster alongside relevant RBAC (ServiceAccount, ClusterRoleBinding, ClusterRole, and PodSecurityPolicy).

Once the relevant dependent resourcees are installed / upgraded / rolled back, this chart executes a post-install / post-upgrade / post-rollback Job that:
- Patches any existing versions of the CRDs contained within the `crd-manifest` on the cluster to set `spec.preserveUnknownFields=false`; this step is required since, based on [Kubernetes docs](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning) and a [known workaround](https://github.com/kubernetes-sigs/controller-tools/issues/476#issuecomment-691519936), such CRDs cannot be upgraded normally from `apiextensions.k8s.io/v1beta1` to `apiextensions.k8s.io/v1`.
- Runs a `kubectl apply` on the CRDs that are contained within the crd-manifest ConfigMap to upgrade CRDs in the cluster

On an uninstall, this chart executes a separate post-delete Job that:
- Patches any existing versions of the CRDs contained within `crd-manifest` on the cluster to set `metadata.finalizers=[]`
- Runs a `kubectl delete` on the CRDs that are contained within the crd-manifest ConfigMap to clean up the CRDs from the cluster

Note: If the relevant CRDs already existed in the cluster at the time of install, this chart will absorb ownership of the lifecycle of those CRDs; therefore, on a `helm uninstall`, those CRDs will also be removed from the cluster alongside this chart.

## Why can't we just place the CRDs in the templates/ directory of the main chart?

In Helm today, you cannot declare a CRD and declare a resource of that CRD's kind in templates/ without encountering a failure on render.

## [Helm 3] Why can't we just place the CRDs in the crds/ directory of the main chart?

The Helm 3 `crds/` directory only supports the installation of CRDs, but does not support the upgrade and removal of CRDs, unlike what this chart facilitiates.
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ spec:
runAsNonRoot: true
runAsUser: 1000
initContainers:
- name: delete-crds
- name: set-preserve-unknown-fields-false
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/kubectl
- delete
- --ignore-not-found=true
- -f
- /etc/config/crd-manifest.yaml
volumeMounts:
- name: crd-manifest
readOnly: true
mountPath: /etc/config
- /bin/sh
- -c
- >
{{- range $path, $_ := (.Files.Glob "crd-manifest/**.yaml") }}
{{- $crd := get (get ($.Files.Get $path | fromYaml) "metadata") "name" }}
if [[ -n "$(kubectl get crd {{ $crd }} -o jsonpath='{.spec.preserveUnknownFields}')" ]]; then
kubectl patch crd {{ $crd }} -p '{"spec": {"preserveUnknownFields": false, "versions": [{"name": "v1", "served": false, "storage": true}]}}' --type="merge" || true;
fi;
{{- end }}
containers:
- name: create-crds
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/kubectl
- apply
- -f
- /etc/config/crd-manifest.yaml
- /bin/sh
- -c
- >
kubectl apply -f /etc/config/crd-manifest.yaml
volumeMounts:
- name: crd-manifest
readOnly: true
Expand Down Expand Up @@ -80,10 +80,13 @@ spec:
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/kubectl
- apply
- -f
- /etc/config/crd-manifest.yaml
- /bin/sh
- -c
- >
{{- range $path, $_ := (.Files.Glob "crd-manifest/**.yaml") }}
{{- $crd := get (get ($.Files.Get $path | fromYaml) "metadata") "name" }}
kubectl patch crd {{ $crd }} -p '{"metadata": {"finalizers": []}}' || true;
{{- end }}
volumeMounts:
- name: crd-manifest
readOnly: true
Expand All @@ -93,10 +96,10 @@ spec:
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
command:
- /bin/kubectl
- delete
- -f
- /etc/config/crd-manifest.yaml
- /bin/sh
- -c
- >
kubectl delete -f /etc/config/crd-manifest.yaml
volumeMounts:
- name: crd-manifest
readOnly: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ global:
systemDefaultRegistry: ""

image:
repository: rancher/kubectl
tag: v1.20.2
repository: rancher/rancher-agent
tag: v2.5.7
Loading

0 comments on commit 3a740f9

Please sign in to comment.