networking

package
v0.0.0-...-c116a60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilterMatch     = fmt.Errorf("filter match error")
	ErrMultipleMatches = multipleMatchesError{}
	ErrNoMatches       = noMatchesError{}
)

Functions

Types

type PortListOpts

type PortListOpts struct {
	DeviceOwner []string `q:"device_owner"`
	NetworkID   string   `q:"network_id"`
}

func (*PortListOpts) ToPortListQuery

func (p *PortListOpts) ToPortListQuery() (string, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service interfaces with the OpenStack Networking API. It will create a network related infrastructure for the cluster, like network, subnet, router, security groups.

func NewService

func NewService(scope *scope.WithLogger) (*Service, error)

NewService returns an instance of the networking service.

func (*Service) AdoptPorts

func (s *Service) AdoptPorts(scope *scope.WithLogger, desiredPorts []infrav1.ResolvedPortSpec, resources *infrav1.MachineResources) error

AdoptPorts looks for ports in desiredPorts which were previously created, and adds them to resources.Ports. A port matches if it has the same name and network ID as the desired port.

func (*Service) AssociateFloatingIP

func (s *Service) AssociateFloatingIP(eventObject runtime.Object, fp *floatingips.FloatingIP, portID string) error

func (*Service) ConstructPorts

func (s *Service) ConstructPorts(spec *infrav1.OpenStackMachineSpec, clusterResourceName, baseName string, defaultNetwork *infrav1.NetworkStatusWithSubnets, managedSecurityGroup *string, baseTags []string) ([]infrav1.ResolvedPortSpec, error)

ConstructPorts builds an array of ports from the machine spec. If no ports are in the spec, returns a single port for a network connection to the default cluster network.

func (*Service) CreateFloatingIPForPool

func (s *Service) CreateFloatingIPForPool(pool *v1alpha1.OpenStackFloatingIPPool) (*floatingips.FloatingIP, error)

func (*Service) CreatePort

func (s *Service) CreatePort(eventObject runtime.Object, portSpec *infrav1.ResolvedPortSpec) (*ports.Port, error)

func (*Service) CreatePorts

func (s *Service) CreatePorts(eventObject runtime.Object, desiredPorts []infrav1.ResolvedPortSpec, resources *infrav1.MachineResources) error

func (*Service) DeleteClusterPorts

func (s *Service) DeleteClusterPorts(openStackCluster *infrav1.OpenStackCluster) error

DeleteClusterPorts deletes all ports created for the cluster.

func (*Service) DeleteFloatingIP

func (s *Service) DeleteFloatingIP(eventObject runtime.Object, ip string) error

func (*Service) DeleteInstanceTrunkAndPort

func (s *Service) DeleteInstanceTrunkAndPort(eventObject runtime.Object, port infrav1.PortStatus, trunkSupported bool) error

DeleteTrunk deletes the Neutron trunk and port with the given ID.

func (*Service) DeleteNetwork

func (s *Service) DeleteNetwork(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) DeletePort

func (s *Service) DeletePort(eventObject runtime.Object, portID string) error

DeletePort deletes the Neutron port with the given ID.

func (*Service) DeleteRouter

func (s *Service) DeleteRouter(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) DeleteSecurityGroups

func (s *Service) DeleteSecurityGroups(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) DeleteTrunk

func (s *Service) DeleteTrunk(eventObject runtime.Object, portID string) error

func (*Service) DisassociateFloatingIP

func (s *Service) DisassociateFloatingIP(eventObject runtime.Object, ip string) error

func (*Service) GetFloatingIP

func (s *Service) GetFloatingIP(ip string) (*floatingips.FloatingIP, error)

func (*Service) GetFloatingIPByPortID

func (s *Service) GetFloatingIPByPortID(portID string) (*floatingips.FloatingIP, error)

func (*Service) GetFloatingIPsByTag

func (s *Service) GetFloatingIPsByTag(tag string) ([]floatingips.FloatingIP, error)

func (*Service) GetNetworkByID

func (s *Service) GetNetworkByID(networkID string) (*networks.Network, error)

GetNetworkByID retrieves network by the ID.

func (*Service) GetNetworkByParam

func (s *Service) GetNetworkByParam(param *infrav1.NetworkParam, opts ...GetNetworkOpts) (*networks.Network, error)

GetNetworkByParam gets the network specified by the given NetworkParam.

func (*Service) GetNetworkIDByParam

func (s *Service) GetNetworkIDByParam(param *infrav1.NetworkParam, opts ...GetNetworkOpts) (string, error)

GetNetworkIDByParam returns the ID of the network specified by the given NetworkParam. It does not make an OpenStack call if the network is specified by ID.

func (*Service) GetNetworkSubnetByParam

func (s *Service) GetNetworkSubnetByParam(networkID string, param *infrav1.SubnetParam) (*subnets.Subnet, error)

GetNetworkSubnetByParam gets a single subnet of the given network, specified by the given SubnetParam. It returns an ErrFilterMatch if no or multiple subnets are found.

func (*Service) GetOrCreateFloatingIP

func (s *Service) GetOrCreateFloatingIP(eventObject runtime.Object, openStackCluster *infrav1.OpenStackCluster, clusterResourceName string, ip *string) (*floatingips.FloatingIP, error)

func (*Service) GetPortForExternalNetwork

func (s *Service) GetPortForExternalNetwork(instanceID string, externalNetworkID string) (*ports.Port, error)

func (*Service) GetPortFromInstanceIP

func (s *Service) GetPortFromInstanceIP(instanceID string, ip string) ([]ports.Port, error)

GetPortFromInstanceIP returns at most one port attached to the instance with given ID and with the IP address provided.

func (*Service) GetSecurityGroups

func (s *Service) GetSecurityGroups(securityGroupParams []infrav1.SecurityGroupParam) ([]string, error)

func (*Service) GetSubnetByParam

func (s *Service) GetSubnetByParam(param *infrav1.SubnetParam) (*subnets.Subnet, error)

GetSubnetByParam gets a single subnet specified by the given SubnetParam It returns an ErrFilterMatch if no or multiple subnets are found.

func (*Service) GetSubnetIDByParam

func (s *Service) GetSubnetIDByParam(param *infrav1.SubnetParam) (string, error)

GetSubnetIDByParam gets the id of a subnet from the given SubnetParam. It does not make any OpenStack API calls if the subnet is specified by ID.

func (*Service) GetSubnetsByFilter

func (s *Service) GetSubnetsByFilter(opts subnets.ListOptsBuilder) ([]subnets.Subnet, error)

GetSubnetsByFilter gets the id of a subnet by querying openstack with filters.

func (*Service) GetTrunkSupport

func (s *Service) GetTrunkSupport() (bool, error)

func (*Service) IsTrunkExtSupported

func (s *Service) IsTrunkExtSupported() (trunknSupported bool, err error)

IsTrunkExtSupported verifies trunk setup on the OpenStack deployment.

func (*Service) ReconcileExternalNetwork

func (s *Service) ReconcileExternalNetwork(openStackCluster *infrav1.OpenStackCluster) error

ReconcileExternalNetwork will try to find an external network and set it in the cluster status. The external network can be specified in the cluster spec or will be searched for if not specified. OpenStackCluster.Status.ExternalNetwork will be set to nil if one of these conditions are met: - no external network was given in the cluster spec and no external network was found - the user has set OpenStackCluster.Spec.DisableExternalNetwork to true.

func (*Service) ReconcileNetwork

func (s *Service) ReconcileNetwork(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) ReconcileRouter

func (s *Service) ReconcileRouter(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) ReconcileSecurityGroups

func (s *Service) ReconcileSecurityGroups(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

ReconcileSecurityGroups reconcile the security groups.

func (*Service) ReconcileSubnet

func (s *Service) ReconcileSubnet(openStackCluster *infrav1.OpenStackCluster, clusterResourceName string) error

func (*Service) RemoveTrunkSubports

func (s *Service) RemoveTrunkSubports(trunkID string) error

func (*Service) TagFloatingIP

func (s *Service) TagFloatingIP(ip string, tag string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL