Skip to content

Commit

Permalink
fix: add back CLI ingress (#962)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 authored Nov 12, 2024
1 parent 1f91f8f commit f1cf530
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/testkube-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ A Helm chart for Testkube api
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| cdeventsTarget | string | `""` | |
| cliIngress.annotations | object | `{}` | |
| cliIngress.enabled | bool | `false` | |
| cliIngress.hosts | list | `[]` | |
| cliIngress.labels | object | `{}` | |
| cliIngress.path | string | `"/results/(v\\d/.*)"` | |
| cliIngress.tls | list | `[]` | |
| cliIngress.tlsenabled | bool | `false` | |
| cloud.envId | string | `""` | |
| cloud.existingSecret.envId | string | `""` | |
| cloud.existingSecret.key | string | `""` | |
Expand Down
58 changes: 58 additions & 0 deletions charts/testkube-api/templates/cli-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Values.cliIngress.enabled -}}
apiVersion: {{ include "global.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: cli-{{ include "testkube-api.fullname" $ }}-{{ .Release.Name }}
labels:
{{- include "testkube-api.labels" . | nindent 4 }}
{{- if .Values.cliIngress.labels }}
{{- include "global.tplvalues.render" ( dict "value" .Values.cliIngress.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.global.labels }}
{{- include "global.tplvalues.render" ( dict "value" .Values.global.labels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if and .Values.cliIngress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.Version)) }}
kubernetes.io/ingress.class: {{ .Values.cliIngress.className }}
{{- end }}
{{- if .Values.cliIngress.annotations }}
{{- include "global.tplvalues.render" (dict "value" .Values.cliIngress.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.global.annotations }}
{{- include "global.tplvalues.render" ( dict "value" .Values.global.annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.cliIngress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.Version) }}
ingressClassName: {{ .Values.cliIngress.className }}
{{- end }}
{{- if .Values.cliIngress.tls }}
tls:
{{- if .Values.cliIngress.tlsenabled }}
{{- range .Values.cliIngress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- end }}
rules:
{{- range .Values.cliIngress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: {{ $.Values.cliIngress.path }}
pathType: Prefix
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.Version }}
service:
name: {{ include "testkube-api.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- else }}
serviceName: {{ include "testkube-api.fullname" $ }}
servicePort: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/testkube-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,26 @@ uiIngress:
# - testkube.example.com
# secretName: testkube-cert-secret

## cliIngress parameters
cliIngress:
## Use cliIngress
enabled: false
## Labels to add to the Ingress
labels: {}
## Annotations to add to the Ingress
annotations: {}
## The Path to Nginx.
path: /results/(v\d/.*)
## Hostnames must be provided if Ingress is enabled.
hosts: []
# - testkube.example.com
tlsenabled: false
# Placing a host in the TLS config will indicate a certificate should be created
tls: []
# - hosts:
# - testkube.example.com
# secretName: testkube-cert-secret

## Prometheus monitoring
prometheus:
## Toggle whether to install ServiceMonitor
Expand Down
6 changes: 6 additions & 0 deletions charts/testkube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ kubectl label --overwrite crds scripts.tests.testkube.io app.kubernetes.io/manag
| testkube-api.additionalVolumes | list | `[]` | Additional volumes to be added |
| testkube-api.analyticsEnabled | bool | `true` | Enable analytics for Testkube |
| testkube-api.cdeventsTarget | string | `""` | target for cdevents emission via http(s) |
| testkube-api.cliIngress.annotations | object | `{}` | Additional annotations for the Ingress resource. |
| testkube-api.cliIngress.enabled | bool | `false` | Use ingress |
| testkube-api.cliIngress.hosts | list | `["testkube.example.com"]` | Hostnames must be provided if Ingress is enabled. |
| testkube-api.cliIngress.path | string | `"/results/(v\\d/.*)"` | |
| testkube-api.cliIngress.tls | list | `[]` | Placing a host in the TLS config will indicate a certificate should be created |
| testkube-api.cliIngress.tlsenabled | bool | `false` | Toggle whether to enable TLS on the ingress |
| testkube-api.cloud.key | string | `""` | Testkube Clouc License Key (for Environment) |
| testkube-api.cloud.tls.certificate.caFile | string | `"/tmp/agent-cert/ca.crt"` | Default path for ca file |
| testkube-api.cloud.tls.certificate.certFile | string | `"/tmp/agent-cert/cert.crt"` | Default path for certificate file |
Expand Down
29 changes: 29 additions & 0 deletions charts/testkube/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,35 @@ testkube-api:
# - testkube.example.com
# secretName: testkube-cert-secret

# cliIngress parameters
cliIngress:
# -- Use ingress
enabled: false
# -- Additional annotations for the Ingress resource.
annotations: {}
# e.g. annotations for NGINX Ingress Controller:
# kubernetes.io/ingress.class: nginx
# nginx.ingress.kubernetes.io/rewrite-target: /$1
# nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
# nginx.ingress.kubernetes.io/ssl-redirect: "false"
# nginx.ingress.kubernetes.io/configuration-snippet: |
# more_set_headers "X-CLI-Ingress: true";
# for websockets
# nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
# nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
path: /results/(v\d/.*)
# -- Hostnames must be provided if Ingress is enabled.
hosts:
- testkube.example.com
# -- Toggle whether to enable TLS on the ingress
tlsenabled: false
# -- Placing a host in the TLS config will indicate a certificate should be created
tls:
[]
# - hosts:
# - testkube.example.com
# secretName: testkube-cert-secret

# Storage for Testkube API using MinIO
storage:
# -- MinIO endpoint
Expand Down

0 comments on commit f1cf530

Please sign in to comment.