From 1ccaa03fb237b52f6b5c6dff8b22825dbbc1dd5e Mon Sep 17 00:00:00 2001 From: Luiz Oliveira Date: Sun, 3 Sep 2023 20:18:43 -0300 Subject: [PATCH] :building_construction: Give the user ability to set ingress as needed (#1417) * Give the user hability to set ingress as needed - Removed unecessary IngressClass. - If no IngressClassName passed, use cluster's default class - Renamed `ingressclass` with `IngressClassName`. Is the standard name used for it. - Included custom annotations for Ingress. This way user can set any custom annotation for the ingress only. Signed-off-by: Luiz Oliveira * Update helm-chart/templates/11-ingress.yaml Co-authored-by: M. Mert Yildiran * Update config/configStructs/tapConfig.go Co-authored-by: M. Mert Yildiran * Update helm-chart/templates/11-ingress.yaml Co-authored-by: M. Mert Yildiran * update default ingressClassName value Signed-off-by: Luiz Oliveira --------- Signed-off-by: Luiz Oliveira Co-authored-by: M. Mert Yildiran --- config/configStructs/tapConfig.go | 7 +++---- helm-chart/templates/10-ingress-class.yaml | 16 ---------------- helm-chart/templates/11-ingress.yaml | 14 +++++++++----- helm-chart/values.yaml | 9 ++++----- 4 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 helm-chart/templates/10-ingress-class.yaml diff --git a/config/configStructs/tapConfig.go b/config/configStructs/tapConfig.go index a8d7ffbd3..116e80c77 100644 --- a/config/configStructs/tapConfig.go +++ b/config/configStructs/tapConfig.go @@ -88,11 +88,10 @@ type AuthConfig struct { type IngressConfig struct { Enabled bool `yaml:"enabled" json:"enabled" default:"false"` - ClassName string `yaml:"classname" json:"classname" default:"kubeshark-ingress-class"` - Controller string `yaml:"controller" json:"controller" default:"k8s.io/ingress-nginx"` + ClassName string `yaml:"classname" json:"classname" default:""` Host string `yaml:"host" json:"host" default:"ks.svc.cluster.local"` - TLS []networking.IngressTLS `yaml:"tls" json:"tls"` - CertManager string `yaml:"certmanager" json:"certmanager" default:"letsencrypt-prod"` + TLS []networking.IngressTLS `yaml:"tls" json:"tls" default:"[]"` + Annotations map[string]string `yaml:"annotations" json:"annotations" default:"{}"` } type ReleaseConfig struct { diff --git a/helm-chart/templates/10-ingress-class.yaml b/helm-chart/templates/10-ingress-class.yaml deleted file mode 100644 index c39da648f..000000000 --- a/helm-chart/templates/10-ingress-class.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -{{- if .Values.tap.ingress.enabled }} -apiVersion: networking.k8s.io/v1 -kind: IngressClass -metadata: - labels: - {{- include "kubeshark.labels" . | nindent 4 }} - annotations: - {{- if .Values.tap.annotations }} - {{- toYaml .Values.tap.annotations | nindent 4 }} - {{- end }} - name: kubeshark-ingress-class - namespace: {{ .Release.Namespace }} -spec: - controller: {{ .Values.tap.ingress.controller }} -{{- end }} diff --git a/helm-chart/templates/11-ingress.yaml b/helm-chart/templates/11-ingress.yaml index f87888695..0ee7c7f9b 100644 --- a/helm-chart/templates/11-ingress.yaml +++ b/helm-chart/templates/11-ingress.yaml @@ -4,17 +4,21 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: - certmanager.k8s.io/cluster-issuer: {{ .Values.tap.ingress.certmanager }} nginx.ingress.kubernetes.io/rewrite-target: /$2 - {{- if .Values.tap.annotations }} +{{- if .Values.tap.annotations }} {{- toYaml .Values.tap.annotations | nindent 4 }} +{{- end }} + {{- if .Values.tap.ingress.annotations }} + {{- toYaml .Values.tap.ingress.annotations | nindent 4 }} {{- end }} labels: {{- include "kubeshark.labels" . | nindent 4 }} name: kubeshark-ingress namespace: {{ .Release.Namespace }} spec: + {{- if .Values.tap.ingress.classname }} ingressClassName: {{ .Values.tap.ingress.classname }} + {{- end }} rules: - host: {{ .Values.tap.ingress.host }} http: @@ -24,17 +28,17 @@ spec: name: kubeshark-hub port: number: 80 - path: /api(/|$)(.*) + path: /api pathType: Prefix - backend: service: name: kubeshark-front port: number: 80 - path: /()(.*) + path: / pathType: Prefix + {{- if .Values.tap.ingress.tls }} tls: - {{- if gt (len .Values.tap.ingress.tls) 0}} {{- toYaml .Values.tap.ingress.tls | nindent 2 }} {{- end }} status: diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index b36ad2972..cd4ac35e9 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -28,12 +28,11 @@ tap: dryrun: false ignoretainted: false ingress: - certmanager: letsencrypt-prod - classname: kubeshark-ingress-class - controller: k8s.io/ingress-nginx enabled: false - host: ks.svc.cluster.local - tls: null + classname: "" + host: kubeshark.local + annotations: {} + tls: [] ipv6: true labels: {} namespaces: []