Skip to content

Commit

Permalink
Add.
Browse files Browse the repository at this point in the history
Signed-off-by: xuezhaojun <[email protected]>
  • Loading branch information
xuezhaojun committed Jan 26, 2024
1 parent e7bd1bd commit 17b17eb
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ spec:
enum:
- Enable
- Disable
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: 0
kubeAPIBurst:
description: 'KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 100'
type: integer
Expand All @@ -152,6 +158,30 @@ spec:
type: integer
format: int32
default: 50
priorityBootstrapKubeconfigs:
description: "PriorityBootstrapKubeconfigs defines the list of bootstrap kubeconfigs in order. They are used for agent to connect to multiple hubs in cases like failover, backup&restore, rollout upgrade etc. \n When the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR is set `hubAcceptsClient=false` on the hub, we call it a \"failed\" bootstrapkubeconfig. \n If that happens, the agent will try to choose another bootstrapkubeconfig from the list by order to rebootstrap. If a bootstrapkubeconfig fails, it will be marked and be filtered out from the list for the time duration of SkipFailedBootstrapKubeconfigSeconds."
type: object
properties:
localSecrets:
description: LocalSecrets is a list of secrets that contains the kubeconfigs for priority bootstrap. The secrets must be in the same namespace where the agent controller runs.
type: array
items:
description: LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
type: object
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type:
description: Type specifies the type of priority bootstrap kubeconfigs. By default, it is set to LocalSecrets.
type: string
default: LocalSecrets
skipFailedBootstrapKubeconfigSeconds:
description: SkipFailedBootstrapKubeconfigSeconds. The controller will skip the bootstrapkubeconfigs that fails recently when it rebootstraping. By default is 3 mins.
type: integer
format: int32
default: 180
minimum: 0
registrationImagePullSpec:
description: RegistrationImagePullSpec represents the desired image configuration of registration agent. quay.io/open-cluster-management.io/registration:latest will be used if unspecified.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ spec:
- feature
type: object
type: array
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: 0
type: integer
kubeAPIBurst:
default: 100
description: 'KubeAPIBurst indicates the maximum burst of the
Expand All @@ -237,6 +246,49 @@ spec:
is set empty, use the default value: 50'
format: int32
type: integer
priorityBootstrapKubeconfigs:
description: "PriorityBootstrapKubeconfigs defines the list of
bootstrap kubeconfigs in order. They are used for agent to connect
to multiple hubs in cases like failover, backup&restore, rollout
upgrade etc. \n When the agent loses the connection to the current
hub over HubConnectionTimeoutSeconds, or the managedcluster
CR is set `hubAcceptsClient=false` on the hub, we call it a
\"failed\" bootstrapkubeconfig. \n If that happens, the agent
will try to choose another bootstrapkubeconfig from the list
by order to rebootstrap. If a bootstrapkubeconfig fails, it
will be marked and be filtered out from the list for the time
duration of SkipFailedBootstrapKubeconfigSeconds."
properties:
localSecrets:
description: LocalSecrets is a list of secrets that contains
the kubeconfigs for priority bootstrap. The secrets must
be in the same namespace where the agent controller runs.
items:
description: LocalObjectReference contains enough information
to let you locate the referenced object inside the same
namespace.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
type: array
type:
default: LocalSecrets
description: Type specifies the type of priority bootstrap
kubeconfigs. By default, it is set to LocalSecrets.
type: string
type: object
skipFailedBootstrapKubeconfigSeconds:
default: 180
description: SkipFailedBootstrapKubeconfigSeconds. The controller
will skip the bootstrapkubeconfigs that fails recently when
it rebootstraping. By default is 3 mins.
format: int32
minimum: 0
type: integer
type: object
registrationImagePullSpec:
description: RegistrationImagePullSpec represents the desired image
Expand Down
46 changes: 46 additions & 0 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -156,6 +157,51 @@ type RegistrationConfiguration struct {
// +optional
// +kubebuilder:default:=100
KubeAPIBurst int32 `json:"kubeAPIBurst,omitempty"`

// PriorityBootstrapKubeconfigs defines the list of bootstrap kubeconfigs in order.
// They are used for agent to connect to multiple hubs in cases like failover, backup&restore, rollout upgrade etc.
//
// When the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR
// is set `hubAcceptsClient=false` on the hub, we call it a "failed" bootstrapkubeconfig.
//
// If that happens, the agent will try to choose another bootstrapkubeconfig from the list by order to rebootstrap.
// If a bootstrapkubeconfig fails, it will be marked and be filtered out from the list for the time duration of SkipFailedBootstrapKubeconfigSeconds.
// +optional
PriorityBootstrapKubeconfigs *PriorityBootstrapKubeconfigs `json:"priorityBootstrapKubeconfigs,omitempty"`

// 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=0
HubConnectionTimeoutSeconds int32 `json:"hubConnectionTimeoutSeconds,omitempty"`

// SkipFailedBootstrapKubeconfigSeconds. The controller will skip the bootstrapkubeconfigs that fails recently when it rebootstraping.
// By default is 3 mins.
// +optional
// +kubebuilder:default:=180
// +kubebuilder:validation:Minimum=0
SkipFailedBootstrapKubeconfigSeconds int32 `json:"skipFailedBootstrapKubeconfigSeconds,omitempty"`
}

type TypePriorityBootstrapKubeconfigs string

const (
LocalSecrets TypePriorityBootstrapKubeconfigs = "LocalSecrets"
)

type PriorityBootstrapKubeconfigs struct {
// Type specifies the type of priority bootstrap kubeconfigs.
// By default, it is set to LocalSecrets.
// +required
// +kubebuilder:default:=LocalSecrets
Type TypePriorityBootstrapKubeconfigs `json:"type,omitempty"`

// LocalSecrets is a list of secrets that contains the kubeconfigs for priority bootstrap.
// The secrets must be in the same namespace where the agent controller runs.
// +optional
LocalSecrets []corev1.LocalObjectReference `json:"localSecrets,omitempty"`
}

type WorkAgentConfiguration struct {
Expand Down
22 changes: 17 additions & 5 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 17b17eb

Please sign in to comment.