Skip to content

Commit

Permalink
Merge pull request #130 from bedag/feat/enable-setting-hostaliases-in…
Browse files Browse the repository at this point in the history
…-common

[common]: enable host aliases in common chart
  • Loading branch information
wthhub authored Apr 18, 2024
2 parents 603d8c8 + 0bacd0b commit 8342aa7
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/common/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.12.0
# 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
Expand Down
2 changes: 1 addition & 1 deletion charts/common/README.md
Original file line number Diff line number Diff line change
@@ -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.12.0](https://img.shields.io/badge/Version-10.12.0-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

Expand Down
38 changes: 38 additions & 0 deletions charts/common/ci/values.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +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:
Expand Down Expand Up @@ -208,6 +217,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:
Expand Down Expand Up @@ -285,6 +303,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:
Expand Down Expand Up @@ -345,6 +373,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:
Expand Down
7 changes: 7 additions & 0 deletions charts/common/templates/_pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
18 changes: 18 additions & 0 deletions charts/common/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,24 @@
]
}
},
"hostAliases": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ip": {
"type": "string"
},
"hostnames": {
"type": "array"
}
},
"required": [
"ip",
"hostnames"
]
}
},
"containers": {
"type": "object",
"patternProperties": {
Expand Down
12 changes: 12 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,18 @@ 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: {}
# - 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: {}
Expand Down

0 comments on commit 8342aa7

Please sign in to comment.