Skip to content

Commit dbaa116

Browse files
committed
refactor: many things
Signed-off-by: Artur Shad Nik <arturshadnik@gmail.com>
1 parent 0d3fceb commit dbaa116

File tree

7 files changed

+90
-142
lines changed

7 files changed

+90
-142
lines changed

fleetconfig-controller/api/v1beta1/hub_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ type InstalledHubAddOn struct {
223223
// +kubebuilder:object:root=true
224224
// +kubebuilder:subresource:status
225225
// +kubebuilder:resource:scope=Cluster
226-
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'hub'",message="Hub is a cluster singleton; name must be 'hub'"
227226
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
228227
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
229228

fleetconfig-controller/api/v1beta1/spoke_types.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ type SpokeSpec struct {
3434
// +optional
3535
CreateNamespace bool `json:"createNamespace,omitempty"`
3636

37+
// HubRef is a reference to the Hub that this Spoke is managed by.
38+
// +required
39+
HubRef HubRef `json:"hubRef"`
40+
3741
// If true, sync the labels from klusterlet to all agent resources.
3842
// +optional
3943
SyncLabels bool `json:"syncLabels,omitempty"`
@@ -64,12 +68,6 @@ type SpokeSpec struct {
6468
// +optional
6569
AddOns []AddOn `json:"addOns,omitempty"`
6670

67-
// The Spoke's RegistrationAuth is automatically managed by the controller. It will be inherited from the Hub's spec.registrationAuth field
68-
// and should not be set when creating a spoke.
69-
// +kubebuilder:default:={}
70-
// +optional
71-
RegistrationAuth RegistrationAuth `json:"registrationAuth,omitzero"`
72-
7371
// Timeout is the timeout in seconds for all clusteradm operations, including init, accept, join, upgrade, etc.
7472
// +kubebuilder:default:=300
7573
// +optional
@@ -82,6 +80,13 @@ type SpokeSpec struct {
8280
LogVerbosity int `json:"logVerbosity,omitempty"`
8381
}
8482

83+
// HubRef is the information required to get a Hub resource.
84+
type HubRef struct {
85+
// Name is the name of the Hub that this Spoke is managed by.
86+
// +required
87+
Name string `json:"name"`
88+
}
89+
8590
// Klusterlet is the configuration for a klusterlet.
8691
type Klusterlet struct {
8792
// Annotations to apply to the spoke cluster. If not present, the 'agent.open-cluster-management.io/' prefix is added to each key.
@@ -138,13 +143,6 @@ type Klusterlet struct {
138143
// +optional
139144
Singleton bool `json:"singleton,omitempty"`
140145

141-
// Version and image registry details for the klusterlet. The Spoke's Source is automatically managed by the controller. It will be inherited from the Hub's
142-
// spec.clusterManager.source field
143-
// and should not be set when creating a spoke.
144-
// +kubebuilder:default:={}
145-
// +optional
146-
Source OCMSource `json:"source,omitzero"`
147-
148146
// ValuesFrom is an optional reference to a ConfigMap containing values for the klusterlet Helm chart.
149147
// optional
150148
ValuesFrom *ConfigMapRef `json:"valuesFrom,omitempty"`
@@ -257,7 +255,7 @@ type SpokeStatus struct {
257255

258256
// +kubebuilder:object:root=true
259257
// +kubebuilder:subresource:status
260-
// +kubebuilder:resource:path=spokes,scope=Cluster
258+
// +kubebuilder:resource:path=spokes
261259
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
262260
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
263261

fleetconfig-controller/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fleetconfig-controller/charts/fleetconfig-controller/crds/fleetconfig.open-cluster-management.io_hubs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,6 @@ spec:
421421
required:
422422
- spec
423423
type: object
424-
x-kubernetes-validations:
425-
- message: Hub is a cluster singleton; name must be 'hub'
426-
rule: self.metadata.name == 'hub'
427424
served: true
428425
storage: true
429426
subresources:

fleetconfig-controller/charts/fleetconfig-controller/crds/fleetconfig.open-cluster-management.io_spokes.yaml

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
listKind: SpokeList
1313
plural: spokes
1414
singular: spoke
15-
scope: Cluster
15+
scope: Namespaced
1616
versions:
1717
- additionalPrinterColumns:
1818
- jsonPath: .status.phase
@@ -79,6 +79,17 @@ spec:
7979
If true, create open-cluster-management namespace and agent namespace (open-cluster-management-agent for Default mode,
8080
<klusterlet-name> for Hosted mode), otherwise use existing one.
8181
type: boolean
82+
hubRef:
83+
description: HubRef is a reference to the Hub that this Spoke is managed
84+
by.
85+
properties:
86+
name:
87+
description: Name is the name of the Hub that this Spoke is managed
88+
by.
89+
type: string
90+
required:
91+
- name
92+
type: object
8293
klusterlet:
8394
default: {}
8495
description: Klusterlet configuration.
@@ -206,25 +217,6 @@ spec:
206217
If true, deploy klusterlet in singleton mode, with registration and work agents running in a single pod.
207218
This is an alpha stage flag.
208219
type: boolean
209-
source:
210-
default: {}
211-
description: |-
212-
Version and image registry details for the klusterlet. The Spoke's Source is automatically managed by the controller. It will be inherited from the Hub's
213-
spec.clusterManager.source field
214-
and should not be set when creating a spoke.
215-
properties:
216-
bundleVersion:
217-
default: default
218-
description: |-
219-
The version of predefined compatible image versions (e.g. v0.6.0). Defaults to the latest released version.
220-
You can also set "latest" to install the latest development version.
221-
type: string
222-
registry:
223-
default: quay.io/open-cluster-management
224-
description: The name of the image registry serving OCM images,
225-
which will be used for all OCM components."
226-
type: string
227-
type: object
228220
values:
229221
description: Values for the klusterlet Helm chart. Values defined
230222
here override values which are defined in ValuesFrom.
@@ -2288,36 +2280,6 @@ spec:
22882280
description: URL of a forward proxy server used by agents to connect
22892281
to the Hub cluster.
22902282
type: string
2291-
registrationAuth:
2292-
default: {}
2293-
description: |-
2294-
The Spoke's RegistrationAuth is automatically managed by the controller. It will be inherited from the Hub's spec.registrationAuth field
2295-
and should not be set when creating a spoke.
2296-
properties:
2297-
autoApprovedARNPatterns:
2298-
description: |-
2299-
List of AWS EKS ARN patterns so any EKS clusters with these patterns will be auto accepted to join with hub cluster.
2300-
Example pattern: "arn:aws:eks:us-west-2:123456789013:cluster/.*"
2301-
items:
2302-
type: string
2303-
type: array
2304-
driver:
2305-
default: csr
2306-
description: |-
2307-
The registration authentication driver to use.
2308-
Options are:
2309-
- csr: Use the default CSR-based registration authentication.
2310-
- awsirsa: Use AWS IAM Role for Service Accounts (IRSA) registration authentication.
2311-
The set of valid options is open for extension.
2312-
enum:
2313-
- csr
2314-
- awsirsa
2315-
type: string
2316-
hubClusterARN:
2317-
description: The Hub cluster ARN for awsirsa registration authentication.
2318-
Required when Type is awsirsa, otherwise ignored.
2319-
type: string
2320-
type: object
23212283
syncLabels:
23222284
description: If true, sync the labels from klusterlet to all agent
23232285
resources.
@@ -2328,6 +2290,7 @@ spec:
23282290
operations, including init, accept, join, upgrade, etc.
23292291
type: integer
23302292
required:
2293+
- hubRef
23312294
- kubeconfig
23322295
type: object
23332296
status:

0 commit comments

Comments
 (0)