1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] CertManager Integration (#1778)

This commit is contained in:
Adam Janikowski 2024-12-09 14:04:26 +01:00 committed by GitHub
parent 6f713a85e9
commit c7cce48584
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 396 additions and 2 deletions

View file

@ -31,6 +31,7 @@
- (Feature) (Networking) Pass through Server Header
- (Feature) (Platform) Shutdown migration to CE
- (Feature) (Scheduler) Shutdown Integration
- (Feature) CertManager Integration
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
- (Feature) ArangoRoute CRD

View file

@ -0,0 +1,22 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
duration: {{ .Values.certificate.ca.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}-ca
commonName: {{ .Values.certificate.ca.commonName }}
isCA: true
{{- end }}

View file

@ -0,0 +1,24 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-cert
duration: {{ .Values.certificate.cert.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}
dnsNames:
- {{ template "kube-arangodb.operatorName" . }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}.svc
{{- end }}

View file

@ -0,0 +1,17 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
selfSigned: {}
{{- end }}

View file

@ -0,0 +1,18 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
ca:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
{{- end }}

View file

@ -93,6 +93,10 @@ spec:
image: {{ .Values.operator.image }}
args:
- --scope={{ .Values.operator.scope }}
{{- if .Values.certificate.enabled }}
- --server.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
- --api.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
{{- end -}}
{{- if .Values.operator.features.deployment }}
- --operator.deployment
{{- end -}}

View file

@ -44,3 +44,10 @@ rbac:
acs: true
at: true
debug: false
certificate:
enabled: false
ca:
duration: 43800h
commonName: "kube-arangodb.operator.cert"
cert:
duration: 8760h

View file

@ -0,0 +1,22 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
duration: {{ .Values.certificate.ca.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}-ca
commonName: {{ .Values.certificate.ca.commonName }}
isCA: true
{{- end }}

View file

@ -0,0 +1,24 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-cert
duration: {{ .Values.certificate.cert.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}
dnsNames:
- {{ template "kube-arangodb.operatorName" . }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}.svc
{{- end }}

View file

@ -0,0 +1,17 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
selfSigned: {}
{{- end }}

View file

@ -0,0 +1,18 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
ca:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
{{- end }}

View file

@ -93,6 +93,10 @@ spec:
image: {{ .Values.operator.image }}
args:
- --scope={{ .Values.operator.scope }}
{{- if .Values.certificate.enabled }}
- --server.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
- --api.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
{{- end -}}
{{- if .Values.operator.features.deployment }}
- --operator.deployment
{{- end -}}

View file

@ -44,3 +44,10 @@ rbac:
acs: true
at: true
debug: false
certificate:
enabled: false
ca:
duration: 43800h
commonName: "kube-arangodb.operator.cert"
cert:
duration: 8760h

View file

@ -0,0 +1,22 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
duration: {{ .Values.certificate.ca.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}-ca
commonName: {{ .Values.certificate.ca.commonName }}
isCA: true
{{- end }}

View file

@ -0,0 +1,24 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-cert
duration: {{ .Values.certificate.cert.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}
dnsNames:
- {{ template "kube-arangodb.operatorName" . }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}.svc
{{- end }}

View file

@ -0,0 +1,17 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
selfSigned: {}
{{- end }}

View file

@ -0,0 +1,18 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
ca:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
{{- end }}

View file

@ -93,6 +93,10 @@ spec:
image: {{ .Values.operator.image }}
args:
- --scope={{ .Values.operator.scope }}
{{- if .Values.certificate.enabled }}
- --server.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
- --api.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
{{- end -}}
{{- if .Values.operator.features.deployment }}
- --operator.deployment
{{- end -}}

View file

@ -44,3 +44,10 @@ rbac:
acs: true
at: true
debug: false
certificate:
enabled: false
ca:
duration: 43800h
commonName: "kube-arangodb.operator.cert"
cert:
duration: 8760h

View file

@ -0,0 +1,22 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
duration: {{ .Values.certificate.ca.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}-ca
commonName: {{ .Values.certificate.ca.commonName }}
isCA: true
{{- end }}

View file

@ -0,0 +1,24 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
secretName: {{ template "kube-arangodb.operatorName" . }}-cert
duration: {{ .Values.certificate.cert.duration }}
issuerRef:
name: {{ template "kube-arangodb.operatorName" . }}
dnsNames:
- {{ template "kube-arangodb.operatorName" . }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}
- {{ template "kube-arangodb.operatorName" . }}.{{ .Release.Namespace }}.svc
{{- end }}

View file

@ -0,0 +1,17 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
selfSigned: {}
{{- end }}

View file

@ -0,0 +1,18 @@
{{ if .Values.certificate.enabled -}}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ template "kube-arangodb.operatorName" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
release: {{ .Release.Name }}
spec:
ca:
secretName: {{ template "kube-arangodb.operatorName" . }}-ca
{{- end }}

View file

@ -93,6 +93,10 @@ spec:
image: {{ .Values.operator.image }}
args:
- --scope={{ .Values.operator.scope }}
{{- if .Values.certificate.enabled }}
- --server.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
- --api.tls-secret-name={{ template "kube-arangodb.operatorName" . }}-cert
{{- end -}}
{{- if .Values.operator.features.deployment }}
- --operator.deployment
{{- end -}}

View file

@ -45,3 +45,10 @@ rbac:
acs: true
at: true
debug: false
certificate:
enabled: false
ca:
duration: 43800h
commonName: "kube-arangodb.operator.cert"
cert:
duration: 8760h

View file

@ -130,6 +130,31 @@ Define if RBAC should be enabled.
Default: `true`
### `certificate.enabled`
Define if Cert via CertManager should be enabled.
Default: `false`
### `certificate.ca.duration`
CA Duration.
Default: `43800h`
### `certificate.ca.commonName`
CA CommonName.
Default: `kube-arangodb.operator.cert`
### `certificate.cert.duration`
Cert Duration.
Default: `8760h`
## Alternate namespaces
The `kube-arangodb` chart supports deployment into a non-default namespace.

View file

@ -110,7 +110,7 @@ func NewServer(cli typedCore.CoreV1Interface, cfg Config, deps Dependencies) (*S
var cert, key string
if cfg.TLSSecretName != "" && cfg.TLSSecretNamespace != "" {
// Load TLS certificate from secret
serverLogger.Str("addr", cfg.Address).Str("secret", cfg.TLSSecretName).Str("secret-namespace", cfg.TLSSecretNamespace).Info("Using existing TLS Certificate")
s, err := cli.Secrets(cfg.TLSSecretNamespace).Get(context.Background(), cfg.TLSSecretName, meta.GetOptions{})
if err != nil {
return nil, errors.WithStack(err)
@ -126,7 +126,7 @@ func NewServer(cli typedCore.CoreV1Interface, cfg Config, deps Dependencies) (*S
cert = string(certBytes)
key = string(keyBytes)
} else {
// Secret not specified, create our own TLS certificate
serverLogger.Str("addr", cfg.Address).Info("Using SelfSigned TLS Certificate")
options := certificates.CreateCertificateOptions{
CommonName: cfg.PodName,
Hosts: []string{cfg.PodName, cfg.PodIP},