diff --git a/charts/gke-ingress-config/.helmignore b/charts/gke-ingress-config/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/charts/gke-ingress-config/.helmignore @@ -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/ diff --git a/charts/gke-ingress-config/Chart.yaml b/charts/gke-ingress-config/Chart.yaml new file mode 100644 index 0000000..4d7cba1 --- /dev/null +++ b/charts/gke-ingress-config/Chart.yaml @@ -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 diff --git a/charts/gke-ingress-config/templates/_helpers.tpl b/charts/gke-ingress-config/templates/_helpers.tpl new file mode 100644 index 0000000..6a92739 --- /dev/null +++ b/charts/gke-ingress-config/templates/_helpers.tpl @@ -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 -}} + diff --git a/charts/gke-ingress-config/templates/backendconfig.yaml b/charts/gke-ingress-config/templates/backendconfig.yaml new file mode 100644 index 0000000..f18f0e6 --- /dev/null +++ b/charts/gke-ingress-config/templates/backendconfig.yaml @@ -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 }} diff --git a/charts/gke-ingress-config/templates/frontendconfig.yaml b/charts/gke-ingress-config/templates/frontendconfig.yaml new file mode 100644 index 0000000..65b881c --- /dev/null +++ b/charts/gke-ingress-config/templates/frontendconfig.yaml @@ -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 }} diff --git a/charts/gke-ingress-config/values.yaml b/charts/gke-ingress-config/values.yaml new file mode 100644 index 0000000..e83ff01 --- /dev/null +++ b/charts/gke-ingress-config/values.yaml @@ -0,0 +1,11 @@ +namespaceOverride: "" +labels: [] +annotations: [] + +backendConfig: + enabled: false + spec: {} + +frontendConfig: + enabled: false + spec: {}