Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/asset/machines/clusterapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func (c *ClusterAPI) Generate(dependencies asset.Parents) error {
trunkSupport, err := openstack.CheckNetworkExtensionAvailability(
ic.Platform.OpenStack.Cloud,
"trunk",
nil,
)
if err != nil {
return fmt.Errorf("failed to check for trunk support: %w", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func (m *Master) Generate(dependencies asset.Parents) error {
trunkSupport, err := openstack.CheckNetworkExtensionAvailability(
ic.Platform.OpenStack.Cloud,
"trunk",
nil,
)
if err != nil {
return fmt.Errorf("failed to check for trunk support: %w", err)
Expand Down
10 changes: 8 additions & 2 deletions pkg/asset/machines/openstack/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/gophercloud/gophercloud"
netext "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/utils/openstack/clientconfig"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -375,8 +376,13 @@ func failureDomainsFromSpec(mpool openstack.MachinePool) []machinev1.OpenStackFa

// CheckNetworkExtensionAvailability interrogates the OpenStack API to validate
// the availability of a given Neutron extension.
func CheckNetworkExtensionAvailability(cloud, alias string) (bool, error) {
opts := openstackdefaults.DefaultClientOpts(cloud)
// The `opts` parameter is provided for external consumers needing to configure
// the client e.g. with custom certs. If unspecified (nil), a default client is
// built based on the specified `cloud`.
func CheckNetworkExtensionAvailability(cloud, alias string, opts *clientconfig.ClientOpts) (bool, error) {
if opts == nil {
opts = openstackdefaults.DefaultClientOpts(cloud)
}
conn, err := openstackdefaults.NewServiceClient("network", opts)
if err != nil {
return false, err
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
trunkSupport, err := openstack.CheckNetworkExtensionAvailability(
ic.Platform.OpenStack.Cloud,
"trunk",
nil,
)
if err != nil {
return fmt.Errorf("failed to check for trunk support: %w", err)
Expand Down