agones.dev/agones@v1.53.0/install/helm/agones/templates/_helpers.tpl (about)

     1  {*
     2   Copyright 2018 Google LLC All Rights Reserved.
     3  
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7  
     8       http://www.apache.org/licenses/LICENSE-2.0
     9  
    10   Unless required by applicable law or agreed to in writing, software
    11   distributed under the License is distributed on an "AS IS" BASIS,
    12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   See the License for the specific language governing permissions and
    14   limitations under the License.
    15  *}
    16  
    17  {{/* vim: set filetype=mustache: */}}
    18  {{/*
    19  Expand the name of the chart.
    20  */}}
    21  {{- define "agones.name" -}}
    22  {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
    23  {{- end -}}
    24  
    25  {{/*
    26  Create a default fully qualified app name.
    27  We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
    28  If release name contains chart name it will be used as a full name.
    29  */}}
    30  {{- define "agones.fullname" -}}
    31  {{- if .Values.fullnameOverride -}}
    32  {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
    33  {{- else -}}
    34  {{- $name := default .Chart.Name .Values.nameOverride -}}
    35  {{- if contains $name .Release.Name -}}
    36  {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
    37  {{- else -}}
    38  {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
    39  {{- end -}}
    40  {{- end -}}
    41  {{- end -}}
    42  
    43  {{/*
    44  Create chart name and version as used by the chart label.
    45  */}}
    46  {{- define "agones.chart" -}}
    47  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
    48  {{- end -}}
    49  
    50  {{/*
    51  Creates a YAML object representing known feature gates. Can then be used as:
    52    {{- $featureGates := include "agones.featureGates" . | fromYaml }}
    53  then you can check a feature gate with e.g. $featureGates.Example
    54  
    55  Implemented by intentionally duplicating YAML - later keys take precedence.
    56  So we start with defaultfeaturegates.yaml and then splat intentionally set
    57  feature gates. In the process, we validate that the feature gate is known.
    58  */}}
    59  {{- define "agones.featureGates" -}}
    60  {{- .Files.Get "defaultfeaturegates.yaml" -}}
    61  {{- if $.Values.agones.featureGates }}
    62  {{- $gates := .Files.Get "defaultfeaturegates.yaml" | fromYaml }}
    63  {{- range splitList "&" $.Values.agones.featureGates }}
    64  {{- $f := splitn "=" 2 . -}}
    65  {{- if hasKey $gates $f._0 }}
    66  {{$f._0}}: {{$f._1}}
    67  {{- else -}}
    68  {{- printf "Unknown feature gate %q" $f._0 | fail -}}
    69  {{- end -}}
    70  {{- end -}}
    71  {{- end -}}
    72  {{- end -}}