Skip to content

Commit 533ca3e

Browse files
authored
Merge pull request #151 from holaplex/mpw/gateway-certs
add deployment of self-signed certs on local dev
2 parents bcd22b5 + a862a8a commit 533ca3e

File tree

6 files changed

+109
-2
lines changed

6 files changed

+109
-2
lines changed

charts/hub-gateway/Chart.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ dependencies:
33
repository: https://charts.apiseven.com
44
version: 1.3.1
55
digest: sha256:f5e4c06ee49ce8bdf2ee3cf997ece55fb80071c8e122fad43197d9be8ddd32f3
6-
generated: "2023-04-22T00:12:14.986923-03:00"
6+
generated: "2023-10-03T03:02:45.699841-03:00"

charts/hub-gateway/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 0.23.10
21+
version: 0.24.0
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{- $domain := .Values.domain -}}
2+
{{- $devMode := .Values.certificates.devMode -}}
3+
{{- if .Values.certificates.deploy -}}
4+
apiVersion: cert-manager.io/v1
5+
kind: Certificate
6+
metadata:
7+
name: hub-domains
8+
namespace: ingress-apisix
9+
spec:
10+
dnsNames:
11+
{{- with .Values.routes }}
12+
{{- $usedHosts := "" -}}
13+
{{- range . }}
14+
{{- $currentHost := .host | default (printf "%s.%s" .subdomain $domain) | quote -}}
15+
{{- if not (contains $currentHost $usedHosts) }}
16+
- {{ $currentHost }}
17+
{{- $usedHosts = print $usedHosts $currentHost -}}
18+
{{- end }}
19+
{{- end }}
20+
{{- end }}
21+
issuerRef:
22+
kind: ClusterIssuer
23+
group: cert-manager.io
24+
{{- if $devMode }}
25+
name: selfsigned
26+
{{- else }}
27+
name: letsencrypt-prod
28+
{{- end }}
29+
{{- if $devMode }}
30+
isCA: true
31+
commonName: selfsigned-ca
32+
privateKey:
33+
algorithm: ECDSA
34+
size: 256
35+
{{- end }}
36+
secretName: hub-certificates
37+
usages:
38+
- digital signature
39+
- key encipherment
40+
duration: 2160h # 90d
41+
renewBefore: 360h # 15d
42+
{{- end }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- $namespace := .Values.hubNamespace -}}
2+
{{- $certEmail := .Values.certificates.email -}}
3+
{{- $devMode := .Values.certificates.devMode -}}
4+
{{- if $devMode }}
5+
apiVersion: cert-manager.io/v1
6+
kind: ClusterIssuer
7+
metadata:
8+
name: selfsigned
9+
spec:
10+
selfSigned: {}
11+
---
12+
apiVersion: cert-manager.io/v1
13+
kind: Issuer
14+
metadata:
15+
name: ca-issuer
16+
namespace: {{ $namespace }}
17+
spec:
18+
ca:
19+
secretName: hub-certificates
20+
{{- else }}
21+
apiVersion: cert-manager.io/v1
22+
kind: ClusterIssuer
23+
metadata:
24+
name: letsencrypt-prod
25+
spec:
26+
acme:
27+
server: https://acme-v02.api.letsencrypt.org/directory
28+
email: {{ $certEmail }}
29+
privateKeySecretRef:
30+
name: letsencrypt-prod
31+
solvers:
32+
- http01:
33+
ingress:
34+
class: apisix
35+
- http01:
36+
ingress:
37+
class: nginx
38+
{{- end }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- $domain := .Values.domain -}}
2+
{{- if .Values.certificates.deploy -}}
3+
apiVersion: apisix.apache.org/v2
4+
kind: ApisixTls
5+
metadata:
6+
name: hub-domains-tls
7+
spec:
8+
hosts:
9+
{{- with .Values.routes }}
10+
{{- $usedHosts := "" -}}
11+
{{- range . }}
12+
{{- $currentHost := .host | default (printf "%s.%s" .subdomain $domain) | quote -}}
13+
{{- if not (contains $currentHost $usedHosts) }}
14+
- {{ $currentHost }}
15+
{{- $usedHosts = print $usedHosts $currentHost -}}
16+
{{- end }}
17+
{{- end }}
18+
{{- end }}
19+
secret:
20+
name: hub-certificates
21+
namespace: ingress-apisix
22+
{{- end }}

charts/hub-gateway/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ internalService:
1515
networkPolicies:
1616
enabled: false
1717

18+
certificates:
19+
deploy: false
20+
devMode: true
21+
email: ""
22+
1823
routes:
1924
- name: api
2025
serviceName: federated-router

0 commit comments

Comments
 (0)