Skip to content

Commit

Permalink
Merge pull request #14887 from zetaab/fixoscreate
Browse files Browse the repository at this point in the history
set loadbalancer configs before initializing the OS clients
  • Loading branch information
k8s-ci-robot authored Dec 30, 2022
2 parents 50fe613 + 829fda4 commit e85051b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal.k8s.local
spec:
api:
loadBalancer:
type: Public
authorization:
rbac: {}
channel: stable
Expand Down
5 changes: 2 additions & 3 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func NewCluster(opt *NewClusterOptions, clientset simple.Clientset) (*NewCluster
MaxRetries: fi.PtrTo(3),
},
}
initializeOpenstackAPI(opt, cluster)
osCloud, err := openstack.NewOpenstackCloud(cluster, "openstackmodel")
if err != nil {
return nil, err
Expand Down Expand Up @@ -1324,9 +1325,7 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
func setupAPI(opt *NewClusterOptions, cluster *api.Cluster) error {
// Populate the API access, so that it can be discoverable
klog.Infof("Cloud Provider ID: %q", cluster.Spec.GetCloudProvider())
if cluster.Spec.GetCloudProvider() == api.CloudProviderOpenstack {
initializeOpenstackAPI(opt, cluster)
} else if cluster.Spec.GetCloudProvider() == api.CloudProviderAzure {
if cluster.Spec.GetCloudProvider() == api.CloudProviderAzure {
// Do nothing to disable the use of loadbalancer for the k8s API server.
// TODO(kenji): Remove this condition once we support the loadbalancer
// in pkg/model/azuremodel/api_loadbalancer.go.
Expand Down
13 changes: 8 additions & 5 deletions upup/pkg/fi/cloudup/openstack/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,15 @@ func NewOpenstackCloud(cluster *kops.Cluster, uagent string) (OpenstackCloud, er
return nil, fmt.Errorf("error building openstack authenticated client: %v", err)
}

tags := map[string]string{
TagClusterName: cluster.Name,
if cluster != nil {
hasDNS := !cluster.IsGossip() && !cluster.UsesNoneDNS()
tags := map[string]string{
TagClusterName: cluster.Name,
}
return buildClients(provider, tags, cluster.Spec.CloudProvider.Openstack, config, region, hasDNS)
}

hasDNS := !cluster.IsGossip() && !cluster.UsesNoneDNS()
return buildClients(provider, tags, cluster.Spec.CloudProvider.Openstack, config, region, hasDNS)
// used by protokube
return buildClients(provider, nil, nil, config, region, false)
}

func buildClients(provider *gophercloud.ProviderClient, tags map[string]string, spec *kops.OpenstackSpec, config vfs.OpenstackConfig, region string, hasDNS bool) (OpenstackCloud, error) {
Expand Down

0 comments on commit e85051b

Please sign in to comment.