spoke

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Overview

package spoke and its subpackages contain the controllers that make up the spoke agent.

Index

Constants

This section is empty.

Variables

View Source
var AddOnLeaseControllerSyncInterval = 30 * time.Second

AddOnLeaseControllerSyncInterval is exposed so that integration tests can crank up the constroller sync speed. TODO if we register the lease informer to the lease controller, we need to increase this time

Functions

This section is empty.

Types

type SpokeAgentOptions

type SpokeAgentOptions struct {
	ComponentNamespace          string
	ClusterName                 string
	AgentName                   string
	BootstrapKubeconfig         string
	HubKubeconfigSecret         string
	HubKubeconfigDir            string
	SpokeExternalServerURLs     []string
	ClusterHealthCheckPeriod    time.Duration
	MaxCustomClusterClaims      int
	SpokeKubeconfig             string
	ClientCertExpirationSeconds int32
}

SpokeAgentOptions holds configuration for spoke cluster agent

func NewSpokeAgentOptions

func NewSpokeAgentOptions() *SpokeAgentOptions

NewSpokeAgentOptions returns a SpokeAgentOptions

func (*SpokeAgentOptions) AddFlags

func (o *SpokeAgentOptions) AddFlags(fs *pflag.FlagSet)

AddFlags registers flags for Agent

func (*SpokeAgentOptions) Complete

func (o *SpokeAgentOptions) Complete(coreV1Client corev1client.CoreV1Interface, ctx context.Context, recorder events.Recorder) error

Complete fills in missing values.

func (*SpokeAgentOptions) RunSpokeAgent

func (o *SpokeAgentOptions) RunSpokeAgent(ctx context.Context, controllerContext *controllercmd.ControllerContext) error

RunSpokeAgent starts the controllers on spoke agent to register to the hub.

There are two deploy mode for the registration agent: 'Default' mode and 'Detached' mode,

  • In Default mode, the registration agent pod runs on the spoke/managed cluster.
  • In Detached mode, the registration agent pod may run on a separated cluster from the spoke/managed cluster, we define this cluster as 'management' cluster.

The spoke agent uses four kubeconfigs for different concerns:

  • The 'management' kubeconfig: used to communicate with the cluster where the agent pod runs. In Default mode, it is the managed cluster's kubeconfig; in Detached mode, it is the management cluster's kubeconfig.
  • The 'spoke' kubeconfig: used to communicate with the spoke/managed cluster which will be registered to the hub.
  • The 'bootstrap' kubeconfig: used to communicate with the hub in order to submit a CertificateSigningRequest, begin the join flow with the hub, and to write the 'hub' kubeconfig.
  • The 'hub' kubeconfig: used to communicate with the hub using a signed certificate from the hub.

RunSpokeAgent handles the following scenarios:

#1. Bootstrap kubeconfig is valid and there is no valid hub kubeconfig in secret
#2. Both bootstrap kubeconfig and hub kubeconfig are valid
#3. Bootstrap kubeconfig is invalid (e.g. certificate expired) and hub kubeconfig is valid
#4. Neither bootstrap kubeconfig nor hub kubeconfig is valid

A temporary ClientCertForHubController with bootstrap kubeconfig is created and started if the hub kubeconfig does not exist or is invalid and used to create a valid hub kubeconfig. Once the hub kubeconfig is valid, the temporary controller is stopped and the main controllers are started.

func (*SpokeAgentOptions) Validate

func (o *SpokeAgentOptions) Validate() error

Validate verifies the inputs.

Directories

Path Synopsis
package addon contains the managed cluster side controllers for updating addon status and registering addon on the hub cluster.
package addon contains the managed cluster side controllers for updating addon status and registering addon on the hub cluster.
package managedcluster contains the spoke cluster side reconciler for the SpokeCluster resource.
package managedcluster contains the spoke cluster side reconciler for the SpokeCluster resource.

Jump to

Keyboard shortcuts

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