Commit d47b27da authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #34607 from errordeveloper/apiserver-adv-addr

Automatic merge from submit-queue Append first address from `--api-advertise-addresses` to `kube-apiserver` flags **What this PR does / why we need it**: We have `--api-advertise-addresses` already, but it's only used for SANs in server certificates we generate. Currently setting this flag doesn't affect what address API server advertises, and this PR fixes that. In particular, this has been an issue for VirtualBox users (see #34101). **Which issue this PR fixes**: fixes #34101 **Release note**: ```release-note Make `kubeadm` append first address from `--api-advertise-addresses` to `kube-apiserver` flags as `--advertise-address` ```
parents 12b13357 0cb54e7e
...@@ -266,6 +266,10 @@ func getComponentCommand(component string, s *kubeadmapi.MasterConfiguration) (c ...@@ -266,6 +266,10 @@ func getComponentCommand(component string, s *kubeadmapi.MasterConfiguration) (c
command = append(command, baseFlags[component]...) command = append(command, baseFlags[component]...)
if component == apiServer { if component == apiServer {
// Use first address we are given
if len(s.API.AdvertiseAddresses) > 0 {
command = append(command, fmt.Sprintf("--advertise-address=%s", s.API.AdvertiseAddresses[0]))
}
// Check if the user decided to use an external etcd cluster // Check if the user decided to use an external etcd cluster
if len(s.Etcd.Endpoints) > 0 { if len(s.Etcd.Endpoints) > 0 {
command = append(command, fmt.Sprintf("--etcd-servers=%s", strings.Join(s.Etcd.Endpoints, ","))) command = append(command, fmt.Sprintf("--etcd-servers=%s", strings.Join(s.Etcd.Endpoints, ",")))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment