mirror of https://github.com/kubernetes/kops.git
Merge pull request #14887 from zetaab/fixoscreate
set loadbalancer configs before initializing the OS clients
This commit is contained in:
commit
e85051b709
|
|
@ -4,6 +4,9 @@ metadata:
|
||||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||||
name: minimal.k8s.local
|
name: minimal.k8s.local
|
||||||
spec:
|
spec:
|
||||||
|
api:
|
||||||
|
loadBalancer:
|
||||||
|
type: Public
|
||||||
authorization:
|
authorization:
|
||||||
rbac: {}
|
rbac: {}
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,7 @@ func NewCluster(opt *NewClusterOptions, clientset simple.Clientset) (*NewCluster
|
||||||
MaxRetries: fi.PtrTo(3),
|
MaxRetries: fi.PtrTo(3),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
initializeOpenstackAPI(opt, cluster)
|
||||||
osCloud, err := openstack.NewOpenstackCloud(cluster, "openstackmodel")
|
osCloud, err := openstack.NewOpenstackCloud(cluster, "openstackmodel")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -1324,9 +1325,7 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
|
||||||
func setupAPI(opt *NewClusterOptions, cluster *api.Cluster) error {
|
func setupAPI(opt *NewClusterOptions, cluster *api.Cluster) error {
|
||||||
// Populate the API access, so that it can be discoverable
|
// Populate the API access, so that it can be discoverable
|
||||||
klog.Infof("Cloud Provider ID: %q", cluster.Spec.GetCloudProvider())
|
klog.Infof("Cloud Provider ID: %q", cluster.Spec.GetCloudProvider())
|
||||||
if cluster.Spec.GetCloudProvider() == api.CloudProviderOpenstack {
|
if cluster.Spec.GetCloudProvider() == api.CloudProviderAzure {
|
||||||
initializeOpenstackAPI(opt, cluster)
|
|
||||||
} else if cluster.Spec.GetCloudProvider() == api.CloudProviderAzure {
|
|
||||||
// Do nothing to disable the use of loadbalancer for the k8s API server.
|
// Do nothing to disable the use of loadbalancer for the k8s API server.
|
||||||
// TODO(kenji): Remove this condition once we support the loadbalancer
|
// TODO(kenji): Remove this condition once we support the loadbalancer
|
||||||
// in pkg/model/azuremodel/api_loadbalancer.go.
|
// in pkg/model/azuremodel/api_loadbalancer.go.
|
||||||
|
|
|
||||||
|
|
@ -363,12 +363,15 @@ func NewOpenstackCloud(cluster *kops.Cluster, uagent string) (OpenstackCloud, er
|
||||||
return nil, fmt.Errorf("error building openstack authenticated client: %v", err)
|
return nil, fmt.Errorf("error building openstack authenticated client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := map[string]string{
|
if cluster != nil {
|
||||||
TagClusterName: cluster.Name,
|
hasDNS := !cluster.IsGossip() && !cluster.UsesNoneDNS()
|
||||||
|
tags := map[string]string{
|
||||||
|
TagClusterName: cluster.Name,
|
||||||
|
}
|
||||||
|
return buildClients(provider, tags, cluster.Spec.CloudProvider.Openstack, config, region, hasDNS)
|
||||||
}
|
}
|
||||||
|
// used by protokube
|
||||||
hasDNS := !cluster.IsGossip() && !cluster.UsesNoneDNS()
|
return buildClients(provider, nil, nil, config, region, false)
|
||||||
return buildClients(provider, tags, cluster.Spec.CloudProvider.Openstack, config, region, hasDNS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildClients(provider *gophercloud.ProviderClient, tags map[string]string, spec *kops.OpenstackSpec, config vfs.OpenstackConfig, region string, hasDNS bool) (OpenstackCloud, error) {
|
func buildClients(provider *gophercloud.ProviderClient, tags map[string]string, spec *kops.OpenstackSpec, config vfs.OpenstackConfig, region string, hasDNS bool) (OpenstackCloud, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue