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

     1  {{/* vim: set filetype=mustache */}}
     2  {{/*
     3  Expand the name of the chart.
     4  */}}
     5  {{- define "gateway.name" -}}
     6  {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
     7  {{- end -}}
     8  
     9  {{/*
    10  Create a default fully qualified app name.
    11  We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
    12  */}}
    13  {{- define "gateway.fullname" -}}
    14  {{- $name := default .Chart.Name .Values.nameOverride -}}
    15  {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
    16  {{- end -}}
    17  
    18  {{- define "gateway.rbac.version" }}rbac.authorization.k8s.io/v1{{ end -}}
    19  
    20  {{/*
    21  Return the appropriate apiVersion for a deployment.
    22  */}}
    23  {{- define "deployment.apiVersion" -}}
    24  {{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
    25  {{- print "extensions/v1beta1" -}}
    26  {{- else -}}
    27  {{- print "apps/v1" -}}
    28  {{- end -}}
    29  {{- end -}}
    30  
    31  {{/*
    32  Return the appropriate apiVersion for a networking object.
    33  */}}
    34  {{- define "networking.apiVersion" -}}
    35  {{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
    36  {{- print "extensions/v1beta1" -}}
    37  {{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}}
    38  {{- print "networking.k8s.io/v1beta1" -}}
    39  {{- else -}}
    40  {{- print "networking.k8s.io/v1" -}}
    41  {{- end -}}
    42  {{- end -}}
    43  
    44  {{- define "networking.apiVersion.isStable" -}}
    45    {{- eq (include "networking.apiVersion" .) "networking.k8s.io/v1" -}}
    46  {{- end -}}
    47  
    48  {{- define "networking.apiVersion.supportIngressClassName" -}}
    49    {{- semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
    50  {{- end -}}