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
description: Kubernetes admission controller to remove CPU limits from Pods.
name: k8s-ycl
version: 1.2.1
version: 1.2.2
appVersion: v0.2.0
kubeVersion: ">=1.22.0-0"
sources:
@ -24,7 +24,7 @@ annotations:
artifacthub.io/changes: |-
- kind: changed
description: |
Update to most recent library dependency
Restructure Helm helpers / includes
artifacthub.io/links: |
- name: "source"
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" -}}
9443
{{- 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
kind: MutatingWebhookConfiguration

View file

@ -1,75 +1,6 @@
---
{{/* Make sure all variables are set properly */}}
{{- include "bjw-s.common.loader.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 -}}
{{- include "k8s-ycl.init" . }}
{{/* Render the templates */}}
{{- $ctx := deepCopy . -}}
{{- $_ := include "k8s-ycl.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{- include "bjw-s.common.loader.all" . }}

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
# signing webhook serving certificates
@ -11,9 +12,7 @@ metadata:
{{- include "bjw-s.common.lib.metadata.allLabels" . | nindent 4 }}
spec:
selfSigned: {}
---
# Generate a CA Certificate used to sign certificates for the webhook
apiVersion: cert-manager.io/v1
kind: Certificate
@ -30,9 +29,7 @@ spec:
kind: Issuer
commonName: "ca.k8s-ycl.cert-manager"
isCA: true
---
# Create an Issuer that uses the above generated CA certificate to issue certs
apiVersion: cert-manager.io/v1
kind: Issuer
@ -44,9 +41,7 @@ metadata:
spec:
ca:
secretName: {{ include "k8s-ycl.rootCACertificate" . }}
---
# Finally, generate a serving certificate for the webhook to use
apiVersion: cert-manager.io/v1
kind: Certificate