-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fp: rancher-monitoring-crd 103.2.1+up57.0.3
- Loading branch information
1 parent
223bd62
commit 64eab9c
Showing
12 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+303 KB
assets/rancher-monitoring-crd/rancher-monitoring-crd-103.2.1+up57.0.3.tgz
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
annotations: | ||
catalog.cattle.io/certified: rancher | ||
catalog.cattle.io/hidden: "true" | ||
catalog.cattle.io/namespace: cattle-monitoring-system | ||
catalog.cattle.io/release-name: rancher-monitoring-crd | ||
apiVersion: v2 | ||
description: Installs the CRDs for rancher-monitoring. | ||
name: rancher-monitoring-crd | ||
type: application | ||
version: 103.2.1+up57.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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. |
Binary file not shown.
30 changes: 30 additions & 0 deletions
30
charts/rancher-monitoring-crd/103.2.1+up57.0.3/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Rancher | ||
|
||
{{- define "system_default_registry" -}} | ||
{{- if .Values.global.cattle.systemDefaultRegistry -}} | ||
{{- printf "%s/" .Values.global.cattle.systemDefaultRegistry -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
# Windows Support | ||
|
||
{{/* | ||
Windows cluster will add default taint for linux nodes, | ||
add below linux tolerations to workloads could be scheduled to those linux nodes | ||
*/}} | ||
|
||
{{- define "linux-node-tolerations" -}} | ||
- key: "cattle.io/os" | ||
value: "linux" | ||
effect: "NoSchedule" | ||
operator: "Equal" | ||
{{- end -}} | ||
|
||
{{- define "linux-node-selector" -}} | ||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
beta.kubernetes.io/os: linux | ||
{{- else -}} | ||
kubernetes.io/os: linux | ||
{{- end -}} | ||
{{- end -}} | ||
|
102 changes: 102 additions & 0 deletions
102
charts/rancher-monitoring-crd/103.2.1+up57.0.3/templates/jobs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ .Chart.Name }}-create | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ .Chart.Name }} | ||
annotations: | ||
"helm.sh/hook": post-install, post-upgrade, post-rollback | ||
"helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed | ||
spec: | ||
template: | ||
metadata: | ||
name: {{ .Chart.Name }}-create | ||
labels: | ||
app: {{ .Chart.Name }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }}-manager | ||
securityContext: | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
containers: | ||
- name: create-crds | ||
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- > | ||
echo "Applying CRDs..."; | ||
mkdir -p /etc/crd; | ||
base64 -d /etc/config/crd-manifest.tgz.b64 | tar -xzv -C /etc/crd; | ||
kubectl replace -Rf /etc/crd || kubectl create -Rf /etc/crd; | ||
echo "Done!" | ||
volumeMounts: | ||
- name: crd-manifest | ||
readOnly: true | ||
mountPath: /etc/config | ||
restartPolicy: OnFailure | ||
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }} | ||
{{- if .Values.nodeSelector }} | ||
{{- toYaml .Values.nodeSelector | nindent 8 }} | ||
{{- end }} | ||
tolerations: {{ include "linux-node-tolerations" . | nindent 8 }} | ||
{{- if .Values.tolerations }} | ||
{{- toYaml .Values.tolerations | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: crd-manifest | ||
configMap: | ||
name: {{ .Chart.Name }}-manifest | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ .Chart.Name }}-delete | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ .Chart.Name }} | ||
annotations: | ||
"helm.sh/hook": pre-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation, hook-succeeded, hook-failed | ||
spec: | ||
template: | ||
metadata: | ||
name: {{ .Chart.Name }}-delete | ||
labels: | ||
app: {{ .Chart.Name }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }}-manager | ||
securityContext: | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
containers: | ||
- name: delete-crds | ||
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- > | ||
echo "Deleting CRDs..."; | ||
mkdir -p /etc/crd; | ||
base64 -d /etc/config/crd-manifest.tgz.b64 | tar -xzv -C /etc/crd; | ||
kubectl delete --ignore-not-found=true -Rf /etc/crd; | ||
volumeMounts: | ||
- name: crd-manifest | ||
readOnly: true | ||
mountPath: /etc/config | ||
restartPolicy: OnFailure | ||
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }} | ||
{{- if .Values.nodeSelector }} | ||
{{- toYaml .Values.nodeSelector | nindent 8 }} | ||
{{- end }} | ||
tolerations: {{ include "linux-node-tolerations" . | nindent 8 }} | ||
{{- if .Values.tolerations }} | ||
{{- toYaml .Values.tolerations | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: crd-manifest | ||
configMap: | ||
name: {{ .Chart.Name }}-manifest |
8 changes: 8 additions & 0 deletions
8
charts/rancher-monitoring-crd/103.2.1+up57.0.3/templates/manifest.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Chart.Name }}-manifest | ||
namespace: {{ .Release.Namespace }} | ||
data: | ||
crd-manifest.tgz.b64: | ||
{{- .Files.Get "files/crd-manifest.tgz" | b64enc | indent 4 }} |
76 changes: 76 additions & 0 deletions
76
charts/rancher-monitoring-crd/103.2.1+up57.0.3/templates/rbac.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ .Chart.Name }}-manager | ||
labels: | ||
app: {{ .Chart.Name }}-manager | ||
rules: | ||
- apiGroups: | ||
- apiextensions.k8s.io | ||
resources: | ||
- customresourcedefinitions | ||
verbs: ['create', 'get', 'patch', 'delete', 'update', 'list'] | ||
{{- if .Values.global.cattle.psp.enabled }} | ||
- apiGroups: ['policy'] | ||
resources: ['podsecuritypolicies'] | ||
verbs: ['use'] | ||
resourceNames: | ||
- {{ .Chart.Name }}-manager | ||
{{- end }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ .Chart.Name }}-manager | ||
labels: | ||
app: {{ .Chart.Name }}-manager | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ .Chart.Name }}-manager | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Chart.Name }}-manager | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Chart.Name }}-manager | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ .Chart.Name }}-manager | ||
--- | ||
{{- if .Values.global.cattle.psp.enabled }} | ||
apiVersion: policy/v1beta1 | ||
kind: PodSecurityPolicy | ||
metadata: | ||
name: {{ .Chart.Name }}-manager | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app: {{ .Chart.Name }}-manager | ||
spec: | ||
privileged: false | ||
allowPrivilegeEscalation: false | ||
hostNetwork: false | ||
hostIPC: false | ||
hostPID: false | ||
runAsUser: | ||
rule: 'RunAsAny' | ||
seLinux: | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'MustRunAs' | ||
ranges: | ||
- min: 1 | ||
max: 65535 | ||
fsGroup: | ||
rule: 'MustRunAs' | ||
ranges: | ||
- min: 1 | ||
max: 65535 | ||
readOnlyRootFilesystem: false | ||
volumes: | ||
- 'configMap' | ||
- 'secret' | ||
{{- end }} |
7 changes: 7 additions & 0 deletions
7
charts/rancher-monitoring-crd/103.2.1+up57.0.3/templates/validate-psp-install.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#{{- if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}} | ||
#{{- if .Values.global.cattle.psp.enabled }} | ||
#{{- if not (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }} | ||
#{{- fail "The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding." -}} | ||
#{{- end }} | ||
#{{- end }} | ||
#{{- end }} |
17 changes: 17 additions & 0 deletions
17
charts/rancher-monitoring-crd/103.2.1+up57.0.3/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Default values for rancher-monitoring-crd. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
global: | ||
cattle: | ||
psp: | ||
enabled: false | ||
systemDefaultRegistry: "" | ||
|
||
image: | ||
repository: rancher/shell | ||
tag: v0.2.1 | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters