Skip to content

Commit

Permalink
[stable/k8s-resources]: introduce enabled flag
Browse files Browse the repository at this point in the history
Signed-off-by: Ievgenii Shepeliuk <eshepelyuk@gmail.com>
  • Loading branch information
eshepelyuk committed Oct 21, 2024
1 parent 0008a8e commit 00ac129
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stable/k8s-resources/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.7.0
version: 0.8.0
appVersion: 0.0.1
name: k8s-resources
description: |
Expand Down
4 changes: 2 additions & 2 deletions stable/k8s-resources/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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`:
Expand Down
100 changes: 100 additions & 0 deletions stable/k8s-resources/ci/ct-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: {}
Expand All @@ -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: {}
Expand All @@ -93,7 +157,12 @@ ServiceAccounts:
fullnameOverride: ""
annotations: {}
extraLabels: {}
- name: example-sa-1
fullnameOverride: ""
annotations: {}
extraLabels: {}
- name: example-sa-2
enabled: false
fullnameOverride: ""
annotations: {}
extraLabels: {}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ClusterRoles -}}
{{- range .Values.ClusterRoles }}
{{- if . | dig "enabled" true }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand All @@ -23,3 +24,4 @@ rules:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ClusterRoleBindings -}}
{{- range .Values.ClusterRoleBindings }}
{{- if . | dig "enabled" true }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand All @@ -25,3 +26,4 @@ subjects:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ConfigMaps -}}
{{- range .Values.ConfigMaps }}
{{- if . | dig "enabled" true }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -33,3 +34,4 @@ data:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
Expand Down Expand Up @@ -49,3 +50,4 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/custom.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.CustomResources -}}
{{- range .Values.CustomResources }}
{{- if . | dig "enabled" true }}
apiVersion: {{ .apiVersion }}
kind: {{ .kind }}
metadata:
Expand All @@ -21,3 +22,4 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.HorizontalPodAutoscalers -}}
{{- range .Values.HorizontalPodAutoscalers }}
{{- if . | dig "enabled" true }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -41,3 +42,4 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.Ingresses -}}
{{- range .Values.Ingresses }}
{{- if . | dig "enabled" true }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down Expand Up @@ -41,3 +42,4 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.Namespaces -}}
{{- range .Values.Namespaces }}
{{- if . | dig "enabled" true }}
apiVersion: v1
kind: Namespace
metadata:
Expand All @@ -16,3 +17,4 @@ metadata:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/priorityclass.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.PriorityClasses -}}
{{- range .Values.PriorityClasses }}
{{- if . | dig "enabled" true }}
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
Expand All @@ -11,3 +12,4 @@ description: {{ .description }}
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/scaledObject.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ScaledObjects -}}
{{- range .Values.ScaledObjects }}
{{- if . | dig "enabled" true }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
Expand Down Expand Up @@ -32,3 +33,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -36,3 +37,4 @@ data:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.Services -}}
{{- range .Values.Services }}
{{- if . | dig "enabled" true }}
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -29,3 +30,4 @@ spec:
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions stable/k8s-resources/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ServiceAccounts -}}
{{- range .Values.ServiceAccounts }}
{{- if . | dig "enabled" true }}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -19,3 +20,4 @@ metadata:
---
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 00ac129

Please sign in to comment.