github.com/sealerio/sealer@v0.11.1-0.20240507115618-f4f89c5853ae/build/layerutils/charts/testcharts/apps/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  {{- $fullName := include "apps.fullname" . -}}
    17  {{- $svcPort := .Values.service.port -}}
    18  {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
    19  apiVersion: networking.k8s.io/v1beta1
    20  {{- else -}}
    21  apiVersion: extensions/v1beta1
    22  {{- end }}
    23  kind: Ingress
    24  metadata:
    25    name: {{ $fullName }}
    26    labels:
    27      {{- include "apps.labels" . | nindent 4 }}
    28    {{- with .Values.ingress.annotations }}
    29    annotations:
    30      {{- toYaml . | nindent 4 }}
    31    {{- end }}
    32  spec:
    33    {{- if .Values.ingress.tls }}
    34    tls:
    35      {{- range .Values.ingress.tls }}
    36      - hosts:
    37          {{- range .hosts }}
    38          - {{ . | quote }}
    39          {{- end }}
    40        secretName: {{ .secretName }}
    41      {{- end }}
    42    {{- end }}
    43    rules:
    44      {{- range .Values.ingress.hosts }}
    45      - host: {{ .host | quote }}
    46        http:
    47          paths:
    48            {{- range .paths }}
    49            - path: {{ . }}
    50              backend:
    51                serviceName: {{ $fullName }}
    52                servicePort: {{ $svcPort }}
    53            {{- end }}
    54      {{- end }}
    55    {{- end }}