Skip to content

Commit b8de0d0

Browse files
committed
[platform] Introduce expose-services and expose-ingress options
Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 29b4949 commit b8de0d0

15 files changed

Lines changed: 110 additions & 161 deletions

File tree

‎hack/e2e.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ if ! kubectl wait --timeout=2m --for=condition=ready -n tenant-root hr monitorin
334334
kubectl wait --timeout=2m --for=condition=ready -n tenant-root hr monitoring
335335
fi
336336

337-
kubectl patch -n tenant-root ingresses.apps.cozystack.io ingress --type=merge -p '{"spec":{
338-
"dashboard": true
337+
kubectl patch -n cozy-system cm cozystack --type=merge -p '{"data":{
338+
"expose-services": "api,dashboard,cdi-uploadproxy,vm-exportproxy,keycloak"
339339
}}'
340340

341341
# Wait for nginx-ingress-controller

‎packages/extra/ingress/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: ingress
33
description: NGINX Ingress Controller
44
icon: /logos/ingress-nginx.svg
55
type: application
6-
version: 1.5.1
6+
version: 1.6.0

‎packages/extra/ingress/README.md‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44

55
### Common parameters
66

7-
| Name | Description | Value |
8-
| ----------------- | ----------------------------------------------------------------- | ------- |
9-
| `replicas` | Number of ingress-nginx replicas | `2` |
10-
| `externalIPs` | List of externalIPs for service. | `[]` |
11-
| `whitelist` | List of client networks | `[]` |
12-
| `clouflareProxy` | Restoring original visitor IPs when Cloudflare proxied is enabled | `false` |
13-
| `dashboard` | Should ingress serve Cozystack service dashboard | `false` |
14-
| `cdiUploadProxy` | Should ingress serve CDI upload proxy | `false` |
15-
| `virtExportProxy` | Should ingress serve KubeVirt export proxy | `false` |
7+
| Name | Description | Value |
8+
| ---------------- | ----------------------------------------------------------------- | ------- |
9+
| `replicas` | Number of ingress-nginx replicas | `2` |
10+
| `externalIPs` | List of externalIPs for service. | `[]` |
11+
| `whitelist` | List of client networks | `[]` |
12+
| `clouflareProxy` | Restoring original visitor IPs when Cloudflare proxied is enabled | `false` |
1613

‎packages/extra/ingress/templates/cdi-uploadproxy.yaml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎packages/extra/ingress/values.schema.json‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@
2525
"type": "boolean",
2626
"description": "Restoring original visitor IPs when Cloudflare proxied is enabled",
2727
"default": false
28-
},
29-
"dashboard": {
30-
"type": "boolean",
31-
"description": "Should ingress serve Cozystack service dashboard",
32-
"default": false
33-
},
34-
"cdiUploadProxy": {
35-
"type": "boolean",
36-
"description": "Should ingress serve CDI upload proxy",
37-
"default": false
38-
},
39-
"virtExportProxy": {
40-
"type": "boolean",
41-
"description": "Should ingress serve KubeVirt export proxy",
42-
"default": false
4328
}
4429
}
4530
}

‎packages/extra/ingress/values.yaml‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,3 @@ whitelist: []
2424

2525
## @param clouflareProxy Restoring original visitor IPs when Cloudflare proxied is enabled
2626
clouflareProxy: false
27-
28-
## @param dashboard Should ingress serve Cozystack service dashboard
29-
dashboard: false
30-
31-
## @param cdiUploadProxy Should ingress serve CDI upload proxy
32-
cdiUploadProxy: false
33-
34-
## @param virtExportProxy Should ingress serve KubeVirt export proxy
35-
virtExportProxy: false

‎packages/extra/ingress/vm-exportproxy.yaml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎packages/extra/versions_map‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ingress 1.2.0 28fca4ef
1919
ingress 1.3.0 fde4bcfa
2020
ingress 1.4.0 fd240701
2121
ingress 1.5.0 93bdf411
22-
ingress 1.5.1 HEAD
22+
ingress 1.6.0 HEAD
2323
monitoring 1.0.0 d7cfa53c
2424
monitoring 1.1.0 25221fdc
2525
monitoring 1.2.0 f81be075
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
2+
{{- $host := index $cozyConfig.data "root-host" }}
3+
{{- $exposeServices := splitList "," ((index $cozyConfig.data "expose-services") | default "") }}
4+
{{- $exposeIngress := index $cozyConfig.data "expose-ingress" | default "tenant-root" }}
5+
6+
{{- if and (has "api" $exposeServices) }}
7+
apiVersion: networking.k8s.io/v1
8+
kind: Ingress
9+
metadata:
10+
annotations:
11+
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
12+
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
13+
name: kubernetes
14+
namespace: default
15+
spec:
16+
ingressClassName: {{ $exposeIngress }}
17+
rules:
18+
- host: api.{{ $host }}
19+
http:
20+
paths:
21+
- backend:
22+
service:
23+
name: kubernetes
24+
port:
25+
number: 443
26+
path: /
27+
pathType: Prefix
28+
{{- end }}
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,27 @@
11
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
22
{{- $issuerType := (index $cozyConfig.data "clusterissuer") | default "http01" }}
3+
{{- $host := index $cozyConfig.data "root-host" }}
4+
{{- $exposeServices := splitList "," ((index $cozyConfig.data "expose-services") | default "") }}
5+
{{- $exposeIngress := index $cozyConfig.data "expose-ingress" | default "tenant-root" }}
36

4-
{{- $myNS := lookup "v1" "Namespace" "" .Release.Namespace }}
5-
{{- $host := index $myNS.metadata.annotations "namespace.cozystack.io/host" }}
6-
7-
{{- $tenantRoot := dict }}
8-
{{- if .Capabilities.APIVersions.Has "helm.toolkit.fluxcd.io/v2" }}
9-
{{- $tenantRoot = lookup "helm.toolkit.fluxcd.io/v2" "HelmRelease" "tenant-root" "tenant-root" }}
10-
{{- end }}
11-
{{- if and $tenantRoot $tenantRoot.spec $tenantRoot.spec.values $tenantRoot.spec.values.host }}
12-
{{- $host = $tenantRoot.spec.values.host }}
13-
{{- else }}
14-
{{- end }}
15-
16-
{{- if .Values.dashboard }}
7+
{{- if and (has "dashboard" $exposeServices) }}
178
apiVersion: networking.k8s.io/v1
189
kind: Ingress
1910
metadata:
2011
annotations:
2112
cert-manager.io/cluster-issuer: letsencrypt-prod
2213
{{- if eq $issuerType "cloudflare" }}
2314
{{- else }}
24-
acme.cert-manager.io/http01-ingress-class: {{ .Release.Namespace }}
15+
acme.cert-manager.io/http01-ingress-class: {{ $exposeIngress }}
16+
{{- end }}
2517
nginx.ingress.kubernetes.io/proxy-body-size: 100m
2618
nginx.ingress.kubernetes.io/proxy-buffer-size: 100m
2719
nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
2820
nginx.ingress.kubernetes.io/client-max-body-size: 100m
29-
{{- end }}
30-
name: dashboard-{{ .Release.Namespace }}
21+
name: dashboard
3122
namespace: cozy-dashboard
3223
spec:
33-
ingressClassName: {{ .Release.Namespace }}
24+
ingressClassName: {{ $exposeIngress }}
3425
rules:
3526
- host: dashboard.{{ $host }}
3627
http:
@@ -45,5 +36,5 @@ spec:
4536
tls:
4637
- hosts:
4738
- dashboard.{{ $host }}
48-
secretName: dashboard-{{ .Release.Namespace }}-tls
39+
secretName: dashboard-tls
4940
{{- end }}

0 commit comments

Comments
 (0)