Skip to content

Commit 0a396ea

Browse files
authored
Merge pull request #25 from RainbowMango/pr_sync_120
Sync APIs from karmada repo based on v1.12.0
2 parents 909667d + bd61308 commit 0a396ea

18 files changed

+683
-214
lines changed

cluster/types.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// +genclient:nonNamespaced
2929
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3030

31-
// Cluster represents the desire state and status of a member cluster.
31+
// Cluster represents the desired state and status of a member cluster.
3232
type Cluster struct {
3333
metav1.TypeMeta
3434
metav1.ObjectMeta
@@ -44,8 +44,8 @@ type Cluster struct {
4444
// ClusterSpec defines the desired state of a member cluster.
4545
type ClusterSpec struct {
4646
// ID is the unique identifier for the cluster.
47-
// It is different from the object uid(.metadata.uid) and typically collected automatically
48-
// from member cluster during the progress of registration.
47+
// It is different from the object uid(.metadata.uid) and is typically collected automatically
48+
// from each member cluster during the process of registration.
4949
//
5050
// The value is collected in order:
5151
// 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by
@@ -63,7 +63,7 @@ type ClusterSpec struct {
6363
// +kubebuilder:validation:Maxlength=128000
6464
ID string `json:"id,omitempty"`
6565

66-
// SyncMode describes how a cluster sync resources from karmada control plane.
66+
// SyncMode describes how a cluster syncs resources from karmada control plane.
6767
// +required
6868
SyncMode ClusterSyncMode
6969

@@ -72,14 +72,14 @@ type ClusterSpec struct {
7272
// +optional
7373
APIEndpoint string
7474

75-
// SecretRef represents the secret contains mandatory credentials to access the member cluster.
75+
// SecretRef represents the secret that contains mandatory credentials to access the member cluster.
7676
// The secret should hold credentials as follows:
7777
// - secret.data.token
7878
// - secret.data.caBundle
7979
// +optional
8080
SecretRef *LocalSecretReference
8181

82-
// ImpersonatorSecretRef represents the secret contains the token of impersonator.
82+
// ImpersonatorSecretRef represents the secret that contains the token of impersonator.
8383
// The secret should hold credentials as follows:
8484
// - secret.data.token
8585
// +optional
@@ -94,12 +94,12 @@ type ClusterSpec struct {
9494

9595
// ProxyURL is the proxy URL for the cluster.
9696
// If not empty, the karmada control plane will use this proxy to talk to the cluster.
97-
// More details please refer to: https://github.com/kubernetes/client-go/issues/351
97+
// For more details please refer to: https://github.com/kubernetes/client-go/issues/351
9898
// +optional
9999
ProxyURL string
100100

101101
// ProxyHeader is the HTTP header required by proxy server.
102-
// The key in the key-value pair is HTTP header key and value is the associated header payloads.
102+
// The key in the key-value pair is HTTP header key and the value is the associated header payloads.
103103
// For the header with multiple values, the values should be separated by comma(e.g. 'k1': 'v1,v2,v3').
104104
// +optional
105105
ProxyHeader map[string]string
@@ -108,12 +108,12 @@ type ClusterSpec struct {
108108
// +optional
109109
Provider string
110110

111-
// Region represents the region of the member cluster locate in.
111+
// Region represents the region in which the member cluster is located.
112112
// +optional
113113
Region string
114114

115-
// Zone represents the zone of the member cluster locate in.
116-
// Deprecated: This filed was never been used by Karmada, and it will not be
115+
// Zone represents the zone in which the member cluster is located.
116+
// Deprecated: This field was never used by Karmada, and it will not be
117117
// removed from v1alpha1 for backward compatibility, use Zones instead.
118118
// +optional
119119
Zone string
@@ -126,7 +126,7 @@ type ClusterSpec struct {
126126
// +optional
127127
Zones []string `json:"zones,omitempty"`
128128

129-
// Taints attached to the member cluster.
129+
// Taints are attached to the member cluster.
130130
// Taints on the cluster have the "effect" on
131131
// any resource that does not tolerate the Taint.
132132
// +optional
@@ -204,8 +204,8 @@ type ResourceModel struct {
204204

205205
// ResourceModelRange describes the detail of each modeling quota that ranges from min to max.
206206
// Please pay attention, by default, the value of min can be inclusive, and the value of max cannot be inclusive.
207-
// E.g. in an interval, min = 2, max =10 is set, which means the interval [2,10).
208-
// This rule ensure that all intervals have the same meaning. If the last interval is infinite,
207+
// E.g. in an interval, min = 2, max = 10 is set, which means the interval [2,10).
208+
// This rule ensures that all intervals have the same meaning. If the last interval is infinite,
209209
// it is definitely unreachable. Therefore, we define the right interval as the open interval.
210210
// For a valid interval, the value on the right is greater than the value on the left,
211211
// in other words, max must be greater than min.
@@ -242,13 +242,13 @@ const (
242242
type ClusterSyncMode string
243243

244244
const (
245-
// Push means that the controller on the karmada control plane will in charge of synchronization.
246-
// The controller watches resources change on karmada control plane then pushes them to member cluster.
245+
// Push means that the controller on the karmada control plane will be in charge of synchronization.
246+
// The controller watches resources change on karmada control plane and then pushes them to member cluster.
247247
Push ClusterSyncMode = "Push"
248248

249-
// Pull means that the controller running on the member cluster will in charge of synchronization.
250-
// The controller, as well known as 'agent', watches resources change on karmada control plane then fetches them
251-
// and applies locally on the member cluster.
249+
// Pull means that the controller running on the member cluster will be in charge of synchronization.
250+
// The controller, also known as 'agent', watches resources change on karmada control plane, then fetches them
251+
// and applies them locally on the member cluster.
252252
Pull ClusterSyncMode = "Pull"
253253
)
254254

@@ -258,14 +258,17 @@ type LocalSecretReference struct {
258258
// Namespace is the namespace for the resource being referenced.
259259
Namespace string
260260

261-
// Name is the name of resource being referenced.
261+
// Name is the name of the resource being referenced.
262262
Name string
263263
}
264264

265265
// Define valid conditions of a member cluster.
266266
const (
267267
// ClusterConditionReady means the cluster is healthy and ready to accept workloads.
268268
ClusterConditionReady = "Ready"
269+
270+
// ClusterConditionCompleteAPIEnablements indicates whether the cluster's API enablements(.status.apiEnablements) are complete.
271+
ClusterConditionCompleteAPIEnablements = "CompleteAPIEnablements"
269272
)
270273

271274
// ClusterStatus contains information about the current status of a
@@ -275,7 +278,7 @@ type ClusterStatus struct {
275278
// +optional
276279
KubernetesVersion string
277280

278-
// APIEnablements represents the list of APIs installed in the member cluster.
281+
// APIEnablements represents the list of APIs installed on the member cluster.
279282
// +optional
280283
APIEnablements []APIEnablement
281284

@@ -366,7 +369,7 @@ type AllocatableModeling struct {
366369

367370
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
368371

369-
// ClusterList contains a list of member cluster
372+
// ClusterList contains a list of member clusters
370373
type ClusterList struct {
371374
metav1.TypeMeta
372375
metav1.ListMeta

cluster/v1alpha1/types.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const (
3939
// +kubebuilder:resource:scope="Cluster"
4040
// +kubebuilder:subresource:status
4141

42-
// Cluster represents the desire state and status of a member cluster.
42+
// Cluster represents the desired state and status of a member cluster.
4343
type Cluster struct {
4444
metav1.TypeMeta `json:",inline"`
4545
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -55,8 +55,8 @@ type Cluster struct {
5555
// ClusterSpec defines the desired state of a member cluster.
5656
type ClusterSpec struct {
5757
// ID is the unique identifier for the cluster.
58-
// It is different from the object uid(.metadata.uid) and typically collected automatically
59-
// from member cluster during the progress of registration.
58+
// It is different from the object uid(.metadata.uid) and is typically collected automatically
59+
// from each member cluster during the process of registration.
6060
//
6161
// The value is collected in order:
6262
// 1. If the registering cluster enabled ClusterProperty API and defined the cluster ID by
@@ -74,7 +74,7 @@ type ClusterSpec struct {
7474
// +kubebuilder:validation:Maxlength=128000
7575
ID string `json:"id,omitempty"`
7676

77-
// SyncMode describes how a cluster sync resources from karmada control plane.
77+
// SyncMode describes how a cluster syncs resources from karmada control plane.
7878
// +kubebuilder:validation:Enum=Push;Pull
7979
// +required
8080
SyncMode ClusterSyncMode `json:"syncMode"`
@@ -84,14 +84,14 @@ type ClusterSpec struct {
8484
// +optional
8585
APIEndpoint string `json:"apiEndpoint,omitempty"`
8686

87-
// SecretRef represents the secret contains mandatory credentials to access the member cluster.
87+
// SecretRef represents the secret that contains mandatory credentials to access the member cluster.
8888
// The secret should hold credentials as follows:
8989
// - secret.data.token
9090
// - secret.data.caBundle
9191
// +optional
9292
SecretRef *LocalSecretReference `json:"secretRef,omitempty"`
9393

94-
// ImpersonatorSecretRef represents the secret contains the token of impersonator.
94+
// ImpersonatorSecretRef represents the secret that contains the token of impersonator.
9595
// The secret should hold credentials as follows:
9696
// - secret.data.token
9797
// +optional
@@ -106,12 +106,12 @@ type ClusterSpec struct {
106106

107107
// ProxyURL is the proxy URL for the cluster.
108108
// If not empty, the karmada control plane will use this proxy to talk to the cluster.
109-
// More details please refer to: https://github.com/kubernetes/client-go/issues/351
109+
// For more details please refer to: https://github.com/kubernetes/client-go/issues/351
110110
// +optional
111111
ProxyURL string `json:"proxyURL,omitempty"`
112112

113113
// ProxyHeader is the HTTP header required by proxy server.
114-
// The key in the key-value pair is HTTP header key and value is the associated header payloads.
114+
// The key in the key-value pair is HTTP header key and the value is the associated header payloads.
115115
// For the header with multiple values, the values should be separated by comma(e.g. 'k1': 'v1,v2,v3').
116116
// +optional
117117
ProxyHeader map[string]string `json:"proxyHeader,omitempty"`
@@ -120,12 +120,12 @@ type ClusterSpec struct {
120120
// +optional
121121
Provider string `json:"provider,omitempty"`
122122

123-
// Region represents the region of the member cluster locate in.
123+
// Region represents the region in which the member cluster is located.
124124
// +optional
125125
Region string `json:"region,omitempty"`
126126

127-
// Zone represents the zone of the member cluster locate in.
128-
// Deprecated: This filed was never been used by Karmada, and it will not be
127+
// Zone represents the zone in which the member cluster is located.
128+
// Deprecated: This field was never been used by Karmada, and it will not be
129129
// removed from v1alpha1 for backward compatibility, use Zones instead.
130130
// +optional
131131
Zone string `json:"zone,omitempty"`
@@ -138,7 +138,7 @@ type ClusterSpec struct {
138138
// +optional
139139
Zones []string `json:"zones,omitempty"`
140140

141-
// Taints attached to the member cluster.
141+
// Taints are attached to the member cluster.
142142
// Taints on the cluster have the "effect" on
143143
// any resource that does not tolerate the Taint.
144144
// +optional
@@ -216,8 +216,8 @@ type ResourceModel struct {
216216

217217
// ResourceModelRange describes the detail of each modeling quota that ranges from min to max.
218218
// Please pay attention, by default, the value of min can be inclusive, and the value of max cannot be inclusive.
219-
// E.g. in an interval, min = 2, max =10 is set, which means the interval [2,10).
220-
// This rule ensure that all intervals have the same meaning. If the last interval is infinite,
219+
// E.g. in an interval, min = 2, max = 10 is set, which means the interval [2,10).
220+
// This rule ensures that all intervals have the same meaning. If the last interval is infinite,
221221
// it is definitely unreachable. Therefore, we define the right interval as the open interval.
222222
// For a valid interval, the value on the right is greater than the value on the left,
223223
// in other words, max must be greater than min.
@@ -254,13 +254,13 @@ const (
254254
type ClusterSyncMode string
255255

256256
const (
257-
// Push means that the controller on the karmada control plane will in charge of synchronization.
258-
// The controller watches resources change on karmada control plane then pushes them to member cluster.
257+
// Push means that the controller on the karmada control plane will be in charge of synchronization.
258+
// The controller watches resources change on karmada control plane and then pushes them to member cluster.
259259
Push ClusterSyncMode = "Push"
260260

261-
// Pull means that the controller running on the member cluster will in charge of synchronization.
262-
// The controller, as well known as 'agent', watches resources change on karmada control plane then fetches them
263-
// and applies locally on the member cluster.
261+
// Pull means that the controller running on the member cluster will be in charge of synchronization.
262+
// The controller, also known as 'agent', watches resources change on karmada control plane, then fetches them
263+
// and applies them locally on the member cluster.
264264
Pull ClusterSyncMode = "Pull"
265265
)
266266

@@ -270,14 +270,17 @@ type LocalSecretReference struct {
270270
// Namespace is the namespace for the resource being referenced.
271271
Namespace string `json:"namespace"`
272272

273-
// Name is the name of resource being referenced.
273+
// Name is the name of the resource being referenced.
274274
Name string `json:"name"`
275275
}
276276

277277
// Define valid conditions of a member cluster.
278278
const (
279279
// ClusterConditionReady means the cluster is healthy and ready to accept workloads.
280280
ClusterConditionReady = "Ready"
281+
282+
// ClusterConditionCompleteAPIEnablements indicates whether the cluster's API enablements(.status.apiEnablements) are complete.
283+
ClusterConditionCompleteAPIEnablements = "CompleteAPIEnablements"
281284
)
282285

283286
// ClusterStatus contains information about the current status of a
@@ -287,7 +290,7 @@ type ClusterStatus struct {
287290
// +optional
288291
KubernetesVersion string `json:"kubernetesVersion,omitempty"`
289292

290-
// APIEnablements represents the list of APIs installed in the member cluster.
293+
// APIEnablements represents the list of APIs installed on the member cluster.
291294
// +optional
292295
APIEnablements []APIEnablement `json:"apiEnablements,omitempty"`
293296

@@ -375,7 +378,7 @@ type AllocatableModeling struct {
375378

376379
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
377380

378-
// ClusterList contains a list of member cluster
381+
// ClusterList contains a list of member clusters
379382
type ClusterList struct {
380383
metav1.TypeMeta `json:",inline"`
381384
metav1.ListMeta `json:"metadata,omitempty"`

config/v1alpha1/resourceinterpreterwebhook_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type RuleWithOperations struct {
9999
type InterpreterOperation string
100100

101101
const (
102-
// InterpreterOperationAll indicates math all InterpreterOperation.
102+
// InterpreterOperationAll indicates matching all InterpreterOperation.
103103
InterpreterOperationAll InterpreterOperation = "*"
104104

105105
// InterpreterOperationInterpretReplica indicates that karmada want to figure out the replica declaration of a specific object.

go.mod

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
module github.com/karmada-io/api
22

3-
go 1.22.0
4-
5-
toolchain go1.22.4
3+
go 1.22.9
64

75
require (
8-
k8s.io/api v0.30.2
9-
k8s.io/apiextensions-apiserver v0.30.2
10-
k8s.io/apimachinery v0.30.2
11-
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
12-
sigs.k8s.io/controller-runtime v0.18.4
6+
k8s.io/api v0.31.2
7+
k8s.io/apiextensions-apiserver v0.31.2
8+
k8s.io/apimachinery v0.31.2
9+
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
10+
sigs.k8s.io/controller-runtime v0.19.1
1311
)
1412

1513
require (
16-
github.com/go-logr/logr v1.4.1 // indirect
14+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
15+
github.com/go-logr/logr v1.4.2 // indirect
1716
github.com/gogo/protobuf v1.3.2 // indirect
1817
github.com/google/gofuzz v1.2.0 // indirect
1918
github.com/json-iterator/go v1.1.12 // indirect
2019
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2120
github.com/modern-go/reflect2 v1.0.2 // indirect
22-
golang.org/x/net v0.23.0 // indirect
23-
golang.org/x/text v0.14.0 // indirect
21+
github.com/x448/float16 v0.8.4 // indirect
22+
golang.org/x/net v0.26.0 // indirect
23+
golang.org/x/text v0.16.0 // indirect
2424
gopkg.in/inf.v0 v0.9.1 // indirect
2525
gopkg.in/yaml.v2 v2.4.0 // indirect
26-
k8s.io/klog/v2 v2.120.1 // indirect
26+
k8s.io/klog/v2 v2.130.1 // indirect
2727
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
2828
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
2929
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)