Skip to content

Commit

Permalink
Generate hostname if not specified
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
  • Loading branch information
kvaps committed Jan 29, 2025
1 parent 6a34b23 commit db13df9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions charts/talm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
{{- end }}

{{- define "talm.discovered.hostname" }}
{{- with (lookup "hostname" "" "hostname") }}
{{- .spec.hostname }}
{{- $hostname := lookup "hostname" "" "hostname" }}
{{- if $hostname }}
{{- $hostname.spec.hostname }}
{{- else }}
{{- printf "talos-%s" (include "talm.discovered.default_addresses_by_gateway" . | sha256sum | trunc 5) }}
{{- end }}
{{- end }}

Expand Down
7 changes: 5 additions & 2 deletions pkg/generated/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ description: A library Talm chart for Talos Linux
{{- end }}
{{- define "talm.discovered.hostname" }}
{{- with (lookup "hostname" "" "hostname") }}
{{- .spec.hostname }}
{{- $hostname := lookup "hostname" "" "hostname" }}
{{- if $hostname }}
{{- $hostname.spec.hostname }}
{{- else }}
{{- printf "talos-%s" (include "talm.discovered.default_addresses_by_gateway" . | sha256sum | trunc 5) }}
{{- end }}
{{- end }}
Expand Down

0 comments on commit db13df9

Please # to comment.