Skip to content

Commit

Permalink
Add API field for switch-hub. (#317)
Browse files Browse the repository at this point in the history
Signed-off-by: xuezhaojun <[email protected]>
  • Loading branch information
xuezhaojun authored Apr 18, 2024
1 parent dd20b78 commit 018915d
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ spec:
description: RegistrationConfiguration contains the configuration of registration
type: object
properties:
bootstrapKubeConfigs:
description: "BootstrapKubeConfigs defines the ordered list of bootstrap kubeconfigs. The order decides which bootstrap kubeconfig to use first when rebootstrap. \n When the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR is set `hubAcceptsClient=false` on the hub, the controller marks the related bootstrap kubeconfig as \"failed\". \n A failed bootstrapkubeconfig won't be used for the duration specified by SkipFailedBootstrapKubeConfigSeconds. But if the user updates the content of a failed bootstrapkubeconfig, the \"failed\" mark will be cleared."
type: object
properties:
localSecretsConfig:
description: LocalSecretsConfig include a list of secrets that contains the kubeconfigs for ordered bootstrap kubeconifigs. The secrets must be in the same namespace where the agent controller runs.
type: object
properties:
hubConnectionTimeoutSeconds:
description: HubConnectionTimeoutSeconds is used to set the timeout of connecting to the hub cluster. When agent loses the connection to the hub over the timeout seconds, the agent do a rebootstrap. By default is 10 mins.
type: integer
format: int32
default: 600
minimum: 180
secretNames:
description: SecretNames is a list of secret names. The secrets are in the same namespace where the agent controller runs.
type: array
items:
type: string
type:
description: Type specifies the type of priority bootstrap kubeconfigs. By default, it is set to None, representing no priority bootstrap kubeconfigs are set.
type: string
default: None
enum:
- None
- LocalSecrets
clientCertExpirationSeconds:
description: clientCertExpirationSeconds represents the seconds of a client certificate to expire. If it is not set or 0, the default duration seconds will be set by the hub cluster. If the value is larger than the max signing duration seconds set on the hub cluster, the max signing duration seconds will be set.
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,51 @@ spec:
description: RegistrationConfiguration contains the configuration
of registration
properties:
bootstrapKubeConfigs:
description: "BootstrapKubeConfigs defines the ordered list of
bootstrap kubeconfigs. The order decides which bootstrap kubeconfig
to use first when rebootstrap. \n When the agent loses the connection
to the current hub over HubConnectionTimeoutSeconds, or the
managedcluster CR is set `hubAcceptsClient=false` on the hub,
the controller marks the related bootstrap kubeconfig as \"failed\".
\n A failed bootstrapkubeconfig won't be used for the duration
specified by SkipFailedBootstrapKubeConfigSeconds. But if the
user updates the content of a failed bootstrapkubeconfig, the
\"failed\" mark will be cleared."
properties:
localSecretsConfig:
description: LocalSecretsConfig include a list of secrets
that contains the kubeconfigs for ordered bootstrap kubeconifigs.
The secrets must be in the same namespace where the agent
controller runs.
properties:
hubConnectionTimeoutSeconds:
default: 600
description: HubConnectionTimeoutSeconds is used to set
the timeout of connecting to the hub cluster. When agent
loses the connection to the hub over the timeout seconds,
the agent do a rebootstrap. By default is 10 mins.
format: int32
minimum: 180
type: integer
secretNames:
description: SecretNames is a list of secret names. The
secrets are in the same namespace where the agent controller
runs.
items:
type: string
type: array
type: object
type:
default: None
description: Type specifies the type of priority bootstrap
kubeconfigs. By default, it is set to None, representing
no priority bootstrap kubeconfigs are set.
enum:
- None
- LocalSecrets
type: string
type: object
clientCertExpirationSeconds:
description: clientCertExpirationSeconds represents the seconds
of a client certificate to expire. If it is not set or 0, the
Expand Down
46 changes: 46 additions & 0 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,52 @@ type RegistrationConfiguration struct {
// +optional
// +kubebuilder:default:=100
KubeAPIBurst int32 `json:"kubeAPIBurst,omitempty"`

// BootstrapKubeConfigs defines the ordered list of bootstrap kubeconfigs. The order decides which bootstrap kubeconfig to use first when rebootstrap.
//
// When the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR
// is set `hubAcceptsClient=false` on the hub, the controller marks the related bootstrap kubeconfig as "failed".
//
// A failed bootstrapkubeconfig won't be used for the duration specified by SkipFailedBootstrapKubeConfigSeconds.
// But if the user updates the content of a failed bootstrapkubeconfig, the "failed" mark will be cleared.
// +optional
BootstrapKubeConfigs BootstrapKubeConfigs `json:"bootstrapKubeConfigs,omitempty"`
}

type TypeBootstrapKubeConfigs string

const (
LocalSecrets TypeBootstrapKubeConfigs = "LocalSecrets"
None TypeBootstrapKubeConfigs = "None"
)

type BootstrapKubeConfigs struct {
// Type specifies the type of priority bootstrap kubeconfigs.
// By default, it is set to None, representing no priority bootstrap kubeconfigs are set.
// +required
// +kubebuilder:default:=None
// +kubebuilder:validation:Enum=None;LocalSecrets
Type TypeBootstrapKubeConfigs `json:"type,omitempty"`

// LocalSecretsConfig include a list of secrets that contains the kubeconfigs for ordered bootstrap kubeconifigs.
// The secrets must be in the same namespace where the agent controller runs.
// +optional
LocalSecrets LocalSecretsConfig `json:"localSecretsConfig,omitempty"`
}

type LocalSecretsConfig struct {
// SecretNames is a list of secret names. The secrets are in the same namespace where the agent controller runs.
// +required
// +kubebuilder:validation:minItems=2
SecretNames []string `json:"secretNames"`

// HubConnectionTimeoutSeconds is used to set the timeout of connecting to the hub cluster.
// When agent loses the connection to the hub over the timeout seconds, the agent do a rebootstrap.
// By default is 10 mins.
// +optional
// +kubebuilder:default:=600
// +kubebuilder:validation:Minimum=180
HubConnectionTimeoutSeconds int32 `json:"hubConnectionTimeoutSeconds,omitempty"`
}

type WorkAgentConfiguration struct {
Expand Down
19 changes: 19 additions & 0 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 018915d

Please sign in to comment.