Merge pull request #2180 from RainbowMango/pr_clusterid_api
Add ID to Cluster API
This commit is contained in:
commit
73f24d39b5
|
@ -14139,6 +14139,10 @@
|
|||
"description": "The API endpoint of the member cluster. This can be a hostname, hostname:port, IP or IP:port.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "ID is the unique identifier for the cluster. It is different from the object uid(.metadata.uid) and typically collected automatically from member cluster during the progress of registration.\n\nThe value is collected in order: 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by\n creating a ClusterProperty object with name 'cluster.clusterset.k8s.io', Karmada would\n take the defined value in the ClusterProperty object.\n See https://github.com/kubernetes-sigs/about-api for more details about ClusterProperty API.\n2. Take the uid of 'kube-system' namespace on the registering cluster.\n\nPlease don't update this value unless you know what you are doing, because it will/may be used to : - uniquely identify the clusters within the Karmada system. - compose the DNS name of multi-cluster services.",
|
||||
"type": "string"
|
||||
},
|
||||
"impersonatorSecretRef": {
|
||||
"description": "ImpersonatorSecretRef represents the secret contains the token of impersonator. The secret should hold credentials as follows: - secret.data.token",
|
||||
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.cluster.v1alpha1.LocalSecretReference"
|
||||
|
|
|
@ -26,6 +26,26 @@ type Cluster struct {
|
|||
|
||||
// ClusterSpec defines the desired state of a member cluster.
|
||||
type ClusterSpec struct {
|
||||
// ID is the unique identifier for the cluster.
|
||||
// It is different from the object uid(.metadata.uid) and typically collected automatically
|
||||
// from member cluster during the progress of registration.
|
||||
//
|
||||
// The value is collected in order:
|
||||
// 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by
|
||||
// creating a ClusterProperty object with name 'cluster.clusterset.k8s.io', Karmada would
|
||||
// take the defined value in the ClusterProperty object.
|
||||
// See https://github.com/kubernetes-sigs/about-api for more details about ClusterProperty API.
|
||||
// 2. Take the uid of 'kube-system' namespace on the registering cluster.
|
||||
//
|
||||
// Please don't update this value unless you know what you are doing, because
|
||||
// it will/may be used to :
|
||||
// - uniquely identify the clusters within the Karmada system.
|
||||
// - compose the DNS name of multi-cluster services.
|
||||
//
|
||||
// +optional
|
||||
// +kubebuilder:validation:Maxlength=128000
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// SyncMode describes how a cluster sync resources from karmada control plane.
|
||||
// +required
|
||||
SyncMode ClusterSyncMode
|
||||
|
|
|
@ -37,6 +37,26 @@ type Cluster struct {
|
|||
|
||||
// ClusterSpec defines the desired state of a member cluster.
|
||||
type ClusterSpec struct {
|
||||
// ID is the unique identifier for the cluster.
|
||||
// It is different from the object uid(.metadata.uid) and typically collected automatically
|
||||
// from member cluster during the progress of registration.
|
||||
//
|
||||
// The value is collected in order:
|
||||
// 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by
|
||||
// creating a ClusterProperty object with name 'cluster.clusterset.k8s.io', Karmada would
|
||||
// take the defined value in the ClusterProperty object.
|
||||
// See https://github.com/kubernetes-sigs/about-api for more details about ClusterProperty API.
|
||||
// 2. Take the uid of 'kube-system' namespace on the registering cluster.
|
||||
//
|
||||
// Please don't update this value unless you know what you are doing, because
|
||||
// it will/may be used to :
|
||||
// - uniquely identify the clusters within the Karmada system.
|
||||
// - compose the DNS name of multi-cluster services.
|
||||
//
|
||||
// +optional
|
||||
// +kubebuilder:validation:Maxlength=128000
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// SyncMode describes how a cluster sync resources from karmada control plane.
|
||||
// +kubebuilder:validation:Enum=Push;Pull
|
||||
// +required
|
||||
|
|
|
@ -268,6 +268,7 @@ func Convert_url_Values_To_v1alpha1_ClusterProxyOptions(in *url.Values, out *Clu
|
|||
}
|
||||
|
||||
func autoConvert_v1alpha1_ClusterSpec_To_cluster_ClusterSpec(in *ClusterSpec, out *cluster.ClusterSpec, s conversion.Scope) error {
|
||||
out.ID = in.ID
|
||||
out.SyncMode = cluster.ClusterSyncMode(in.SyncMode)
|
||||
out.APIEndpoint = in.APIEndpoint
|
||||
out.SecretRef = (*cluster.LocalSecretReference)(unsafe.Pointer(in.SecretRef))
|
||||
|
@ -288,6 +289,7 @@ func Convert_v1alpha1_ClusterSpec_To_cluster_ClusterSpec(in *ClusterSpec, out *c
|
|||
}
|
||||
|
||||
func autoConvert_cluster_ClusterSpec_To_v1alpha1_ClusterSpec(in *cluster.ClusterSpec, out *ClusterSpec, s conversion.Scope) error {
|
||||
out.ID = in.ID
|
||||
out.SyncMode = ClusterSyncMode(in.SyncMode)
|
||||
out.APIEndpoint = in.APIEndpoint
|
||||
out.SecretRef = (*LocalSecretReference)(unsafe.Pointer(in.SecretRef))
|
||||
|
|
|
@ -642,6 +642,13 @@ func schema_pkg_apis_cluster_v1alpha1_ClusterSpec(ref common.ReferenceCallback)
|
|||
Description: "ClusterSpec defines the desired state of a member cluster.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"id": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ID is the unique identifier for the cluster. It is different from the object uid(.metadata.uid) and typically collected automatically from member cluster during the progress of registration.\n\nThe value is collected in order: 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by\n creating a ClusterProperty object with name 'cluster.clusterset.k8s.io', Karmada would\n take the defined value in the ClusterProperty object.\n See https://github.com/kubernetes-sigs/about-api for more details about ClusterProperty API.\n2. Take the uid of 'kube-system' namespace on the registering cluster.\n\nPlease don't update this value unless you know what you are doing, because it will/may be used to : - uniquely identify the clusters within the Karmada system. - compose the DNS name of multi-cluster services.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"syncMode": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "SyncMode describes how a cluster sync resources from karmada control plane.",
|
||||
|
|
Loading…
Reference in New Issue