Documentation
¶
Overview ¶
package spoke and its subpackages contain the controllers that make up the spoke agent.
Index ¶
- Variables
- type SpokeAgentConfig
- func (o *SpokeAgentConfig) HealthCheckers() []healthz.HealthChecker
- func (o *SpokeAgentConfig) IsHubKubeConfigValid(ctx context.Context) (bool, error)
- func (o *SpokeAgentConfig) RunSpokeAgent(ctx context.Context, controllerContext *controllercmd.ControllerContext) error
- func (o *SpokeAgentConfig) RunSpokeAgentWithSpokeInformers(ctx context.Context, kubeConfig, spokeClientConfig *rest.Config, ...) error
- type SpokeAgentOptions
Constants ¶
This section is empty.
Variables ¶
var AddOnLeaseControllerSyncInterval = 30 * time.Second
AddOnLeaseControllerSyncInterval is exposed so that integration tests can crank up the controller sync speed. TODO if we register the lease informer to the lease controller, we need to increase this time
var ClientCertHealthCheckInterval = 30 * time.Second
Functions ¶
This section is empty.
Types ¶
type SpokeAgentConfig ¶ added in v0.12.0
type SpokeAgentConfig struct {
// contains filtered or unexported fields
}
func NewSpokeAgentConfig ¶ added in v0.12.0
func NewSpokeAgentConfig(commonOpts *commonoptions.AgentOptions, opts *SpokeAgentOptions, cancel context.CancelFunc) *SpokeAgentConfig
NewSpokeAgentConfig returns a SpokeAgentConfig
func (*SpokeAgentConfig) HealthCheckers ¶ added in v0.15.0
func (o *SpokeAgentConfig) HealthCheckers() []healthz.HealthChecker
func (*SpokeAgentConfig) IsHubKubeConfigValid ¶ added in v0.15.0
func (o *SpokeAgentConfig) IsHubKubeConfigValid(ctx context.Context) (bool, error)
func (*SpokeAgentConfig) RunSpokeAgent ¶ added in v0.12.0
func (o *SpokeAgentConfig) 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 BootstrapController 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.
The agent will be restarted once any of the following happens:
- the bootstrap hub kubeconfig changes (updated/deleted);
- the client certificate referenced by the hub kubeconfig become expired (Return failure when checking the health of the agent);
func (*SpokeAgentConfig) RunSpokeAgentWithSpokeInformers ¶ added in v0.12.0
func (o *SpokeAgentConfig) RunSpokeAgentWithSpokeInformers(ctx context.Context, kubeConfig, spokeClientConfig *rest.Config, spokeKubeClient kubernetes.Interface, spokeKubeInformerFactory informers.SharedInformerFactory, spokeClusterInformerFactory clusterv1informers.SharedInformerFactory, recorder events.Recorder) error
type SpokeAgentOptions ¶
type SpokeAgentOptions struct { // The differences among BootstrapKubeconfig, BootstrapKubeconfigSecret, BootstrapKubeconfigSecrets are: // 1. BootstrapKubeconfig is a file path, the controller uses it to build the client. // 2. BootstrapKubeconfigSecret is the secret, an event handler will watch it, if the secret is changed, then rebootstrap. // 3. BootstrapKubeconfigs is a list of file path, the controller uses one of its item to build the client. // BootstrapKubeconfigs can only be used when MultipleHubs is enabled. BootstrapKubeconfig string BootstrapKubeconfigSecret string BootstrapKubeconfigs []string // TODO: The hubConnectionTimoutSeconds should always greater than leaseDurationSeconds, we need to make timeout as a build-in part of // leaseController in the future and relate timeoutseconds to leaseDurationSeconds. @xuezhaojun // See more details in: https://github.com/open-cluster-management-io/ocm/pull/443#discussion_r1610868646 HubConnectionTimeoutSeconds int32 HubKubeconfigSecret string SpokeExternalServerURLs []string ClusterHealthCheckPeriod time.Duration MaxCustomClusterClaims int ClientCertExpirationSeconds int32 ClusterAnnotations map[string]string RegistrationAuth string HubClusterArn string ManagedClusterArn string ManagedClusterRoleSuffix string }
SpokeAgentOptions holds configuration for spoke cluster agent
func NewSpokeAgentOptions ¶
func NewSpokeAgentOptions() *SpokeAgentOptions
func (*SpokeAgentOptions) AddFlags ¶
func (o *SpokeAgentOptions) AddFlags(fs *pflag.FlagSet)
AddFlags registers flags for Agent
func (*SpokeAgentOptions) Validate ¶
func (o *SpokeAgentOptions) Validate() error
Validate verifies the inputs.
Source Files
¶
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. |