Skip to content

Commit

Permalink
fix: append hostname to cluster SANs when port is not specified
Browse files Browse the repository at this point in the history
This fixes an issue with `talosctl gen config` not appending API server
cert SANs if the endpoint doesn't contain a port.

In fact this shouldn't be ever needed, as Talos automatically injects
SANs form the endpoint URL on the fly, but good to fix for consistency.

Fixes #5536

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed May 12, 2022
1 parent 9885bbe commit 86741d9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/machinery/config/types/v1alpha1/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ func (i *Input) GetAPIServerSANs() []string {

endpointURL, err := url.Parse(i.ControlPlaneEndpoint)
if err == nil {
host, _, err := net.SplitHostPort(endpointURL.Host)
if err == nil {
list = append(list, host)
}
list = append(list, endpointURL.Hostname())
}

list = append(list, i.AdditionalSubjectAltNames...)
Expand Down

0 comments on commit 86741d9

Please sign in to comment.