Documentation ¶
Index ¶
- Constants
- func AddExtraFlags(fs *pflag.FlagSet)
- func AddToNodeAddresses(addresses *[]v1.NodeAddress, addAddresses ...v1.NodeAddress)
- func GetLoadBalancerSourceRanges(service *corev1.Service, preferredIPFamily corev1.IPFamily) (netsets.IPNet, error)
- func NewRoutes(os *OpenStack, network *gophercloud.ServiceClient, atomicRoutes bool, ...) (cloudprovider.Routes, error)
- func PreserveGopherError(rawError error) error
- func RemoveFromNodeAddresses(addresses *[]v1.NodeAddress, removeAddresses ...v1.NodeAddress)
- type Config
- type Instances
- func (i *Instances) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (i *Instances) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
- func (i *Instances) InstanceExists(ctx context.Context, node *v1.Node) (bool, error)
- func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
- func (i *Instances) InstanceID(ctx context.Context, name types.NodeName) (string, error)
- func (i *Instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)
- func (i *Instances) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error)
- func (i *Instances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
- func (i *Instances) InstanceType(ctx context.Context, name types.NodeName) (string, error)
- func (i *Instances) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
- func (i *Instances) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)
- func (i *Instances) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
- type InstancesV2
- type LBClass
- type LbaasV2
- func (lbaas *LbaasV2) EnsureLoadBalancer(ctx context.Context, clusterName string, apiService *corev1.Service, ...) (*corev1.LoadBalancerStatus, error)
- func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *corev1.Service) error
- func (lbaas *LbaasV2) GetLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service) (*corev1.LoadBalancerStatus, bool, error)
- func (lbaas *LbaasV2) GetLoadBalancerName(_ context.Context, clusterName string, service *corev1.Service) string
- func (lbaas *LbaasV2) UpdateLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service, ...) error
- type LoadBalancer
- type LoadBalancerOpts
- type NetworkingOpts
- type OpenStack
- func (os *OpenStack) Clusters() (cloudprovider.Clusters, bool)
- func (os *OpenStack) GetZone(ctx context.Context) (cloudprovider.Zone, error)
- func (os *OpenStack) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
- func (os *OpenStack) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (os *OpenStack) HasClusterID() bool
- func (os *OpenStack) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})
- func (os *OpenStack) InstanceID() (string, error)
- func (os *OpenStack) Instances() (cloudprovider.Instances, bool)
- func (os *OpenStack) InstancesV2() (cloudprovider.InstancesV2, bool)
- func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (os *OpenStack) ProviderName() string
- func (os *OpenStack) Routes() (cloudprovider.Routes, bool)
- func (os *OpenStack) SetInformers(informerFactory informers.SharedInformerFactory)
- func (os *OpenStack) Zones() (cloudprovider.Zones, bool)
- type PortWithPortSecurity
- type PortWithTrunkDetails
- type RouterOpts
- type Routes
- func (r *Routes) CreateRoute(ctx context.Context, clusterName string, nameHint string, ...) error
- func (r *Routes) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error
- func (r *Routes) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)
- type ServerAttributesExt
- type TweakSubNetListOpsFunction
Constants ¶
const ( ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/openstack-internal-load-balancer" ServiceAnnotationLoadBalancerNodeSelector = "loadbalancer.openstack.org/node-selector" ServiceAnnotationLoadBalancerConnLimit = "loadbalancer.openstack.org/connection-limit" ServiceAnnotationLoadBalancerFloatingNetworkID = "loadbalancer.openstack.org/floating-network-id" ServiceAnnotationLoadBalancerFloatingSubnet = "loadbalancer.openstack.org/floating-subnet" ServiceAnnotationLoadBalancerFloatingSubnetID = "loadbalancer.openstack.org/floating-subnet-id" ServiceAnnotationLoadBalancerFloatingSubnetTags = "loadbalancer.openstack.org/floating-subnet-tags" ServiceAnnotationLoadBalancerClass = "loadbalancer.openstack.org/class" ServiceAnnotationLoadBalancerKeepFloatingIP = "loadbalancer.openstack.org/keep-floatingip" ServiceAnnotationLoadBalancerPortID = "loadbalancer.openstack.org/port-id" ServiceAnnotationLoadBalancerProxyEnabled = "loadbalancer.openstack.org/proxy-protocol" ServiceAnnotationLoadBalancerSubnetID = "loadbalancer.openstack.org/subnet-id" ServiceAnnotationLoadBalancerNetworkID = "loadbalancer.openstack.org/network-id" ServiceAnnotationLoadBalancerMemberSubnetID = "loadbalancer.openstack.org/member-subnet-id" ServiceAnnotationLoadBalancerTimeoutClientData = "loadbalancer.openstack.org/timeout-client-data" ServiceAnnotationLoadBalancerTimeoutMemberConnect = "loadbalancer.openstack.org/timeout-member-connect" ServiceAnnotationLoadBalancerTimeoutMemberData = "loadbalancer.openstack.org/timeout-member-data" ServiceAnnotationLoadBalancerTimeoutTCPInspect = "loadbalancer.openstack.org/timeout-tcp-inspect" ServiceAnnotationLoadBalancerXForwardedFor = "loadbalancer.openstack.org/x-forwarded-for" ServiceAnnotationLoadBalancerFlavorID = "loadbalancer.openstack.org/flavor-id" ServiceAnnotationLoadBalancerAvailabilityZone = "loadbalancer.openstack.org/availability-zone" // ServiceAnnotationLoadBalancerEnableHealthMonitor defines whether to create health monitor for the load balancer // pool, if not specified, use 'create-monitor' config. The health monitor can be created or deleted dynamically. ServiceAnnotationLoadBalancerEnableHealthMonitor = "loadbalancer.openstack.org/enable-health-monitor" ServiceAnnotationLoadBalancerHealthMonitorDelay = "loadbalancer.openstack.org/health-monitor-delay" ServiceAnnotationLoadBalancerHealthMonitorTimeout = "loadbalancer.openstack.org/health-monitor-timeout" ServiceAnnotationLoadBalancerHealthMonitorMaxRetries = "loadbalancer.openstack.org/health-monitor-max-retries" ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown = "loadbalancer.openstack.org/health-monitor-max-retries-down" ServiceAnnotationLoadBalancerLoadbalancerHostname = "loadbalancer.openstack.org/hostname" ServiceAnnotationLoadBalancerAddress = "loadbalancer.openstack.org/load-balancer-address" // revive:disable:var-naming ServiceAnnotationTlsContainerRef = "loadbalancer.openstack.org/default-tls-container-ref" ServiceAnnotationLoadBalancerID = "loadbalancer.openstack.org/load-balancer-id" )
Note: when creating a new Loadbalancer (VM), it can take some time before it is ready for use, this timeout is used for waiting until the Loadbalancer provisioning status goes to ACTIVE state.
const ( // ProviderName is the name of the openstack provider ProviderName = "openstack" // TypeHostName is the name type of openstack instance TypeHostName = "hostname" )
const (
RegionalProviderIDEnv = "OS_CCM_REGIONAL"
)
Variables ¶
This section is empty.
Functions ¶
func AddExtraFlags ¶
AddExtraFlags is called by the main package to add component specific command line flags
func AddToNodeAddresses ¶
func AddToNodeAddresses(addresses *[]v1.NodeAddress, addAddresses ...v1.NodeAddress)
AddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice, only if they do not already exist
func GetLoadBalancerSourceRanges ¶
func GetLoadBalancerSourceRanges(service *corev1.Service, preferredIPFamily corev1.IPFamily) (netsets.IPNet, error)
GetLoadBalancerSourceRanges first try to parse and verify LoadBalancerSourceRanges field from a service. If the field is not specified, turn to parse and verify the AnnotationLoadBalancerSourceRangesKey annotation from a service, extracting the source ranges to allow, and if not present returns a default (allow-all) value.
func NewRoutes ¶
func NewRoutes(os *OpenStack, network *gophercloud.ServiceClient, atomicRoutes bool, allowedAddressPairs bool) (cloudprovider.Routes, error)
NewRoutes creates a new instance of Routes
func PreserveGopherError ¶
PreserveGopherError preserves the error details delivered with the response that are explicitly discarded by dedicated error types. The gopher library, because of an unknown reason, explicitly hides the detailed error information from the response body and replaces it with a generic phrase that does not help to identify the problem anymore. This method resurrects the error message from the response body for such cases. For example for an 404 Error the provided message just tells `Resource not found`, which is not helpful, because it hides the real error information, which might be something completely different. error types from provider_client.go
func RemoveFromNodeAddresses ¶
func RemoveFromNodeAddresses(addresses *[]v1.NodeAddress, removeAddresses ...v1.NodeAddress)
RemoveFromNodeAddresses removes the NodeAddresses from the passed-by-pointer slice if they already exist.
Types ¶
type Config ¶
type Config struct { Global client.AuthOpts LoadBalancer LoadBalancerOpts LoadBalancerClass map[string]*LBClass Route RouterOpts Metadata metadata.Opts Networking NetworkingOpts }
Config is used to read and store information from the cloud configuration file
type Instances ¶
type Instances struct {
// contains filtered or unexported fields
}
Instances encapsulates an implementation of Instances for OpenStack.
func (*Instances) AddSSHKeyToAllInstances ¶
AddSSHKeyToAllInstances is not implemented for OpenStack
func (*Instances) CurrentNodeName ¶
CurrentNodeName implements Instances.CurrentNodeName Note this is *not* necessarily the same as hostname.
func (*Instances) InstanceExists ¶
InstanceExists returns true if the instance for the given node exists.
func (*Instances) InstanceExistsByProviderID ¶
func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
InstanceExistsByProviderID returns true if the instance with the given provider id still exists. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (*Instances) InstanceID ¶
InstanceID returns the cloud provider ID of the specified instance.
func (*Instances) InstanceMetadata ¶
func (i *Instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)
InstanceMetadata returns metadata of the specified instance.
func (*Instances) InstanceShutdown ¶
InstanceShutdown returns true if the instances is in safe state to detach volumes. It is the only state, where volumes can be detached immediately.
func (*Instances) InstanceShutdownByProviderID ¶
func (i *Instances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
InstanceShutdownByProviderID returns true if the instances is in safe state to detach volumes. It is the only state, where volumes can be detached immediately.
func (*Instances) InstanceType ¶
InstanceType returns the type of the specified instance.
func (*Instances) InstanceTypeByProviderID ¶
func (i *Instances) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here
func (*Instances) NodeAddresses ¶
func (i *Instances) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)
NodeAddresses implements Instances.NodeAddresses
func (*Instances) NodeAddressesByProviderID ¶
func (i *Instances) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here
type InstancesV2 ¶ added in v1.27.0
type InstancesV2 struct {
// contains filtered or unexported fields
}
InstancesV2 encapsulates an implementation of InstancesV2 for OpenStack.
func (*InstancesV2) InstanceExists ¶ added in v1.27.0
InstanceExists indicates whether a given node exists according to the cloud provider
func (*InstancesV2) InstanceMetadata ¶ added in v1.27.0
func (i *InstancesV2) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)
InstanceMetadata returns the instance's metadata.
func (*InstancesV2) InstanceShutdown ¶ added in v1.27.0
InstanceShutdown returns true if the instance is shutdown according to the cloud provider.
type LBClass ¶
type LBClass struct { FloatingNetworkID string `gcfg:"floating-network-id,omitempty"` FloatingSubnetID string `gcfg:"floating-subnet-id,omitempty"` FloatingSubnet string `gcfg:"floating-subnet,omitempty"` FloatingSubnetTags string `gcfg:"floating-subnet-tags,omitempty"` NetworkID string `gcfg:"network-id,omitempty"` SubnetID string `gcfg:"subnet-id,omitempty"` MemberSubnetID string `gcfg:"member-subnet-id,omitempty"` }
LBClass defines the corresponding floating network, floating subnet or internal subnet ID
type LbaasV2 ¶
type LbaasV2 struct {
LoadBalancer
}
LbaasV2 is a LoadBalancer implementation based on Octavia
func (*LbaasV2) EnsureLoadBalancer ¶
func (lbaas *LbaasV2) EnsureLoadBalancer(ctx context.Context, clusterName string, apiService *corev1.Service, nodes []*corev1.Node) (*corev1.LoadBalancerStatus, error)
EnsureLoadBalancer creates a new load balancer or updates the existing one.
func (*LbaasV2) EnsureLoadBalancerDeleted ¶
func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *corev1.Service) error
EnsureLoadBalancerDeleted deletes the specified load balancer
func (*LbaasV2) GetLoadBalancer ¶
func (lbaas *LbaasV2) GetLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service) (*corev1.LoadBalancerStatus, bool, error)
GetLoadBalancer returns whether the specified load balancer exists and its status
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer is used for creating and maintaining load balancers
type LoadBalancerOpts ¶
type LoadBalancerOpts struct { Enabled bool `gcfg:"enabled"` // if false, disables the controller LBVersion string `gcfg:"lb-version"` // overrides autodetection. Only support v2. SubnetID string `gcfg:"subnet-id"` // overrides autodetection. MemberSubnetID string `gcfg:"member-subnet-id"` // overrides autodetection. NetworkID string `gcfg:"network-id"` // If specified, will create virtual ip from a subnet in network which has available IP addresses FloatingNetworkID string `gcfg:"floating-network-id"` // If specified, will create floating ip for loadbalancer, or do not create floating ip. FloatingSubnetID string `gcfg:"floating-subnet-id"` // If specified, will create floating ip for loadbalancer in this particular floating pool subnetwork. FloatingSubnet string `gcfg:"floating-subnet"` // If specified, will create floating ip for loadbalancer in one of the matching floating pool subnetworks. FloatingSubnetTags string `gcfg:"floating-subnet-tags"` // If specified, will create floating ip for loadbalancer in one of the matching floating pool subnetworks. LBClasses map[string]*LBClass // Predefined named Floating networks and subnets LBMethod string `gcfg:"lb-method"` // default to ROUND_ROBIN. LBProvider string `gcfg:"lb-provider"` CreateMonitor bool `gcfg:"create-monitor"` MonitorDelay util.MyDuration `gcfg:"monitor-delay"` MonitorTimeout util.MyDuration `gcfg:"monitor-timeout"` MonitorMaxRetries uint `gcfg:"monitor-max-retries"` MonitorMaxRetriesDown uint `gcfg:"monitor-max-retries-down"` ManageSecurityGroups bool `gcfg:"manage-security-groups"` InternalLB bool `gcfg:"internal-lb"` // default false NodeSelector string `gcfg:"node-selector"` // If specified, the loadbalancer members will be assined only from nodes list filtered by node-selector labels CascadeDelete bool `gcfg:"cascade-delete"` FlavorID string `gcfg:"flavor-id"` AvailabilityZone string `gcfg:"availability-zone"` EnableIngressHostname bool `gcfg:"enable-ingress-hostname"` // Used with proxy protocol by adding a dns suffix to the load balancer IP address. Default false. IngressHostnameSuffix string `gcfg:"ingress-hostname-suffix"` // Used with proxy protocol by adding a dns suffix to the load balancer IP address. Default nip.io. ContainerStore string `gcfg:"container-store"` // Used to specify the store of the tls-container-ref ProviderRequiresSerialAPICalls bool `gcfg:"provider-requires-serial-api-calls"` // default false, the provider supports the "bulk update" API call // revive:disable:var-naming TlsContainerRef string `gcfg:"default-tls-container-ref"` // reference to a tls container }
LoadBalancerOpts have the options to talk to Neutron LBaaSV2 or Octavia
type NetworkingOpts ¶
type NetworkingOpts struct { IPv6SupportDisabled bool `gcfg:"ipv6-support-disabled"` PublicNetworkName []string `gcfg:"public-network-name"` InternalNetworkName []string `gcfg:"internal-network-name"` AddressSortOrder string `gcfg:"address-sort-order"` }
NetworkingOpts is used for networking settings
type OpenStack ¶
type OpenStack struct {
// contains filtered or unexported fields
}
OpenStack is an implementation of cloud provider Interface for OpenStack.
func NewOpenStack ¶
NewOpenStack creates a new new instance of the openstack struct from a config struct
func (*OpenStack) Clusters ¶
func (os *OpenStack) Clusters() (cloudprovider.Clusters, bool)
Clusters is a no-op
func (*OpenStack) GetZoneByNodeName ¶
func (os *OpenStack) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.
func (*OpenStack) GetZoneByProviderID ¶
func (os *OpenStack) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.
func (*OpenStack) HasClusterID ¶
HasClusterID returns true if the cluster has a clusterID
func (*OpenStack) Initialize ¶
func (os *OpenStack) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})
Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func (*OpenStack) InstanceID ¶
InstanceID returns the kubelet's cloud provider ID.
func (*OpenStack) Instances ¶
func (os *OpenStack) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for OpenStack. TODO: v1 instance apis can be deleted after the v2 is verified enough
func (*OpenStack) InstancesV2 ¶
func (os *OpenStack) InstancesV2() (cloudprovider.InstancesV2, bool)
InstancesV2 returns an implementation of InstancesV2 for OpenStack.
func (*OpenStack) LoadBalancer ¶
func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer initializes a LbaasV2 object
func (*OpenStack) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*OpenStack) Routes ¶
func (os *OpenStack) Routes() (cloudprovider.Routes, bool)
Routes initializes routes support
func (*OpenStack) SetInformers ¶ added in v1.25.5
func (os *OpenStack) SetInformers(informerFactory informers.SharedInformerFactory)
SetInformers implements InformerUser interface by setting up informer-fed caches to leverage Kubernetes API for caching
type PortWithPortSecurity ¶ added in v1.28.2
type PortWithPortSecurity struct { neutronports.Port portsecurity.PortSecurityExt }
type PortWithTrunkDetails ¶ added in v1.28.0
type PortWithTrunkDetails struct { neutronports.Port trunk_details.TrunkDetailsExt }
type RouterOpts ¶
type RouterOpts struct {
RouterID string `gcfg:"router-id"`
}
RouterOpts is used for Neutron routes
type Routes ¶
type Routes struct { // Neutron with no "extraroute-atomic" extension can modify only one route at // once sync.Mutex // contains filtered or unexported fields }
Routes implements the cloudprovider.Routes for OpenStack clouds
func (*Routes) CreateRoute ¶
func (r *Routes) CreateRoute(ctx context.Context, clusterName string, nameHint string, route *cloudprovider.Route) error
CreateRoute creates the described managed route
func (*Routes) DeleteRoute ¶
func (r *Routes) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error
DeleteRoute deletes the specified managed route
func (*Routes) ListRoutes ¶
func (r *Routes) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)
ListRoutes lists all managed routes that belong to the specified clusterName
type ServerAttributesExt ¶
type ServerAttributesExt struct { servers.Server availabilityzones.ServerAvailabilityZoneExt }
type TweakSubNetListOpsFunction ¶
TweakSubNetListOpsFunction is used to modify List Options for subnets