Add cilium chart

This commit is contained in:
Jonny Ervine
2024-07-15 18:18:16 +08:00
parent 9b2e417702
commit 221e0d5590
159 changed files with 37242 additions and 0 deletions
@@ -0,0 +1,31 @@
{{/*
Generate TLS certificates for Hubble Server and Hubble Relay.
Note: Always use this template as follows:
{{- $_ := include "hubble-generate-certs.helm.setup-ca" . -}}
The assignment to `$_` is required because we store the generated CI in a global `ca` variable.
Please, don't try to "simplify" this, as without this trick, every generated
certificate would be signed by a different CA.
*/}}
{{- define "hubble-generate-certs.helm.setup-ca" }}
{{- if not .ca }}
{{- $ca := "" -}}
{{- $crt := .Values.tls.ca.cert -}}
{{- $key := .Values.tls.ca.key -}}
{{- if and $crt $key }}
{{- $ca = buildCustomCert $crt $key -}}
{{- else }}
{{- $_ := include "cilium.ca.setup" . -}}
{{- with lookup "v1" "Secret" .Release.Namespace .commonCASecretName }}
{{- $crt := index .data "ca.crt" }}
{{- $key := index .data "ca.key" }}
{{- $ca = buildCustomCert $crt $key -}}
{{- else }}
{{- $ca = .commonCA -}}
{{- end }}
{{- end }}
{{- $_ := set . "ca" $ca -}}
{{- end }}
{{- end }}
@@ -0,0 +1,21 @@
{{- if and .Values.hubble.enabled .Values.hubble.tls.enabled .Values.hubble.tls.auto.enabled (eq .Values.hubble.tls.auto.method "helm") .Values.hubble.relay.enabled }}
{{- $_ := include "hubble-generate-certs.helm.setup-ca" . -}}
{{- $cn := "*.hubble-relay.cilium.io" }}
{{- $dns := list $cn }}
{{- $cert := genSignedCert $cn nil $dns (.Values.hubble.tls.auto.certValidityDuration | int) .ca -}}
---
apiVersion: v1
kind: Secret
metadata:
name: hubble-relay-client-certs
namespace: {{ .Release.Namespace }}
{{- with .Values.hubble.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
ca.crt: {{ .ca.Cert | b64enc }}
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
{{- end }}
@@ -0,0 +1,22 @@
{{- if and .Values.hubble.enabled .Values.hubble.tls.enabled .Values.hubble.tls.auto.enabled (eq .Values.hubble.tls.auto.method "helm") .Values.hubble.relay.enabled .Values.hubble.relay.tls.server.enabled }}
{{- $_ := include "hubble-generate-certs.helm.setup-ca" . -}}
{{- $cn := "*.hubble-relay.cilium.io" }}
{{- $ip := .Values.hubble.relay.tls.server.extraIpAddresses }}
{{- $dns := prepend .Values.hubble.relay.tls.server.extraDnsNames $cn }}
{{- $cert := genSignedCert $cn $ip $dns (.Values.hubble.tls.auto.certValidityDuration | int) .ca -}}
---
apiVersion: v1
kind: Secret
metadata:
name: hubble-relay-server-certs
namespace: {{ .Release.Namespace }}
{{- with .Values.hubble.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
ca.crt: {{ .ca.Cert | b64enc }}
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
{{- end }}
@@ -0,0 +1,22 @@
{{- if and .Values.agent .Values.hubble.enabled .Values.hubble.tls.enabled .Values.hubble.tls.auto.enabled (eq .Values.hubble.tls.auto.method "helm") }}
{{- $_ := include "hubble-generate-certs.helm.setup-ca" . -}}
{{- $cn := list "*" (.Values.cluster.name | replace "." "-") "hubble-grpc.cilium.io" | join "." }}
{{- $ip := .Values.hubble.tls.server.extraIpAddresses }}
{{- $dns := prepend .Values.hubble.tls.server.extraDnsNames $cn }}
{{- $cert := genSignedCert $cn $ip $dns (.Values.hubble.tls.auto.certValidityDuration | int) .ca -}}
---
apiVersion: v1
kind: Secret
metadata:
name: hubble-server-certs
namespace: {{ .Release.Namespace }}
{{- with .Values.hubble.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
ca.crt: {{ .ca.Cert | b64enc }}
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
{{- end }}
@@ -0,0 +1,21 @@
{{- if and .Values.hubble.enabled .Values.hubble.tls.enabled .Values.hubble.tls.auto.enabled (eq .Values.hubble.tls.auto.method "helm") .Values.hubble.ui.enabled .Values.hubble.relay.enabled .Values.hubble.relay.tls.server.enabled }}
{{- $_ := include "hubble-generate-certs.helm.setup-ca" . -}}
{{- $cn := "*.hubble-ui.cilium.io" }}
{{- $dns := list $cn }}
{{- $cert := genSignedCert $cn nil $dns (.Values.hubble.tls.auto.certValidityDuration | int) .ca -}}
---
apiVersion: v1
kind: Secret
metadata:
name: hubble-ui-client-certs
namespace: {{ .Release.Namespace }}
{{- with .Values.hubble.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
ca.crt: {{ .ca.Cert | b64enc }}
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
{{- end }}