Documentation ¶
Index ¶
- func CheckAPIVersionFallback(kubeClient kubeclient.Interface) (list []*metav1.APIResourceList)
- type Controller
- func (c *Controller) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (m *Controller) AddStreamCreation(name string, sid uint64, creationTimeout time.Duration, ...)
- func (m *Controller) AddUnarySession(name string, sid uint64, timeout time.Duration, ...)
- func (c *Controller) Clusters() (cloudprovider.Clusters, bool)
- func (c *Controller) CreateRoute(ctx context.Context, clusterName string, nameHint string, ...) error
- func (c *Controller) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
- func (c *Controller) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error
- func (m *Controller) DeleteSession(name string, sid uint64)
- func (c *Controller) EnsureLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service, ...) (*corev1.LoadBalancerStatus, error)
- func (c *Controller) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *corev1.Service) error
- func (c *Controller) GetConfigMap(name string) *corev1.ConfigMap
- func (c *Controller) GetLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service) (status *corev1.LoadBalancerStatus, exists bool, err error)
- func (c *Controller) GetLoadBalancerName(ctx context.Context, clusterName string, service *corev1.Service) string
- func (c *Controller) GetNode(name string) *corev1.Node
- func (c *Controller) GetPod(name string) *corev1.Pod
- func (c *Controller) GetSecret(name string) *corev1.Secret
- func (m *Controller) GetSessions(name string) (timedSessionIDs []uint64)
- func (c *Controller) GetVirtualPod(name string) *corev1.Pod
- func (c *Controller) GetZone(ctx context.Context) (cloudprovider.Zone, error)
- func (c *Controller) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
- func (c *Controller) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (c *Controller) HasClusterID() bool
- func (c *Controller) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})
- func (c *Controller) InstanceExists(ctx context.Context, node *corev1.Node) (bool, error)
- func (c *Controller) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
- func (c *Controller) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
- func (c *Controller) InstanceMetadata(ctx context.Context, node *corev1.Node) (*cloudprovider.InstanceMetadata, error)
- func (c *Controller) InstanceShutdown(ctx context.Context, node *corev1.Node) (bool, error)
- func (c *Controller) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
- func (c *Controller) InstanceType(ctx context.Context, name types.NodeName) (string, error)
- func (c *Controller) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
- func (c *Controller) Instances() (cloudprovider.Instances, bool)
- func (c *Controller) InstancesV2() (cloudprovider.InstancesV2, bool)
- func (c *Controller) ListClusters(ctx context.Context) ([]string, error)
- func (c *Controller) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)
- func (c *Controller) ListServices() []*corev1.Service
- func (c *Controller) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (c *Controller) Master(ctx context.Context, clusterName string) (string, error)
- func (c *Controller) NodeAddresses(ctx context.Context, name types.NodeName) ([]corev1.NodeAddress, error)
- func (c *Controller) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]corev1.NodeAddress, error)
- func (c *Controller) ProviderName() string
- func (c *Controller) Reconcile(ctx context.Context, wg *sync.WaitGroup)
- func (c *Controller) Routes() (cloudprovider.Routes, bool)
- func (c *Controller) Start() error
- func (c *Controller) Stop() error
- func (c *Controller) UpdateLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service, ...) error
- func (c *Controller) UpdateVirtualPodStatus(name string, po *corev1.Pod)
- func (c *Controller) Zones() (cloudprovider.Zones, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAPIVersionFallback ¶
func CheckAPIVersionFallback(kubeClient kubeclient.Interface) (list []*metav1.APIResourceList)
CheckAPIVersionFallback returns minimum fallback api resources expected by the edgedevice controller
returned result shoulde only be used when you have failed to discover api resources via kubernetes api discovery
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)
NewController creates a new idle edgedevice controller
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>
AddSSHKeyToAllInstances implements cloudprovider.Instances
func (*Controller) AddStreamCreation ¶
func (m *Controller) AddStreamCreation(name string, sid uint64, creationTimeout time.Duration, onCreationTimeout connectivity.SessionTimeoutHandleFunc)
AddTimedStreamCreation implements connectivity.TimedSessionManager
func (*Controller) AddUnarySession ¶
func (m *Controller) AddUnarySession(name string, sid uint64, timeout time.Duration, onSessionTimeout connectivity.SessionTimeoutHandleFunc)
AddTimedSession implements connectivity.TimedSessionManager
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.
Clusters implements cloudprovider.Interface
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.
CreateRoute implements cloudprovider.Routes
func (*Controller) CurrentNodeName ¶
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
CurrentNodeName implements cloudprovider.Instances
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
DeleteRoute implements cloudprovider.Routes
func (*Controller) DeleteSession ¶
DelTimedSession implements connectivity.TimedSessionManager
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 *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
EnsureLoadBalancer implements cloudprovider.LoadBalancer
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 *v1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
EnsureLoadBalancerDeleted implements cloudprovider.LoadBalancer
func (*Controller) GetConfigMap ¶
func (c *Controller) GetConfigMap(name string) *corev1.ConfigMap
GetConfigMap implements pod.KubeResouceManager
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 *v1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
GetLoadBalancer implements cloudprovider.LoadBalancer
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 *v1.Service parameter as read-only and not modify it.
GetLoadBalancerName implements cloudprovider.LoadBalancer
func (*Controller) GetNode ¶
func (c *Controller) GetNode(name string) *corev1.Node
GetNode implements pod.KubeResouceManager
func (*Controller) GetPod ¶
func (c *Controller) GetPod(name string) *corev1.Pod
GetPod implements pod.KubeResouceManager
func (*Controller) GetSecret ¶
func (c *Controller) GetSecret(name string) *corev1.Secret
GetSecret implements pod.KubeResouceManager
func (*Controller) GetSessions ¶
GetTimedSessions implements connectivity.TimedSessionManager
func (*Controller) GetVirtualPod ¶
func (c *Controller) GetVirtualPod(name string) *corev1.Pod
GetVirtualPod implements pod.KubeResouceManager
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.
GetZone implements cloudprovider.Zones
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.
GetZoneByNodeName implements cloudprovider.Zones
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.
GetZoneByProviderID implements cloudprovider.Zones
func (*Controller) HasClusterID ¶
func (c *Controller) HasClusterID() bool
HasClusterID returns true if a ClusterID is required and set
HasClusterID implements cloudprovider.Interface
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.
Initialize implements cloudprovider.Interface
func (*Controller) InstanceExists ¶
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.
InstanceExists implements cloudprovider.InstancesV2
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.
InstanceExistsByProviderID implements cloudprovider.Instances
func (*Controller) InstanceID ¶
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
InstanceID implements cloudprovider.Instances
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 and labels in the Node object on registration. Implementations should always check node.spec.providerID first when trying to discover the instance for a given node. In cases where node.spec.providerID is empty, implementations can use other properties of the node like its name, labels and annotations.
InstanceMetadata implements cloudprovider.InstancesV2
func (*Controller) InstanceShutdown ¶
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.
InstanceShutdown implements cloudprovider.InstancesV2
func (*Controller) InstanceShutdownByProviderID ¶
func (c *Controller) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider
InstanceShutdownByProviderID implements cloudprovider.Instances
func (*Controller) InstanceType ¶
InstanceType returns the type of the specified instance.
InstanceType implements cloudprovider.Instances
func (*Controller) InstanceTypeByProviderID ¶
func (c *Controller) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
InstanceTypeByProviderID returns the type of the specified instance.
InstanceTypeByProviderID implements cloudprovider.Instances
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.
Instances implements cloudprovider.Interface
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. Implementation of this interface will disable calls to the Zones interface. Also returns true if the interface is supported, false otherwise.
InstancesV2 implements cloudprovider.Interface
func (*Controller) ListClusters ¶
func (c *Controller) ListClusters(ctx context.Context) ([]string, error)
ListClusters lists the names of the available clusters.
ListClusters implements cloudprovider.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
ListRoutes implements cloudprovider.Routes
func (*Controller) ListServices ¶
func (c *Controller) ListServices() []*corev1.Service
ListServices implements pod.KubeResouceManager
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.
LoadBalancer implements cloudprovider.Interface
func (*Controller) Master ¶
Master gets back the address (either DNS name or IP address) of the master node for the cluster.
Master implements cloudprovider.Clusters
func (*Controller) NodeAddresses ¶
func (c *Controller) NodeAddresses(ctx context.Context, name types.NodeName) ([]corev1.NodeAddress, error)
NodeAddresses returns the addresses of the specified instance.
NodeAddresses implements cloudprovider.Instances
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
NodeAddressesByProviderID implements cloudprovider.Instances
func (*Controller) ProviderName ¶
func (c *Controller) ProviderName() string
ProviderName returns the cloud provider ID.
ProviderName implements cloudprovider.Interface
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.
Routes implements cloudprovider.Interface
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 *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
UpdateLoadBalancer implements cloudprovider.LoadBalancer
func (*Controller) UpdateVirtualPodStatus ¶
func (c *Controller) UpdateVirtualPodStatus(name string, po *corev1.Pod)
UpdateVirtualPodStatus implements pod.KubeResouceManager
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. DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. This interface will not be called if InstancesV2 is enabled.
Zones implements cloudprovider.Interface