edgedevice

package
Version: v0.0.0-...-4cca708 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 98 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAPIVersionFallback

func CheckAPIVersionFallback(kubeClient kubeclient.Interface) []*metav1.APIResourceList

CheckAPIVersionFallback is just a static library check for the api resource fallback if discovery failed, you should only use the result returned by this function when you have failed to discover api resources via kubernetes api discovery, and the result only contains the most legacy apis wanted by the controller and supported by the client library

Types

type Controller

type Controller struct {
	*manager.BaseManager
	// contains filtered or unexported fields
}

func NewController

func NewController(
	appCtx context.Context,
	config *conf.Config,
	hostNodeName, hostname, hostIP string,
	hostNodeAddresses []corev1.NodeAddress,
	preferredResources []*metav1.APIResourceList,
) (*Controller, error)

nolint:gocyclo

func (*Controller) AddSSHKeyToAllInstances

func (c *Controller) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error

AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances expected format for the key is standard ssh-keygen format: <protocol> <blob>

func (*Controller) Clusters

func (c *Controller) Clusters() (cloudprovider.Clusters, bool)

Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.

func (*Controller) CreateRoute

func (c *Controller) CreateRoute(
	ctx context.Context, clusterName string, nameHint string, route *cloudprovider.Route) error

CreateRoute creates the described managed route route.Name will be ignored, although the cloud-provider may use nameHint to create a more user-meaningful name.

func (*Controller) CurrentNodeName

func (c *Controller) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)

CurrentNodeName returns the name of the node we are currently running on On most clouds (e.g. GCE) this is the hostname, so we provide the hostname

func (*Controller) DeleteRoute

func (c *Controller) DeleteRoute(
	ctx context.Context, clusterName string, route *cloudprovider.Route) error

DeleteRoute deletes the specified managed route Route should be as returned by ListRoutes

func (*Controller) EnsureLoadBalancer

func (c *Controller) EnsureLoadBalancer(
	ctx context.Context,
	clusterName string,
	service *corev1.Service,
	nodes []*corev1.Node,
) (*corev1.LoadBalancerStatus, error)

EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer Implementations must treat the *corev1.Service and *corev1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*Controller) EnsureLoadBalancerDeleted

func (c *Controller) EnsureLoadBalancerDeleted(
	ctx context.Context, clusterName string, service *corev1.Service) error

EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, returning nil if the load balancer specified either didn't exist or was successfully deleted. This construction is useful because many cloud providers' load balancers have multiple underlying components, meaning a Get could say that the LB doesn't exist even if some part of it is still laying around. Implementations must treat the *corev1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*Controller) GetLoadBalancer

func (c *Controller) GetLoadBalancer(
	ctx context.Context,
	clusterName string,
	service *corev1.Service,
) (status *corev1.LoadBalancerStatus, exists bool, err error)

TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service GetLoadBalancer returns whether the specified load balancer exists, and if so, what its status is. Implementations must treat the *corev1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*Controller) GetLoadBalancerName

func (c *Controller) GetLoadBalancerName(
	ctx context.Context,
	clusterName string,
	service *corev1.Service,
) string

GetLoadBalancerName returns the name of the load balancer. Implementations must treat the *corev1.Service parameter as read-only and not modify it.

func (*Controller) GetZone

func (c *Controller) GetZone(ctx context.Context) (cloudprovider.Zone, error)

GetZone returns the Zone containing the current failure zone and locality region that the program is running in In most cases, this method is called from the kubelet querying a local metadata service to acquire its zone. For the case of external cloud providers, use GetZoneByProviderID or GetZoneByNodeName since GetZone can no longer be called from the kubelets.

func (*Controller) GetZoneByNodeName

func (c *Controller) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name This method is particularly used in the context of external cloud providers where node initialization must be done outside the kubelets.

func (*Controller) GetZoneByProviderID

func (c *Controller) GetZoneByProviderID(
	ctx context.Context, providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerID This method is particularly used in the context of external cloud providers where node initialization must be done outside the kubelets.

func (*Controller) HasClusterID

func (c *Controller) HasClusterID() bool

HasClusterID returns true if a ClusterID is required and set

func (*Controller) Initialize

func (c *Controller) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})

Initialize provides the cloud with a kubernetes client builder and may spawn goroutines to perform housekeeping or run custom controllers specific to the cloud provider. Any tasks started here should be cleaned up when the stop channel closes.

func (*Controller) InstanceExists

func (c *Controller) InstanceExists(ctx context.Context, node *corev1.Node) (bool, error)

InstanceExists returns true if the instance for the given node exists according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Controller) InstanceExistsByProviderID

func (c *Controller) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance for the given provider exists. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. This method should still return true for instances that exist but are stopped/sleeping.

func (*Controller) InstanceID

func (c *Controller) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified NodeName. Note that if the instance does not exist, we must return ("", cloudprovider.InstanceNotFound) cloudprovider.InstanceNotFound should NOT be returned for instances that exist but are stopped/sleeping

func (*Controller) InstanceMetadata

func (c *Controller) InstanceMetadata(ctx context.Context, node *corev1.Node) (*cloudprovider.InstanceMetadata, error)

InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are translated into specific fields in the Node object on registration. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Controller) InstanceShutdown

func (c *Controller) InstanceShutdown(ctx context.Context, node *corev1.Node) (bool, error)

InstanceShutdown returns true if the instance is shutdown according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Controller) InstanceShutdownByProviderID

func (c *Controller) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider

func (*Controller) InstanceType

func (c *Controller) InstanceType(ctx context.Context, name types.NodeName) (string, error)

InstanceType returns the type of the specified instance.

func (*Controller) InstanceTypeByProviderID

func (c *Controller) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)

InstanceTypeByProviderID returns the type of the specified instance.

func (*Controller) Instances

func (c *Controller) Instances() (cloudprovider.Instances, bool)

Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.

func (*Controller) InstancesV2

func (c *Controller) InstancesV2() (cloudprovider.InstancesV2, bool)

InstancesV2 is an implementation for instances and should only be implemented by external cloud providers. Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce API calls to the cloud provider when registering and syncing nodes. Also returns true if the interface is supported, false otherwise. WARNING: InstancesV2 is an experimental interface and is subject to change in v1.20.

func (*Controller) ListClusters

func (c *Controller) ListClusters(ctx context.Context) ([]string, error)

ListClusters lists the names of the available clusters.

func (*Controller) ListRoutes

func (c *Controller) ListRoutes(
	ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)

ListRoutes lists all managed routes that belong to the specified clusterName

func (*Controller) LoadBalancer

func (c *Controller) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.

func (*Controller) Master

func (c *Controller) Master(ctx context.Context, clusterName string) (string, error)

Master gets back the address (either DNS name or IP address) of the master node for the cluster.

func (*Controller) NodeAddresses

func (c *Controller) NodeAddresses(ctx context.Context, name types.NodeName) ([]corev1.NodeAddress, error)

NodeAddresses returns the addresses of the specified instance. TODO(roberthbailey): This currently is only used in such a way that it returns the address of the calling instance. We should do a rename to make this clearer.

func (*Controller) NodeAddressesByProviderID

func (c *Controller) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]corev1.NodeAddress, error)

NodeAddressesByProviderID returns the addresses of the specified instance. The instance is specified using the providerID of the node. The ProviderID is a unique identifier of the node. This will not be called from the node whose nodeaddresses are being queried. i.e. local metadata services cannot be used in this method to obtain nodeaddresses

func (*Controller) ProviderName

func (c *Controller) ProviderName() string

ProviderName returns the cloud provider ID.

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, wg *sync.WaitGroup)

Reconcile resouces objects

func (*Controller) Routes

func (c *Controller) Routes() (cloudprovider.Routes, bool)

Routes returns a routes interface along with whether the interface is supported.

func (*Controller) Start

func (c *Controller) Start() error

Start caching but do not reconcile

func (*Controller) Stop

func (c *Controller) Stop() error

func (*Controller) UpdateLoadBalancer

func (c *Controller) UpdateLoadBalancer(
	ctx context.Context, clusterName string, service *corev1.Service, nodes []*corev1.Node) error

UpdateLoadBalancer updates hosts under the specified load balancer. Implementations must treat the *corev1.Service and *corev1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*Controller) Zones

func (c *Controller) Zones() (cloudprovider.Zones, bool)

Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.

Jump to

Keyboard shortcuts

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