Skip to content

Commit

Permalink
check is cluster nil when creating clients
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Dec 27, 2022
1 parent 4eee659 commit 829fda4
Showing 1 changed file with 8 additions and 5 deletions.
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 829fda4

Please sign in to comment.