Skip to content

Commit

Permalink
feat: enabling the new condition (Azure#768)
Browse files Browse the repository at this point in the history
* feat: enabling the new condition
---------

Co-authored-by: Zhiying Lin <[email protected]>
Co-authored-by: Ryan Zhang <[email protected]>
  • Loading branch information
3 people authored Apr 23, 2024
1 parent a0c2dd1 commit 965437e
Show file tree
Hide file tree
Showing 26 changed files with 1,100 additions and 3,534 deletions.
8 changes: 0 additions & 8 deletions apis/placement/v1beta1/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ const (
// - "Unknown" means it is unknown.
ResourceBindingOverridden ResourceBindingConditionType = "Overridden"

// ResourceBindingBound indicates the bound condition of the given resources.
// Its condition status can be one of the following:
// - "True" means the corresponding work CR is created in the target cluster's namespace.
// - "False" means the corresponding work CR is not created yet.
// - "Unknown" means it is unknown.
// TODO, will be replaced by "WorkSynchronized"
ResourceBindingBound ResourceBindingConditionType = "Bound"

// ResourceBindingWorkSynchronized indicates the work synchronized condition of the given resources.
// Its condition status can be one of the following:
// - "True" means all corresponding works are created or updated in the target cluster's namespace.
Expand Down
36 changes: 34 additions & 2 deletions cmd/hubagent/workload/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (
placementv1beta1 "go.goms.io/fleet/apis/placement/v1beta1"
fleetv1alpha1 "go.goms.io/fleet/apis/v1alpha1"
"go.goms.io/fleet/cmd/hubagent/options"
"go.goms.io/fleet/pkg/controllers/clusterresourcebindingwatcher"
"go.goms.io/fleet/pkg/controllers/clusterresourceplacement"
"go.goms.io/fleet/pkg/controllers/clusterresourceplacementwatcher"
"go.goms.io/fleet/pkg/controllers/clusterschedulingpolicysnapshot"
"go.goms.io/fleet/pkg/controllers/memberclusterplacement"
"go.goms.io/fleet/pkg/controllers/overrider"
"go.goms.io/fleet/pkg/controllers/resourcechange"
"go.goms.io/fleet/pkg/controllers/rollout"
"go.goms.io/fleet/pkg/controllers/workgenerator"
Expand Down Expand Up @@ -194,12 +196,21 @@ func SetupControllers(ctx context.Context, wg *sync.WaitGroup, mgr ctrl.Manager,
return err
}

klog.Info("Setting up clusterSchedulingPolicySnapshot controller")
klog.Info("Setting up clusterResourceBinding watcher")
if err := (&clusterresourcebindingwatcher.Reconciler{
PlacementController: clusterResourcePlacementControllerV1Beta1,
Client: mgr.GetClient(),
}).SetupWithManager(mgr); err != nil {
klog.ErrorS(err, "Unable to set up the clusterResourceBinding watcher")
return err
}

klog.Info("Setting up clusterSchedulingPolicySnapshot watcher")
if err := (&clusterschedulingpolicysnapshot.Reconciler{
Client: mgr.GetClient(),
PlacementController: clusterResourcePlacementControllerV1Beta1,
}).SetupWithManager(mgr); err != nil {
klog.ErrorS(err, "Unable to set up the clusterResourcePlacement watcher")
klog.ErrorS(err, "Unable to set up the clusterSchedulingPolicySnapshot watcher")
return err
}

Expand Down Expand Up @@ -276,6 +287,27 @@ func SetupControllers(ctx context.Context, wg *sync.WaitGroup, mgr ctrl.Manager,
klog.ErrorS(err, "Unable to set up memberCluster watcher for scheduler")
return err
}

// setup override related controllers
klog.Info("Setting up the clusterResourceOverride controller")
if err := (&overrider.ClusterResourceReconciler{
Reconciler: overrider.Reconciler{
Client: mgr.GetClient(),
},
}).SetupWithManager(mgr); err != nil {
klog.ErrorS(err, "Unable to set up clusterResourceOverride controller")
return err
}

klog.Info("Setting up the resourceOverride controller")
if err := (&overrider.ResourceReconciler{
Reconciler: overrider.Reconciler{
Client: mgr.GetClient(),
},
}).SetupWithManager(mgr); err != nil {
klog.ErrorS(err, "Unable to set up resourceOverride controller")
return err
}
}

// Set up a runner that starts all the custom controllers we created above
Expand Down
245 changes: 26 additions & 219 deletions pkg/controllers/clusterresourceplacement/controller.go

Large diffs are not rendered by default.

Loading

0 comments on commit 965437e

Please sign in to comment.