From 3ed659a05baf83be413ab21636abfdab8e0513dc Mon Sep 17 00:00:00 2001 From: Thomas Wessner Date: Fri, 12 Apr 2024 09:35:25 +0200 Subject: [PATCH] [feat]: enable host aliases in common chart Signed-off-by: Thomas Wessner --- charts/common/Chart.yaml | 2 +- charts/common/README.md | 2 +- charts/common/ci/values.test.yaml | 39 ++++++++++++++++++++++++++++++- charts/common/templates/_pod.yaml | 7 ++++++ charts/common/values.schema.json | 18 ++++++++++++++ charts/common/values.yaml | 4 ++++ 6 files changed, 69 insertions(+), 3 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 7162458e..f02b0048 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 10.11.0 +version: 10.11.1 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives diff --git a/charts/common/README.md b/charts/common/README.md index c77465f7..d4915d86 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 10.11.0](https://img.shields.io/badge/Version-10.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 10.11.1](https://img.shields.io/badge/Version-10.11.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts diff --git a/charts/common/ci/values.test.yaml b/charts/common/ci/values.test.yaml index 00ed7eb6..1f779c3f 100644 --- a/charts/common/ci/values.test.yaml +++ b/charts/common/ci/values.test.yaml @@ -80,7 +80,15 @@ components: controller: deploy: true type: "Deployment" - + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "foo.local" + - "bar.local" + - ip: "10.1.2.3" + hostnames: + - "foo.remote" + - "bar.remote" containers: container-1: image: @@ -208,6 +216,15 @@ components: volumeAttributes: secretProviderClass: "azure-kvname" + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "foo.local" + - "bar.local" + - ip: "10.1.2.3" + hostnames: + - "foo.remote" + - "bar.remote" containers: container-1: image: @@ -285,6 +302,16 @@ components: runAsNonRoot: true runAsUser: 1001 + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "foo.local" + - "bar.local" + - ip: "10.1.2.3" + hostnames: + - "foo.remote" + - "bar.remote" + # start containers # dictionary of containers in a pod containers: @@ -345,6 +372,16 @@ components: runAsNonRoot: true runAsUser: 1001 + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "foo.local" + - "bar.local" + - ip: "10.1.2.3" + hostnames: + - "foo.remote" + - "bar.remote" + # start containers # dictionary of containers in a pod containers: diff --git a/charts/common/templates/_pod.yaml b/charts/common/templates/_pod.yaml index f3386296..b2c53e5f 100644 --- a/charts/common/templates/_pod.yaml +++ b/charts/common/templates/_pod.yaml @@ -19,6 +19,13 @@ Distinguish between sensitive and non-sensitive config, first initialize empty d {{- end }} {{- end }} +{{- if $controllerValues.hostAliases }} +hostAliases: + {{- with $controllerValues.hostAliases }} + {{- toYaml . | nindent 2 }} + {{- end -}} +{{- end }} + {{- if $controllerValues.serviceAccountName }} serviceAccountName: {{ $controllerValues.serviceAccountName | quote }} {{- end }} diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index 1582f045..2d9076c7 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -1090,6 +1090,24 @@ ] } }, + "hostAliases": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ip": { + "type": "string" + }, + "hostnames": { + "type": "array" + } + }, + "required": [ + "ip", + "hostnames" + ] + } + }, "containers": { "type": "object", "patternProperties": { diff --git a/charts/common/values.yaml b/charts/common/values.yaml index dee59cfe..f1a9ea45 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -499,6 +499,10 @@ components: # END ONLY FOR CSI # end pod + # hostAliases defines host names for IP addresses + # see also https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/#adding-additional-entries-with-hostaliases + # hostAliases: {} + # start containers # dictionary of containers in a pod containers: {}