diff --git a/packages/apps/harbor/templates/httproute.yaml b/packages/apps/harbor/templates/httproute.yaml new file mode 100644 index 00000000..e231131d --- /dev/null +++ b/packages/apps/harbor/templates/httproute.yaml @@ -0,0 +1,58 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} +{{- $harborHost := .Values.host | default (printf "%s.%s" .Release.Name $host) }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: {{ .Release.Name }}-harbor + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: {{ $harborHost | quote }} + allowedRoutes: + namespaces: + from: Same + - name: https + protocol: HTTPS + port: 443 + hostname: {{ $harborHost | quote }} + tls: + mode: Terminate + certificateRefs: + - name: {{ .Release.Name }}-harbor-gateway-tls + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ .Release.Name }}-harbor +spec: + parentRefs: + - name: {{ .Release.Name }}-harbor + sectionName: https + hostnames: + - {{ $harborHost | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: {{ .Release.Name }} + port: 80 +{{- end }} diff --git a/packages/extra/bootbox/templates/matchbox/httproute.yaml b/packages/extra/bootbox/templates/matchbox/httproute.yaml new file mode 100644 index 00000000..759b099e --- /dev/null +++ b/packages/extra/bootbox/templates/matchbox/httproute.yaml @@ -0,0 +1,58 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} +{{- $bootboxHost := printf "bootbox.%s" (.Values.host | default $host) }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: bootbox + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: {{ $bootboxHost | quote }} + allowedRoutes: + namespaces: + from: Same + - name: https + protocol: HTTPS + port: 443 + hostname: {{ $bootboxHost | quote }} + tls: + mode: Terminate + certificateRefs: + - name: bootbox-gateway-tls + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: bootbox +spec: + parentRefs: + - name: bootbox + sectionName: https + hostnames: + - {{ $bootboxHost | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: bootbox + port: 8080 +{{- end }} diff --git a/packages/extra/seaweedfs/templates/tlsroute.yaml b/packages/extra/seaweedfs/templates/tlsroute.yaml new file mode 100644 index 00000000..a3c7b9c2 --- /dev/null +++ b/packages/extra/seaweedfs/templates/tlsroute.yaml @@ -0,0 +1,41 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (.Values.filer.grpcHost) }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: seaweedfs-filer +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: tls-passthrough + protocol: TLS + port: 443 + hostname: {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) | quote }} + tls: + mode: Passthrough + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1alpha2 +kind: TLSRoute +metadata: + name: seaweedfs-filer +spec: + parentRefs: + - name: seaweedfs-filer + sectionName: tls-passthrough + hostnames: + - {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) | quote }} + rules: + - backendRefs: + - name: {{ $.Release.Name }}-filer-external + port: 18888 +{{- end }} diff --git a/packages/system/bucket/templates/httproute.yaml b/packages/system/bucket/templates/httproute.yaml new file mode 100644 index 00000000..889818cd --- /dev/null +++ b/packages/system/bucket/templates/httproute.yaml @@ -0,0 +1,58 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} +{{- $bucketHost := printf "%s.%s" .Values.bucketName $host }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: {{ .Values.bucketName }}-ui + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: {{ $bucketHost | quote }} + allowedRoutes: + namespaces: + from: Same + - name: https + protocol: HTTPS + port: 443 + hostname: {{ $bucketHost | quote }} + tls: + mode: Terminate + certificateRefs: + - name: {{ .Values.bucketName }}-ui-gateway-tls + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ .Values.bucketName }}-ui +spec: + parentRefs: + - name: {{ .Values.bucketName }}-ui + sectionName: https + hostnames: + - {{ $bucketHost | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: {{ .Values.bucketName }}-ui + port: 8080 +{{- end }} diff --git a/packages/system/monitoring/templates/alerta/httproute.yaml b/packages/system/monitoring/templates/alerta/httproute.yaml new file mode 100644 index 00000000..85bbd968 --- /dev/null +++ b/packages/system/monitoring/templates/alerta/httproute.yaml @@ -0,0 +1,58 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} +{{- $alertaHost := printf "alerta.%s" (.Values.host | default $host) }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: alerta + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: {{ $alertaHost | quote }} + allowedRoutes: + namespaces: + from: Same + - name: https + protocol: HTTPS + port: 443 + hostname: {{ $alertaHost | quote }} + tls: + mode: Terminate + certificateRefs: + - name: alerta-gateway-tls + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: alerta +spec: + parentRefs: + - name: alerta + sectionName: https + hostnames: + - {{ $alertaHost | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: alerta + port: 80 +{{- end }} diff --git a/packages/system/monitoring/templates/grafana/httproute.yaml b/packages/system/monitoring/templates/grafana/httproute.yaml new file mode 100644 index 00000000..e380dcd3 --- /dev/null +++ b/packages/system/monitoring/templates/grafana/httproute.yaml @@ -0,0 +1,58 @@ +{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }} +{{- $clusterIssuer := (index .Values._cluster "issuer-name") | default "letsencrypt-prod" }} +{{- $gateway := .Values._namespace.gateway | default "" }} +{{- $host := .Values._namespace.host }} +{{- $grafanaHost := printf "grafana.%s" (.Values.host | default $host) }} + +{{- if and (eq $gatewayAPI "true") (ne $gateway "") }} +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: grafana + annotations: + cert-manager.io/cluster-issuer: {{ $clusterIssuer }} +spec: + gatewayClassName: cilium + infrastructure: + labels: + cozystack.io/gateway: {{ $gateway }} + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: {{ $grafanaHost | quote }} + allowedRoutes: + namespaces: + from: Same + - name: https + protocol: HTTPS + port: 443 + hostname: {{ $grafanaHost | quote }} + tls: + mode: Terminate + certificateRefs: + - name: grafana-gateway-tls + allowedRoutes: + namespaces: + from: Same +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: grafana +spec: + parentRefs: + - name: grafana + sectionName: https + hostnames: + - {{ $grafanaHost | quote }} + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: grafana-service + port: 3000 +{{- end }}