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`
```
This commit is contained in:
Kubernetes Submit Queue 2016-10-12 07:51:49 -07:00 committed by GitHub
commit d47b27da84

View File

@ -266,6 +266,10 @@ func getComponentCommand(component string, s *kubeadmapi.MasterConfiguration) (c
command = append(command, baseFlags[component]...)
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
if len(s.Etcd.Endpoints) > 0 {
command = append(command, fmt.Sprintf("--etcd-servers=%s", strings.Join(s.Etcd.Endpoints, ",")))