Repository navigation
Expand file tree
/
Copy pathcert-manager-pki.yaml
More file actions
148 lines (147 loc) · 5.53 KB
/
Copy pathcert-manager-pki.yaml
File metadata and controls
148 lines (147 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
{{- if .Values.certManager.enabled }}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ include "openshell.issuerSelfSigned" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshell.labels" . | nindent 4 }}
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "openshell.fullname" . }}-ca
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshell.labels" . | nindent 4 }}
spec:
isCA: true
commonName: openshell-ca
secretName: {{ .Values.certManager.caSecretName | quote }}
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: {{ include "openshell.issuerSelfSigned" . }}
kind: Issuer
group: cert-manager.io
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ include "openshell.fullname" . }}-ca-issuer
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshell.labels" . | nindent 4 }}
spec:
ca:
secretName: {{ .Values.certManager.caSecretName | quote }}
---
{{- $externalServerIssuer := .Values.certManager.serverIssuerRef.name }}
{{- if $externalServerIssuer }}
{{- range .Values.certManager.serverDnsNames }}
{{- /* Single-label names (e.g. "openshell") are also rejected by ACME CAs but are intentionally not checked here — the guard targets recognisable internal-network patterns. */ -}}
{{- if or (eq . "localhost") (hasSuffix ".localhost" .) (hasSuffix ".svc.cluster.local" .) (hasSuffix ".svc" .) (eq . "host.docker.internal") (eq . "host.containers.internal") }}
{{- fail (printf "certManager.serverIssuerRef.name is set (external issuer) but certManager.serverDnsNames contains %q — external CAs (e.g. ACME / Let's Encrypt) reject internal-only names per CA/Browser Forum baseline requirements. Override certManager.serverDnsNames with your externally-resolvable hostname(s)." .) }}
{{- end }}
{{- end }}
{{- end }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "openshell.fullname" . }}-server
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshell.labels" . | nindent 4 }}
spec:
secretName: {{ .Values.server.tls.certSecretName | quote }}
duration: {{ .Values.certManager.certificateDuration | quote }}
renewBefore: {{ .Values.certManager.certificateRenewBefore | quote }}
{{- if $externalServerIssuer }}
# External issuers (e.g. ACME) reject internal-only names (cluster-local,
# localhost, loopback IPs) per CA/Browser Forum baseline requirements, and
# require any commonName to also appear in dnsNames. Only request the
# externally-resolvable SANs the operator configured — no defaults, no IPs.
{{- if .Values.certManager.serverDnsNames }}
commonName: {{ first .Values.certManager.serverDnsNames | quote }}
{{- end }}
dnsNames:
{{- range .Values.certManager.serverDnsNames }}
- {{ . | quote }}
{{- end }}
{{- else }}
# The chart fullname is always the first entry of defaultServerDnsNames
# below, so it's always valid as a commonName.
#
# Upgrade note: this replaces the previously-hardcoded "openshell-server"
# commonName. The ACME commonName-must-be-a-SAN constraint this exists for
# only applies to the external-issuer branch above, but this branch was
# changed too for consistency. Existing self-signed/internal-CA deployments
# will get a new server cert with a different Subject CN on next reissue
# after upgrading — SAN-based hostname verification (what TLS clients
# actually check) is unaffected.
commonName: {{ include "openshell.fullname" . }}
dnsNames:
{{- range (include "openshell.defaultServerDnsNames" . | fromYamlArray) }}
- {{ . | quote }}
{{- end }}
{{- range .Values.certManager.serverDnsNames }}
- {{ . | quote }}
{{- end }}
{{- if .Values.certManager.serverIpAddresses }}
ipAddresses:
{{- toYaml .Values.certManager.serverIpAddresses | nindent 4 }}
{{- end }}
{{- end }}
privateKey:
algorithm: ECDSA
size: 256
usages:
- server auth
- digital signature
- key encipherment
issuerRef:
{{- if .Values.certManager.serverIssuerRef.name }}
name: {{ .Values.certManager.serverIssuerRef.name }}
kind: {{ .Values.certManager.serverIssuerRef.kind | default "ClusterIssuer" }}
group: {{ .Values.certManager.serverIssuerRef.group | default "cert-manager.io" }}
{{- else }}
name: {{ include "openshell.fullname" . }}-ca-issuer
kind: Issuer
group: cert-manager.io
{{- end }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "openshell.fullname" . }}-client
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshell.labels" . | nindent 4 }}
spec:
secretName: {{ .Values.server.tls.clientTlsSecretName | quote }}
duration: {{ .Values.certManager.certificateDuration | quote }}
renewBefore: {{ .Values.certManager.certificateRenewBefore | quote }}
commonName: openshell-client
privateKey:
algorithm: ECDSA
size: 256
usages:
- client auth
- digital signature
- key encipherment
issuerRef:
{{- if .Values.certManager.clientIssuerRef.name }}
name: {{ .Values.certManager.clientIssuerRef.name }}
kind: {{ .Values.certManager.clientIssuerRef.kind | default "ClusterIssuer" }}
group: {{ .Values.certManager.clientIssuerRef.group | default "cert-manager.io" }}
{{- else }}
name: {{ include "openshell.fullname" . }}-ca-issuer
kind: Issuer
group: cert-manager.io
{{- end }}
{{- end }}