github.com/sealerio/sealer@v0.11.1-0.20240507115618-f4f89c5853ae/build/kubefile/parser/test/brigade-github-app/templates/ingress.yaml (about)

     1  # Copyright © 2022 Alibaba Group Holding Ltd.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  {{- if .Values.ingress.enabled -}}
    16  {{- $networkingApiIsStable := eq (include "networking.apiVersion.isStable" .) "true" -}}
    17  {{- $networkingApiSupportsIngressClassName := eq (include "networking.apiVersion.supportIngressClassName" .) "true" -}}
    18  {{- $serviceName := include "gateway.fullname" . -}}
    19  {{- $servicePort := .Values.service.externalPort -}}
    20  apiVersion: {{ template "networking.apiVersion" . }}
    21  kind: Ingress
    22  metadata:
    23    name: {{ template "gateway.fullname" . }}
    24    labels:
    25      app: {{ template "gateway.name" . }}
    26      chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    27      release: {{ .Release.Name }}
    28      heritage: {{ .Release.Service }}
    29    annotations:
    30      {{- range $key, $value := .Values.ingress.annotations }}
    31        {{ $key }}: {{ $value | quote }}
    32      {{- end }}
    33  spec:
    34    {{- if and (.Values.ingress.ingressClassName) ($networkingApiSupportsIngressClassName) }}
    35    ingressClassName: {{ .Values.ingress.ingressClassName }}
    36    {{- end }}
    37    rules:
    38      {{- range $host := .Values.ingress.hosts }}
    39      - host: {{ $host }}
    40        http:
    41          paths:
    42            {{- if $networkingApiIsStable }}
    43            - path: /
    44              pathType: Prefix
    45              backend:
    46                service:
    47                  name: {{ $serviceName }}
    48                  port:
    49                    number: {{ $servicePort }}
    50            {{- else }}
    51            - path: /
    52              backend:
    53                serviceName: {{ $serviceName }}
    54                servicePort: {{ $servicePort }}
    55            {{- end }}
    56      {{- end -}}
    57    {{- if .Values.ingress.tls }}
    58    tls:
    59  {{ toYaml .Values.ingress.tls | indent 4 }}
    60    {{- end -}}
    61  {{- end -}}