diff --git a/stable/k8s-resources/Chart.yaml b/stable/k8s-resources/Chart.yaml index f22e08c9..0b047ab0 100644 --- a/stable/k8s-resources/Chart.yaml +++ b/stable/k8s-resources/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -version: 0.7.0 +version: 0.8.0 appVersion: 0.0.1 name: k8s-resources description: | diff --git a/stable/k8s-resources/README.md b/stable/k8s-resources/README.md index 49be6849..598a7a1a 100644 --- a/stable/k8s-resources/README.md +++ b/stable/k8s-resources/README.md @@ -1,6 +1,6 @@ # k8s-resources -![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) +![Version: 0.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) Not an application but a Helm chart to create any and many resources in Kubernetes. @@ -34,7 +34,7 @@ helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/k8s-resource To install a specific version of this chart: ```console -helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/k8s-resources --version 0.7.0 +helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/k8s-resources --version 0.8.0 ``` To install the chart with the release name `my-release`: diff --git a/stable/k8s-resources/ci/ct-values.yaml b/stable/k8s-resources/ci/ct-values.yaml index 9731ba16..87a3616d 100644 --- a/stable/k8s-resources/ci/ct-values.yaml +++ b/stable/k8s-resources/ci/ct-values.yaml @@ -12,6 +12,20 @@ CronJobs: - "sh" - "-c" - "'echo yes'" + - name: example-cronjob-1 + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: + app: my-app + schedule: 00 19 * * * + containers: + - name: my-container + image: ubuntu:bionic + args: + - "sh" + - "-c" + - "'echo yes'" ConfigMaps: - name: example-cm @@ -24,6 +38,17 @@ ConfigMaps: key: | line 1 line 2 + - name: example-cm-1 + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: {} + kv_data: + key: value + multiline_data: + key: | + line 1 + line 2 Ingresses: - name: example-ingress @@ -41,6 +66,22 @@ Ingresses: name: example-service port: number: 8080 + - name: example-ingress-1 + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: {} + rules: + - host: chart-example.local + http: + paths: + - path: /api + pathType: Prefix + backend: + service: + name: example-service + port: + number: 8080 Secrets: - name: example-secret @@ -53,7 +94,18 @@ Secrets: key2: value1 keys: key3: dmFsdWUyCg== + - name: example-secret-1 + fullnameOverride: "" + annotations: {} + extraLabels: {} + tplB64Keys: + key1: '{{ (index .Values.Secrets 0).name }}' + b64Keys: + key2: value1 + keys: + key3: dmFsdWUyCg== - name: example-secret-2 + enabled: false fullnameOverride: "" annotations: {} extraLabels: {} @@ -76,7 +128,19 @@ Services: - port: 80 targetPort: 8080 protocol: TCP + - name: example-service-1 + fullnameOverride: "" + annotations: {} + extraLabels: {} + type: ClusterIP + selector: + key2: value2 + ports: + - port: 443 + targetPort: 443 + protocol: TCP - name: example-service-2 + enabled: false fullnameOverride: "" annotations: {} extraLabels: {} @@ -93,7 +157,12 @@ ServiceAccounts: fullnameOverride: "" annotations: {} extraLabels: {} + - name: example-sa-1 + fullnameOverride: "" + annotations: {} + extraLabels: {} - name: example-sa-2 + enabled: false fullnameOverride: "" annotations: {} extraLabels: {} @@ -110,12 +179,29 @@ HorizontalPodAutoscalers: apiVersion: apps/v1 kind: Deployment name: my-deployment + - name: example-hpa2 + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: {} + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: my-deployment Namespaces: - name: production fullnameOverride: "" annotations: {} extraLabels: {} + - name: test + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: {} ClusterRoles: - name: example-cr-1 @@ -132,6 +218,10 @@ ClusterRoles: - name: example-cr-2 extraLabels: mylabel: myvalue + - name: example-cr-3 + enabled: false + extraLabels: + mylabel: myvalue ClusterRoleBindings: - name: example-crb-1 @@ -155,3 +245,13 @@ ClusterRoleBindings: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io + - name: example-crb-3 + enabled: false + fullnameOverride: "" + annotations: {} + extraLabels: + mylabel: myvalue + roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io diff --git a/stable/k8s-resources/templates/clusterrole.yaml b/stable/k8s-resources/templates/clusterrole.yaml index f510eeeb..cf06af6b 100644 --- a/stable/k8s-resources/templates/clusterrole.yaml +++ b/stable/k8s-resources/templates/clusterrole.yaml @@ -1,5 +1,6 @@ {{- if .Values.ClusterRoles -}} {{- range .Values.ClusterRoles }} +{{- if . | dig "enabled" true }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -23,3 +24,4 @@ rules: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/clusterrolebinding.yaml b/stable/k8s-resources/templates/clusterrolebinding.yaml index 93938215..79d53b59 100644 --- a/stable/k8s-resources/templates/clusterrolebinding.yaml +++ b/stable/k8s-resources/templates/clusterrolebinding.yaml @@ -1,5 +1,6 @@ {{- if .Values.ClusterRoleBindings -}} {{- range .Values.ClusterRoleBindings }} +{{- if . | dig "enabled" true }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: @@ -25,3 +26,4 @@ subjects: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/configmap.yaml b/stable/k8s-resources/templates/configmap.yaml index 93c5dd56..916c6030 100644 --- a/stable/k8s-resources/templates/configmap.yaml +++ b/stable/k8s-resources/templates/configmap.yaml @@ -1,5 +1,6 @@ {{- if .Values.ConfigMaps -}} {{- range .Values.ConfigMaps }} +{{- if . | dig "enabled" true }} apiVersion: v1 kind: ConfigMap metadata: @@ -33,3 +34,4 @@ data: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/cronjob.yaml b/stable/k8s-resources/templates/cronjob.yaml index 407e1519..8349e8af 100644 --- a/stable/k8s-resources/templates/cronjob.yaml +++ b/stable/k8s-resources/templates/cronjob.yaml @@ -1,5 +1,6 @@ {{- if .Values.CronJobs -}} {{- range .Values.CronJobs }} +{{- if . | dig "enabled" true }} {{- if semverCompare ">=1.24-0" $.Capabilities.KubeVersion.GitVersion -}} apiVersion: batch/v1 {{- else -}} @@ -49,3 +50,4 @@ spec: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/custom.yaml b/stable/k8s-resources/templates/custom.yaml index e693e89f..a1a8989d 100644 --- a/stable/k8s-resources/templates/custom.yaml +++ b/stable/k8s-resources/templates/custom.yaml @@ -1,5 +1,6 @@ {{- if .Values.CustomResources -}} {{- range .Values.CustomResources }} +{{- if . | dig "enabled" true }} apiVersion: {{ .apiVersion }} kind: {{ .kind }} metadata: @@ -21,3 +22,4 @@ spec: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/hpa.yaml b/stable/k8s-resources/templates/hpa.yaml index 1d1f5f8c..bb765e23 100644 --- a/stable/k8s-resources/templates/hpa.yaml +++ b/stable/k8s-resources/templates/hpa.yaml @@ -1,5 +1,6 @@ {{- if .Values.HorizontalPodAutoscalers -}} {{- range .Values.HorizontalPodAutoscalers }} +{{- if . | dig "enabled" true }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: @@ -41,3 +42,4 @@ spec: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/ingress.yaml b/stable/k8s-resources/templates/ingress.yaml index 3cc13465..b3e76cf5 100644 --- a/stable/k8s-resources/templates/ingress.yaml +++ b/stable/k8s-resources/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.Ingresses -}} {{- range .Values.Ingresses }} +{{- if . | dig "enabled" true }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -41,3 +42,4 @@ spec: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/namespace.yaml b/stable/k8s-resources/templates/namespace.yaml index 99855152..a8605ec0 100644 --- a/stable/k8s-resources/templates/namespace.yaml +++ b/stable/k8s-resources/templates/namespace.yaml @@ -1,5 +1,6 @@ {{- if .Values.Namespaces -}} {{- range .Values.Namespaces }} +{{- if . | dig "enabled" true }} apiVersion: v1 kind: Namespace metadata: @@ -16,3 +17,4 @@ metadata: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/priorityclass.yaml b/stable/k8s-resources/templates/priorityclass.yaml index f6c1cbc7..e2f1cb75 100644 --- a/stable/k8s-resources/templates/priorityclass.yaml +++ b/stable/k8s-resources/templates/priorityclass.yaml @@ -1,5 +1,6 @@ {{- if .Values.PriorityClasses -}} {{- range .Values.PriorityClasses }} +{{- if . | dig "enabled" true }} apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: @@ -11,3 +12,4 @@ description: {{ .description }} --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/scaledObject.yaml b/stable/k8s-resources/templates/scaledObject.yaml index 870f9b6f..d8df8c11 100644 --- a/stable/k8s-resources/templates/scaledObject.yaml +++ b/stable/k8s-resources/templates/scaledObject.yaml @@ -1,5 +1,6 @@ {{- if .Values.ScaledObjects -}} {{- range .Values.ScaledObjects }} +{{- if . | dig "enabled" true }} apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: @@ -32,3 +33,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/secret.yaml b/stable/k8s-resources/templates/secret.yaml index 922abc4c..f65e1095 100644 --- a/stable/k8s-resources/templates/secret.yaml +++ b/stable/k8s-resources/templates/secret.yaml @@ -1,5 +1,6 @@ {{- if .Values.Secrets -}} {{- range .Values.Secrets }} +{{- if . | dig "enabled" true }} apiVersion: v1 kind: Secret type: {{ if .type }}{{ .type }}{{ else }}Opaque{{ end }} @@ -36,3 +37,4 @@ data: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/service.yaml b/stable/k8s-resources/templates/service.yaml index 7715a00d..ee7335f7 100644 --- a/stable/k8s-resources/templates/service.yaml +++ b/stable/k8s-resources/templates/service.yaml @@ -1,5 +1,6 @@ {{- if .Values.Services -}} {{- range .Values.Services }} +{{- if . | dig "enabled" true }} apiVersion: v1 kind: Service metadata: @@ -29,3 +30,4 @@ spec: --- {{- end }} {{- end }} +{{- end }} diff --git a/stable/k8s-resources/templates/serviceaccount.yaml b/stable/k8s-resources/templates/serviceaccount.yaml index d003442e..b72339cd 100644 --- a/stable/k8s-resources/templates/serviceaccount.yaml +++ b/stable/k8s-resources/templates/serviceaccount.yaml @@ -1,5 +1,6 @@ {{- if .Values.ServiceAccounts -}} {{- range .Values.ServiceAccounts }} +{{- if . | dig "enabled" true }} apiVersion: v1 kind: ServiceAccount metadata: @@ -19,3 +20,4 @@ metadata: --- {{- end }} {{- end }} +{{- end }}