Documentation ¶
Index ¶
- type FailoverAgentOptions
- func (o *FailoverAgentOptions) AddFlags(fs *pflag.FlagSet)
- func (o *FailoverAgentOptions) Complete(coreV1Client corev1client.CoreV1Interface, ctx context.Context, ...) error
- func (o *FailoverAgentOptions) RunFailoverAgent(ctx context.Context, controllerContext *controllercmd.ControllerContext) error
- func (o *FailoverAgentOptions) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailoverAgentOptions ¶
type FailoverAgentOptions struct { ComponentNamespace string ClusterName string AgentName string BootstrapKubeconfig string HubKubeconfigSecret string HubKubeconfigDir string SpokeExternalServerURLs []string ClusterHealthCheckPeriod time.Duration MaxCustomClusterClaims int }
FailoverAgentOptions holds configuration for spoke cluster agent
func NewFailoverAgentOptions ¶
func NewFailoverAgentOptions() *FailoverAgentOptions
NewFailoverAgentOptions returns a FailoverAgentOptions
func (*FailoverAgentOptions) AddFlags ¶
func (o *FailoverAgentOptions) AddFlags(fs *pflag.FlagSet)
AddFlags registers flags for Agent
func (*FailoverAgentOptions) Complete ¶
func (o *FailoverAgentOptions) Complete(coreV1Client corev1client.CoreV1Interface, ctx context.Context, recorder events.Recorder) error
Complete fills in missing values.
func (*FailoverAgentOptions) RunFailoverAgent ¶
func (o *FailoverAgentOptions) RunFailoverAgent(ctx context.Context, controllerContext *controllercmd.ControllerContext) error
RunSpokeAgent starts the controllers on spoke agent to register to the hub.
The spoke agent uses three kubeconfigs for different concerns:
- The 'spoke' kubeconfig: used to communicate with the spoke cluster where the agent is running.
- 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 (*FailoverAgentOptions) Validate ¶
func (o *FailoverAgentOptions) Validate() error
Validate verifies the inputs.