-
Notifications
You must be signed in to change notification settings - Fork 7
✨implement separate hub and spoke resources #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 72 commits into
open-cluster-management-io:main
from
arturshadnik:refactor/v1beta1-implementation
Sep 24, 2025
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
4485aa4
feat: wip - fill out v1beta1 structs
arturshadnik 86bf83c
wip: working hub init
arturshadnik 2a5bc4f
chore: make reviewable
arturshadnik 08832b2
refactor: conditions
arturshadnik 29987a1
fix: implement spoke cleanup
arturshadnik 2803c9a
wip: implement addons
arturshadnik aa08e87
chore: make reviewable
arturshadnik fd3dcad
chore: make reviewable
arturshadnik 746f862
chore: fix test data
arturshadnik 6244ee0
feat: background delete spokes during hub deletion
arturshadnik 7c44c46
fix: allow parallel spoke reconciles; actually do hub cleanup
arturshadnik f7806d0
refactor: simplify addon conds; disable hubAddons during cleanup
arturshadnik bf4356f
refactor: dont fail if hub not found
arturshadnik 9605565
feat: allow global and per-spoke klusterlet values
arturshadnik 067d30e
refactor: use 3rd party merge lib; set managed spoke fields
arturshadnik 06fc5b7
chore: make reviewable
arturshadnik 5f1ff8b
refactor: get addon state from cluster not status
arturshadnik a1707de
fix: tweak hub addon reconcile
arturshadnik 88f626a
chore: prevent flooding stdout
arturshadnik c3c71f3
feat: watch resource updates to speed up syncs
arturshadnik 4eb6d11
chore: make reviewable
arturshadnik 150fc36
fix: spelling
arturshadnik cdc32f1
feat: webhooks
arturshadnik 0243f24
chore: some rabbit comments
arturshadnik 47d86dd
fix: dont append empty annotations
arturshadnik c8b0322
chore: update validation, skip redundant hub cleanup checks
arturshadnik 6eff13a
chore: tighten spoke reconcile predicate
arturshadnik ed0a7c6
chore: make reviewable
arturshadnik 7eefdeb
chore: add kubeconfig validation on update
arturshadnik 6aecfb2
chore: add kubeconfig validation on update
arturshadnik f4511e1
refactor: many things
arturshadnik bf6bf15
chore: error handling
arturshadnik 4643f71
fix: update event map for enqueue
arturshadnik ba02421
chore: tweak enqueue mapping
arturshadnik 7e83ca8
chore: allow apiServer updates
arturshadnik e3d450d
fix: guard against nil hub in spoke upgrade; only delete spokes manag…
arturshadnik 129bbed
chore: nil check
arturshadnik b2ff694
feat: namespaced hub
arturshadnik ef89a47
feat: v1beta1 secret namespace
arturshadnik 17d41a3
refactor: fix resource interface
arturshadnik d09a867
test: fix int test scaffolds
arturshadnik 7b73c91
test: add controller integration tests
arturshadnik 7316a3b
test: add webhook int tests
arturshadnik 2e3e861
chore: delete unused hub defaulting webhook
arturshadnik a2db669
test: add some unit tests
arturshadnik a663204
feat: update helm webhook configs
arturshadnik a351d4a
chore: dont requeue spoke if hub timeout/verbosity updated
arturshadnik 34956a0
fix: remove defaulter, set overrides in controller
arturshadnik 9a32b4a
chore: helm chart
arturshadnik ce7ba4f
fix: helm template, values
arturshadnik 92454b1
fix: tweak helm chart
arturshadnik 6b93ba7
fix: guard against nil configmap ref
arturshadnik 67c5162
test: WIP - add e2e tests
arturshadnik cdd5f99
test: reintroduce v1alpha1 suite
arturshadnik a84e71b
chore: make reviewable
arturshadnik 3e52951
test: fix v1alpha1 tests; update chart
arturshadnik 193a894
ci: label filters
arturshadnik 6b2a5ee
ci: change label filter collector logic
arturshadnik a435735
fix: var name
arturshadnik f1ed7b5
test: update test helper
arturshadnik 1f7ac98
chore: validation wording
arturshadnik aca5865
ci: only run planner on pull_request_target
arturshadnik 1fe2e37
chore: rabbit
arturshadnik 0581ab0
feat: long-lived addon clientset for webhooks
arturshadnik a63fc4e
fix: add back pull_request event for now
arturshadnik 458d731
test: update tests
arturshadnik 97a64fa
chore: enforce hub one-of condition
arturshadnik 909e45e
chore: move code around
arturshadnik 56f697c
chore: address review comments
arturshadnik 8b57afa
chore: default labels
arturshadnik ba77a5a
ci: always apply labels
arturshadnik b9dd221
fix: dbl pointer
arturshadnik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| # More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
| # Ignore build and test binaries. | ||
| bin/ | ||
| tmp/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| package v1beta1 | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "time" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| "github.com/open-cluster-management-io/lab/fleetconfig-controller/internal/args" | ||
| ) | ||
|
|
||
| // Kubeconfig is the configuration for a kubeconfig. | ||
| type Kubeconfig struct { | ||
| // A reference to an existing secret containing a kubeconfig. | ||
| // Must be provided for remote clusters. | ||
| // For same-cluster, must be provided unless InCluster is set to true. | ||
| // +optional | ||
| SecretReference *SecretReference `json:"secretReference,omitempty"` | ||
|
|
||
| // If set, the kubeconfig will be read from the cluster. | ||
| // Only applicable for same-cluster operations. | ||
| // Defaults to false. | ||
| // +optional | ||
| InCluster bool `json:"inCluster,omitempty"` | ||
|
|
||
| // The context to use in the kubeconfig file. | ||
| // +optional | ||
| Context string `json:"context,omitempty"` | ||
| } | ||
|
|
||
| // SecretReference describes how to retrieve a kubeconfig stored as a secret in the same namespace as the resource. | ||
| type SecretReference struct { | ||
| // The name of the secret. | ||
| // +required | ||
| Name string `json:"name"` | ||
|
|
||
| // The map key to access the kubeconfig. Defaults to 'kubeconfig'. | ||
| // +kubebuilder:default:="kubeconfig" | ||
| // +optional | ||
| KubeconfigKey string `json:"kubeconfigKey,omitempty"` | ||
| } | ||
|
|
||
| // ResourceSpec defines resource limits and requests for all managed clusters. | ||
| type ResourceSpec struct { | ||
| // The resource limits of all the containers managed by the Cluster Manager or Klusterlet operators. | ||
| // +optional | ||
| Limits *ResourceValues `json:"limits,omitempty"` | ||
|
|
||
| // The resource requests of all the containers managed by the Cluster Manager or Klusterlet operators. | ||
| // +optional | ||
| Requests *ResourceValues `json:"requests,omitempty"` | ||
|
|
||
| // The resource QoS class of all the containers managed by the Cluster Manager or Klusterlet operators. | ||
| // One of Default, BestEffort or ResourceRequirement. | ||
| // +kubebuilder:validation:Enum=Default;BestEffort;ResourceRequirement | ||
| // +kubebuilder:default:="Default" | ||
| // +optional | ||
| QosClass string `json:"qosClass,omitempty"` | ||
| } | ||
|
|
||
| // ResourceValues detail container resource constraints. | ||
| type ResourceValues struct { | ||
| // The number of CPU units to request, e.g., '800m'. | ||
| // +optional | ||
| CPU string `json:"cpu,omitempty"` | ||
|
|
||
| // The amount of memory to request, e.g., '8Gi'. | ||
| // +optional | ||
| Memory string `json:"memory,omitempty"` | ||
| } | ||
|
|
||
| // String returns a string representation of the resource values. | ||
| func (r *ResourceValues) String() string { | ||
| if r.CPU != "" && r.Memory != "" { | ||
| return fmt.Sprintf("cpu=%s,memory=%s", r.CPU, r.Memory) | ||
| } else if r.CPU != "" { | ||
| return fmt.Sprintf("cpu=%s", r.CPU) | ||
| } else if r.Memory != "" { | ||
| return fmt.Sprintf("memory=%s", r.Memory) | ||
| } | ||
| return "" | ||
| } | ||
|
|
||
| // GetRequests returns the resource requests. | ||
| func (r ResourceSpec) GetRequests() args.ResourceValues { | ||
| if r.Requests == nil { | ||
| return &ResourceValues{} | ||
| } | ||
| return r.Requests | ||
| } | ||
|
|
||
| // GetLimits returns the resource limits. | ||
| func (r ResourceSpec) GetLimits() args.ResourceValues { | ||
| if r.Limits == nil { | ||
| return &ResourceValues{} | ||
| } | ||
| return r.Limits | ||
| } | ||
|
|
||
| // GetQosClass returns the QoS class. | ||
| func (r ResourceSpec) GetQosClass() string { | ||
| return r.QosClass | ||
| } | ||
|
|
||
| // Ensure ResourceSpec implements args.ResourceSpec interface | ||
| var _ args.ResourceSpec = (*ResourceSpec)(nil) | ||
|
|
||
| // Ensure ResourceValues implements args.ResourceValues interface | ||
| var _ args.ResourceValues = (*ResourceValues)(nil) | ||
|
|
||
| // NewCondition returns a new v1beta1.Condition. | ||
| func NewCondition(msg, cType string, status, wantStatus metav1.ConditionStatus) Condition { | ||
| return Condition{ | ||
| Condition: metav1.Condition{ | ||
| Status: status, | ||
| Message: msg, | ||
| Reason: ReconcileSuccess, | ||
| Type: cType, | ||
| LastTransitionTime: metav1.Time{Time: time.Now()}, | ||
| }, | ||
| WantStatus: wantStatus, | ||
| } | ||
| } | ||
|
|
||
| // Condition describes the state of a FleetConfig. | ||
| type Condition struct { | ||
| metav1.Condition `json:",inline"` | ||
| WantStatus metav1.ConditionStatus `json:"wantStatus"` | ||
| } | ||
|
|
||
| // Equal returns true if the condition is identical to the supplied condition, ignoring the LastTransitionTime. | ||
| func (c Condition) Equal(other Condition) bool { | ||
| return c.Type == other.Type && c.Status == other.Status && c.WantStatus == other.WantStatus && | ||
| c.Reason == other.Reason && c.Message == other.Message | ||
| } | ||
|
|
||
| // RegistrationAuth provides specifications for registration authentication. | ||
| type RegistrationAuth struct { | ||
| // The registration authentication driver to use. | ||
| // Options are: | ||
| // - csr: Use the default CSR-based registration authentication. | ||
| // - awsirsa: Use AWS IAM Role for Service Accounts (IRSA) registration authentication. | ||
| // The set of valid options is open for extension. | ||
| // +kubebuilder:validation:Enum=csr;awsirsa | ||
| // +kubebuilder:default:="csr" | ||
| // +optional | ||
| Driver string `json:"driver,omitempty"` | ||
|
|
||
| // The Hub cluster ARN for awsirsa registration authentication. Required when Type is awsirsa, otherwise ignored. | ||
| // +optional | ||
| HubClusterARN string `json:"hubClusterARN,omitempty"` | ||
|
|
||
| // List of AWS EKS ARN patterns so any EKS clusters with these patterns will be auto accepted to join with hub cluster. | ||
| // Example pattern: "arn:aws:eks:us-west-2:123456789013:cluster/.*" | ||
| // +optional | ||
| AutoApprovedARNPatterns []string `json:"autoApprovedARNPatterns,omitempty"` | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.