diff --git a/charts/testkube-cloud-ui/templates/ingress-redirect.yaml b/charts/testkube-cloud-ui/templates/ingress-redirect.yaml new file mode 100644 index 000000000..4647c437a --- /dev/null +++ b/charts/testkube-cloud-ui/templates/ingress-redirect.yaml @@ -0,0 +1,65 @@ +{{- if .Values.ingressRedirect.enabled -}} +{{- $fullName := include "testkube-cloud-ui.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }}-{{ .Values.global.redirectSubdomain }} + labels: + {{- include "testkube-cloud-ui.labels" . | nindent 4 }} + {{- if .Values.ingressRedirect.labels }} + {{- toYaml .Values.ingressRedirect.labels | nindent 4 }} + {{- end }} + annotations: + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + nginx.ingress.kubernetes.io/preserve-trailing-slash: "true" + nginx.ingress.kubernetes.io/configuration-snippet: | + add_header X-Frame-Options "sameorigin"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options nosniff; + add_header Referrer-Policy 'same-origin'; + add_header Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()"; + {{- if (eq .Values.global.certificateProvider "cert-manager") }} + cert-manager.io/cluster-issuer: {{ required ".Values.global.certManager.issuerRef must be provided if provider is cert-manager" .Values.global.certManager.issuerRef }} + {{- end }} + {{- with .Values.ingressRedirect.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + tls: + - hosts: + - {{ .Values.global.redirectSubdomain }}.{{ .Values.global.domain }} + secretName: "{{ .Values.ingress.tlsSecretName }}-{{ .Values.global.redirectSubdomain }}" + rules: + - host: {{ .Values.global.redirectSubdomain }}.{{ .Values.global.domain }} + http: + paths: + - path: / + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: Prefix + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + name: http + {{- else }} + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/charts/testkube-cloud-ui/values.yaml b/charts/testkube-cloud-ui/values.yaml index a469ce604..10856bff2 100644 --- a/charts/testkube-cloud-ui/values.yaml +++ b/charts/testkube-cloud-ui/values.yaml @@ -9,6 +9,8 @@ global: domain: "" # -- UI subdomain which get prepended to the domain uiSubdomain: "cloud" + # -- Different UI subdomain which gets prepended to the domain. May be used for the redirect from your actual uiSubdomain endpoint. Works is ingressRedirect option is enabled. + redirectSubdomain: "app" # -- TLS provider (possible values: "", "cert-manager") certificateProvider: "" certManager: @@ -92,6 +94,11 @@ ingress: provider: "cert-manager" # -- Hostname for which to create rules and TLS certificates host: "" +# -- Toggle whether to enable redirect Ingress which allows having a different subdomain redirecting to the actual Dashboard UI Ingress URL +ingressRedirect: + enabled: false + annotations: {} + labels: {} resources: requests: cpu: 50m diff --git a/charts/testkube-enterprise/values.yaml b/charts/testkube-enterprise/values.yaml index e9f7e1434..eecc3eaa5 100644 --- a/charts/testkube-enterprise/values.yaml +++ b/charts/testkube-enterprise/values.yaml @@ -17,6 +17,8 @@ global: domain: "" # -- UI subdomain which get prepended to the domain uiSubdomain: "dashboard" + # -- Different UI subdomain which gets prepended to the domain. May be used for the redirect from your actual uiSubdomain endpoint. Works is ingressRedirect option is enabled. + redirectSubdomain: "app" # -- REST API subdomain which get prepended to the domain restApiSubdomain: "api" # -- gRPC API subdomain which get prepended to the domain @@ -205,6 +207,9 @@ testkube-cloud-ui: ingress: # -- Name of the TLS secret which contains the certificate files tlsSecretName: testkube-enterprise-ui-tls + # -- Toggle whether to enable redirect Ingress which allows having a different subdomain redirecting to the actual Dashboard UI Ingress URL + ingressRedirect: + enabled: false ## NATS chart parameter ## For more configuration parameters of NATS chart please look here: https://docs.nats.io/running-a-nats-service/nats-kubernetes/helm-charts