feat(k8s-ycl): Restructure Helm helpers/includes

This commit is contained in:
Bernd Schorgers 2024-01-30 20:11:46 +01:00
parent 6c25f4c536
commit 0b59dfc14c
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
6 changed files with 79 additions and 81 deletions

View file

@ -2,7 +2,7 @@
apiVersion: v2 apiVersion: v2
description: Kubernetes admission controller to remove CPU limits from Pods. description: Kubernetes admission controller to remove CPU limits from Pods.
name: k8s-ycl name: k8s-ycl
version: 1.2.1 version: 1.2.2
appVersion: v0.2.0 appVersion: v0.2.0
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
sources: sources:
@ -24,7 +24,7 @@ annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: changed - kind: changed
description: | description: |
Update to most recent library dependency Restructure Helm helpers / includes
artifacthub.io/links: | artifacthub.io/links: |
- name: "source" - name: "source"
url: "https://github.com/bjw-s/k8s-ycl" url: "https://github.com/bjw-s/k8s-ycl"

View file

@ -0,0 +1,64 @@
{{- define "k8s-ycl.hardcodedValues" -}}
controllers:
main:
containers:
main:
probes:
liveness:
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness:
enabled: true
custom: true
spec:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
startup:
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: 8081
failureThreshold: 30
periodSeconds: 10
service:
main:
enabled: true
nameOverride: webhook
ports:
http:
enabled: true
port: 9443
metrics:
enabled: true
port: 8080
probe:
enabled: true
port: 8081
serviceAccount:
create: true
persistence:
certs:
enabled: true
type: secret
name: {{ include "k8s-ycl.servingCertificate" . }}
globalMounts:
- path: /tls
{{- end -}}

View file

@ -1,3 +1,10 @@
{{- define "k8s-ycl.init" -}}
{{/* Make sure all variables are set properly */}}
{{- include "bjw-s.common.loader.init" . }}
{{- $_ := include "k8s-ycl.hardcodedValues" . | fromYaml | merge .Values -}}
{{- end -}}
{{- define "k8s-ycl.webhookPort" -}} {{- define "k8s-ycl.webhookPort" -}}
9443 9443
{{- end -}} {{- end -}}

View file

@ -1,4 +1,5 @@
{{- include "bjw-s.common.loader.init" . -}} {{/* Make sure all variables are set properly */}}
{{- include "k8s-ycl.init" . -}}
--- ---
apiVersion: admissionregistration.k8s.io/v1 apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration kind: MutatingWebhookConfiguration

View file

@ -1,75 +1,6 @@
--- ---
{{/* Make sure all variables are set properly */}} {{/* Make sure all variables are set properly */}}
{{- include "bjw-s.common.loader.init" . }} {{- include "k8s-ycl.init" . }}
{{/* Append the hardcoded settings */}}
{{- define "k8s-ycl.hardcodedValues" -}}
controllers:
main:
containers:
main:
probes:
liveness:
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness:
enabled: true
custom: true
spec:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
startup:
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: 8081
failureThreshold: 30
periodSeconds: 10
service:
main:
enabled: true
nameOverride: webhook
ports:
http:
enabled: true
port: 9443
metrics:
enabled: true
port: 8080
probe:
enabled: true
port: 8081
serviceAccount:
create: true
persistence:
certs:
enabled: true
type: secret
name: {{ include "k8s-ycl.servingCertificate" . }}
globalMounts:
- path: /tls
{{- end -}}
{{/* Render the templates */}} {{/* Render the templates */}}
{{- $ctx := deepCopy . -}} {{- include "bjw-s.common.loader.all" . }}
{{- $_ := include "k8s-ycl.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}

View file

@ -1,4 +1,5 @@
{{- include "bjw-s.common.loader.init" . -}} {{/* Make sure all variables are set properly */}}
{{- include "k8s-ycl.init" . -}}
--- ---
# Create a selfsigned Issuer, in order to create a root CA certificate for # Create a selfsigned Issuer, in order to create a root CA certificate for
# signing webhook serving certificates # signing webhook serving certificates
@ -11,9 +12,7 @@ metadata:
{{- include "bjw-s.common.lib.metadata.allLabels" . | nindent 4 }} {{- include "bjw-s.common.lib.metadata.allLabels" . | nindent 4 }}
spec: spec:
selfSigned: {} selfSigned: {}
--- ---
# Generate a CA Certificate used to sign certificates for the webhook # Generate a CA Certificate used to sign certificates for the webhook
apiVersion: cert-manager.io/v1 apiVersion: cert-manager.io/v1
kind: Certificate kind: Certificate
@ -30,9 +29,7 @@ spec:
kind: Issuer kind: Issuer
commonName: "ca.k8s-ycl.cert-manager" commonName: "ca.k8s-ycl.cert-manager"
isCA: true isCA: true
--- ---
# Create an Issuer that uses the above generated CA certificate to issue certs # Create an Issuer that uses the above generated CA certificate to issue certs
apiVersion: cert-manager.io/v1 apiVersion: cert-manager.io/v1
kind: Issuer kind: Issuer
@ -44,9 +41,7 @@ metadata:
spec: spec:
ca: ca:
secretName: {{ include "k8s-ycl.rootCACertificate" . }} secretName: {{ include "k8s-ycl.rootCACertificate" . }}
--- ---
# Finally, generate a serving certificate for the webhook to use # Finally, generate a serving certificate for the webhook to use
apiVersion: cert-manager.io/v1 apiVersion: cert-manager.io/v1
kind: Certificate kind: Certificate