github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/helm/trivy/templates/ingress.yaml (about) 1 {{- if .Values.ingress.enabled -}} 2 {{- $fullName := include "trivy.fullname" . -}} 3 {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }} 4 apiVersion: networking.k8s.io/v1 5 {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }} 6 apiVersion: networking.k8s.io/v1beta1 7 {{- else }} 8 apiVersion: extensions/v1beta1 9 {{- end }} 10 kind: Ingress 11 metadata: 12 name: {{ include "trivy.fullname" . }} 13 namespace: {{ .Release.Namespace }} 14 labels: 15 {{ include "trivy.labels" . | indent 4 }} 16 {{- with .Values.ingress.annotations }} 17 annotations: 18 {{- toYaml . | nindent 4 }} 19 {{- end }} 20 spec: 21 {{- if and (.Values.ingress.ingressClassName) (semverCompare ">= v1.18.0" .Capabilities.KubeVersion.Version) }} 22 ingressClassName: {{ .Values.ingress.ingressClassName }} 23 {{- end }} 24 {{- if .Values.ingress.tls }} 25 tls: 26 {{- range .Values.ingress.tls }} 27 - hosts: 28 {{- range .hosts }} 29 - {{ . | quote }} 30 {{- end }} 31 secretName: {{ .secretName }} 32 {{- end }} 33 {{- end }} 34 rules: 35 {{- range .Values.ingress.hosts }} 36 - host: {{ .host | quote }} 37 http: 38 paths: 39 - path: {{ $.Values.ingress.path }} 40 {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }} 41 pathType: {{ $.Values.ingress.pathType }} 42 backend: 43 service: 44 name: {{ $fullName }} 45 port: 46 number: {{ $.Values.service.port -}} 47 {{- else }} 48 backend: 49 serviceName: {{ $fullName }} 50 servicePort: {{ $.Values.service.port -}} 51 {{- end }} 52 {{- end }} 53 {{- end }}