Merge pull request #3933 from RainbowMango/pr_extend_cluster_with_zones

Extend Cluster API to support multiple zones
This commit is contained in:
karmada-bot 2023-08-21 22:06:01 +08:00 committed by GitHub
commit 48a37ab5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 2 deletions

View File

@ -16357,8 +16357,16 @@
}
},
"zone": {
"description": "Zone represents the zone of the member cluster locate in.",
"description": "Zone represents the zone of the member cluster locate in. Deprecated: This filed was never been used by Karmada, and it will not be removed from v1alpha1 for backward compatibility, use Zones instead.",
"type": "string"
},
"zones": {
"description": "Zones represents the failure zones(also called availability zones) of the member cluster. The zones are presented as a slice to support the case that cluster runs across multiple failure zones. Refer https://kubernetes.io/docs/setup/best-practices/multiple-zones/ for more details about running Kubernetes in multiple zones.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
}
},

View File

@ -117,9 +117,19 @@ type ClusterSpec struct {
Region string
// Zone represents the zone of the member cluster locate in.
// Deprecated: This filed was never been used by Karmada, and it will not be
// removed from v1alpha1 for backward compatibility, use Zones instead.
// +optional
Zone string
// Zones represents the failure zones(also called availability zones) of the
// member cluster. The zones are presented as a slice to support the case
// that cluster runs across multiple failure zones.
// Refer https://kubernetes.io/docs/setup/best-practices/multiple-zones/ for
// more details about running Kubernetes in multiple zones.
// +optional
Zones []string `json:"zones,omitempty"`
// Taints attached to the member cluster.
// Taints on the cluster have the "effect" on
// any resource that does not tolerate the Taint.

View File

@ -129,9 +129,19 @@ type ClusterSpec struct {
Region string `json:"region,omitempty"`
// Zone represents the zone of the member cluster locate in.
// Deprecated: This filed was never been used by Karmada, and it will not be
// removed from v1alpha1 for backward compatibility, use Zones instead.
// +optional
Zone string `json:"zone,omitempty"`
// Zones represents the failure zones(also called availability zones) of the
// member cluster. The zones are presented as a slice to support the case
// that cluster runs across multiple failure zones.
// Refer https://kubernetes.io/docs/setup/best-practices/multiple-zones/ for
// more details about running Kubernetes in multiple zones.
// +optional
Zones []string `json:"zones,omitempty"`
// Taints attached to the member cluster.
// Taints on the cluster have the "effect" on
// any resource that does not tolerate the Taint.

View File

@ -331,6 +331,7 @@ func autoConvert_v1alpha1_ClusterSpec_To_cluster_ClusterSpec(in *ClusterSpec, ou
out.Provider = in.Provider
out.Region = in.Region
out.Zone = in.Zone
out.Zones = *(*[]string)(unsafe.Pointer(&in.Zones))
out.Taints = *(*[]v1.Taint)(unsafe.Pointer(&in.Taints))
out.ResourceModels = *(*[]cluster.ResourceModel)(unsafe.Pointer(&in.ResourceModels))
return nil
@ -353,6 +354,7 @@ func autoConvert_cluster_ClusterSpec_To_v1alpha1_ClusterSpec(in *cluster.Cluster
out.Provider = in.Provider
out.Region = in.Region
out.Zone = in.Zone
out.Zones = *(*[]string)(unsafe.Pointer(&in.Zones))
out.Taints = *(*[]v1.Taint)(unsafe.Pointer(&in.Taints))
out.ResourceModels = *(*[]ResourceModel)(unsafe.Pointer(&in.ResourceModels))
return nil

View File

@ -170,6 +170,11 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
(*out)[key] = val
}
}
if in.Zones != nil {
in, out := &in.Zones, &out.Zones
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Taints != nil {
in, out := &in.Taints, &out.Taints
*out = make([]v1.Taint, len(*in))

View File

@ -170,6 +170,11 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
(*out)[key] = val
}
}
if in.Zones != nil {
in, out := &in.Zones, &out.Zones
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Taints != nil {
in, out := &in.Taints, &out.Taints
*out = make([]v1.Taint, len(*in))

View File

@ -1359,11 +1359,26 @@ func schema_pkg_apis_cluster_v1alpha1_ClusterSpec(ref common.ReferenceCallback)
},
"zone": {
SchemaProps: spec.SchemaProps{
Description: "Zone represents the zone of the member cluster locate in.",
Description: "Zone represents the zone of the member cluster locate in. Deprecated: This filed was never been used by Karmada, and it will not be removed from v1alpha1 for backward compatibility, use Zones instead.",
Type: []string{"string"},
Format: "",
},
},
"zones": {
SchemaProps: spec.SchemaProps{
Description: "Zones represents the failure zones(also called availability zones) of the member cluster. The zones are presented as a slice to support the case that cluster runs across multiple failure zones. Refer https://kubernetes.io/docs/setup/best-practices/multiple-zones/ for more details about running Kubernetes in multiple zones.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"taints": {
SchemaProps: spec.SchemaProps{
Description: "Taints attached to the member cluster. Taints on the cluster have the \"effect\" on any resource that does not tolerate the Taint.",