Skip to content

Commit

Permalink
Add gke-ingress-config chart
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarsa committed Jun 9, 2021
1 parent 76f578c commit 64ef7c6
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 0 deletions.
22 changes: 22 additions & 0 deletions charts/gke-ingress-config/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
5 changes: 5 additions & 0 deletions charts/gke-ingress-config/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: 0.1.0
description: A simple chart to expose BackendConfig and FrontendConfig objects used by GKE for ingress customization.
name: gke-ingress-config
version: 0.1.0
60 changes: 60 additions & 0 deletions charts/gke-ingress-config/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "gke-ingress-config.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "gke-ingress-config.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "gke-ingress-config.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "gke-ingress-config.labels" -}}
app.kubernetes.io/name: {{ include "gke-ingress-config.name" . }}
helm.sh/chart: {{ include "gke-ingress-config.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.labels}}
{{ toYaml .Values.labels }}
{{- end }}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "gke-ingress-config.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

14 changes: 14 additions & 0 deletions charts/gke-ingress-config/templates/backendconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.backendConfig.enabled }}
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: {{ template "gke-ingress-config.fullname" . }}
namespace: {{ template "gke-ingress-config.namespace" . }}
labels:
{{ include "gke-ingress-config.labels" . | indent 4 }}
{{- if .Values.annotations }}
annotations:
{{- toYaml .Values.annotations | indent 4 }}
{{- end }}
spec: {{ .Values.backendConfig.spec }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/gke-ingress-config/templates/frontendconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.frontendConfig.enabled }}
apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
name: {{ template "gke-ingress-config.fullname" . }}
namespace: {{ template "gke-ingress-config.namespace" . }}
labels:
{{ include "gke-ingress-config.labels" . | indent 4 }}
{{- if .Values.annotations }}
annotations:
{{- toYaml .Values.annotations | indent 4 }}
{{- end }}
spec: {{ .Values.frontendConfig.spec }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/gke-ingress-config/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespaceOverride: ""
labels: []
annotations: []

backendConfig:
enabled: false
spec: {}

frontendConfig:
enabled: false
spec: {}

0 comments on commit 64ef7c6

Please sign in to comment.