Skip to content

Commit

Permalink
update addon manager.
Browse files Browse the repository at this point in the history
Signed-off-by: morvencao <lcao@redhat.com>
  • Loading branch information
morvencao committed Apr 20, 2024
1 parent a78571c commit a9162b6
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 225 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ require (
k8s.io/klog/v2 v2.120.1
k8s.io/kube-aggregator v0.29.3
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
open-cluster-management.io/addon-framework v0.9.1-0.20240416063208-ecb7f349df05
open-cluster-management.io/addon-framework v0.9.1-0.20240419070222-e703fc5a2556
open-cluster-management.io/api v0.13.1-0.20240411131856-8f6aa25f111c
open-cluster-management.io/sdk-go v0.13.1-0.20240416030555-aa744f426379
open-cluster-management.io/sdk-go v0.13.1-0.20240416062924-20307e6fe090
sigs.k8s.io/controller-runtime v0.17.3
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96
)
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/addon-framework v0.9.1-0.20240416063208-ecb7f349df05 h1:oj4IEyxmQFMxdpnOPE/Y7Xkyfkz4hGVkcYZ4dn8WtKU=
open-cluster-management.io/addon-framework v0.9.1-0.20240416063208-ecb7f349df05/go.mod h1:K+/TwCUz2PZ7L+svaodw6029S/iPJ7eVX21F7NMw+Kw=
open-cluster-management.io/addon-framework v0.9.1-0.20240419070222-e703fc5a2556 h1:X3vJEx9agC94l7SitpWZFDshISdL1niqVH0+diyqfJo=
open-cluster-management.io/addon-framework v0.9.1-0.20240419070222-e703fc5a2556/go.mod h1:HayKCznnlyW+0dUJQGj5sNR6i3tvylSySD3YnvZkBtY=
open-cluster-management.io/api v0.13.1-0.20240411131856-8f6aa25f111c h1:/iUoY6/PqBmcBq3v0+UBFvIcI39k/QPRGqpOv9XtDIc=
open-cluster-management.io/api v0.13.1-0.20240411131856-8f6aa25f111c/go.mod h1:CuCPEzXDvOyxBB0H1d1eSeajbHqaeGEKq9c63vQc63w=
open-cluster-management.io/sdk-go v0.13.1-0.20240416030555-aa744f426379 h1:8jXVHfgy+wgXq1mrWC1mTieoP77WsAAHNpzILMIzWB0=
open-cluster-management.io/sdk-go v0.13.1-0.20240416030555-aa744f426379/go.mod h1:w2OaxtCyegxeyFLU42UQ3oxUz01QdsBQkcHI17T/l48=
open-cluster-management.io/sdk-go v0.13.1-0.20240416062924-20307e6fe090 h1:zFmHuW+ztdfUUNslqNW+H1WEcfdEUQHoRDbmdajX340=
open-cluster-management.io/sdk-go v0.13.1-0.20240416062924-20307e6fe090/go.mod h1:w2OaxtCyegxeyFLU42UQ3oxUz01QdsBQkcHI17T/l48=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y=
sigs.k8s.io/controller-runtime v0.17.3 h1:65QmN7r3FWgTxDMz9fvGnO1kbf2nu+acg9p2R9oYYYk=
Expand Down
6 changes: 5 additions & 1 deletion pkg/addon/controllers/addontemplate/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
addoninformers "open-cluster-management.io/api/client/addon/informers/externalversions"
addonlisterv1alpha1 "open-cluster-management.io/api/client/addon/listers/addon/v1alpha1"
clusterv1informers "open-cluster-management.io/api/client/cluster/informers/externalversions"
workv1client "open-cluster-management.io/api/client/work/clientset/versioned"
workv1informers "open-cluster-management.io/api/client/work/informers/externalversions"
clusterv1 "open-cluster-management.io/api/cluster/v1"

Expand All @@ -40,6 +41,7 @@ type addonTemplateController struct {

kubeConfig *rest.Config
addonClient addonv1alpha1client.Interface
workClient workv1client.Interface
kubeClient kubernetes.Interface
cmaLister addonlisterv1alpha1.ClusterManagementAddOnLister
addonInformers addoninformers.SharedInformerFactory
Expand All @@ -56,6 +58,7 @@ func NewAddonTemplateController(
hubKubeconfig *rest.Config,
hubKubeClient kubernetes.Interface,
addonClient addonv1alpha1client.Interface,
workClient workv1client.Interface,
addonInformers addoninformers.SharedInformerFactory,
clusterInformers clusterv1informers.SharedInformerFactory,
dynamicInformers dynamicinformer.DynamicSharedInformerFactory,
Expand All @@ -67,6 +70,7 @@ func NewAddonTemplateController(
kubeConfig: hubKubeconfig,
kubeClient: hubKubeClient,
addonClient: addonClient,
workClient: workClient,
cmaLister: addonInformers.Addon().V1alpha1().ClusterManagementAddOns().Lister(),
addonManagers: make(map[string]context.CancelFunc),
addonInformers: addonInformers,
Expand Down Expand Up @@ -205,7 +209,7 @@ func (c *addonTemplateController) runController(
return err
}

err = mgr.StartWithInformers(ctx, kubeInformers, c.workInformers, c.addonInformers, c.clusterInformers, c.dynamicInformers)
err = mgr.StartWithInformers(ctx, c.workClient, c.workInformers.Work().V1().ManifestWorks(), kubeInformers, c.addonInformers, c.clusterInformers, c.dynamicInformers)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/addon/controllers/addontemplate/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func TestReconcile(t *testing.T) {
nil,
hubKubeClient,
fakeAddonClient,
fakeWorkClient,
addonInformers,
clusterInformers,
dynamicInformerFactory,
Expand Down
3 changes: 3 additions & 0 deletions pkg/addon/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func RunManager(ctx context.Context, controllerContext *controllercmd.Controller
ctx, controllerContext,
hubKubeClient,
addonClient,
workClient,
clusterInformerFactory,
addonInformerFactory,
workInformers,
Expand All @@ -91,6 +92,7 @@ func RunControllerManagerWithInformers(
controllerContext *controllercmd.ControllerContext,
hubKubeClient kubernetes.Interface,
hubAddOnClient addonv1alpha1client.Interface,
hubWorkClient workv1client.Interface,
clusterInformers clusterinformers.SharedInformerFactory,
addonInformers addoninformers.SharedInformerFactory,
workinformers workv1informers.SharedInformerFactory,
Expand Down Expand Up @@ -187,6 +189,7 @@ func RunControllerManagerWithInformers(
controllerContext.KubeConfig,
hubKubeClient,
hubAddOnClient,
hubWorkClient,
addonInformers,
clusterInformers,
dynamicInformers,
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ k8s.io/utils/pointer
k8s.io/utils/ptr
k8s.io/utils/strings/slices
k8s.io/utils/trace
# open-cluster-management.io/addon-framework v0.9.1-0.20240416063208-ecb7f349df05
# open-cluster-management.io/addon-framework v0.9.1-0.20240419070222-e703fc5a2556
## explicit; go 1.21
open-cluster-management.io/addon-framework/pkg/addonfactory
open-cluster-management.io/addon-framework/pkg/addonmanager
Expand Down Expand Up @@ -1578,7 +1578,7 @@ open-cluster-management.io/api/utils/work/v1/workapplier
open-cluster-management.io/api/utils/work/v1/workvalidator
open-cluster-management.io/api/work/v1
open-cluster-management.io/api/work/v1alpha1
# open-cluster-management.io/sdk-go v0.13.1-0.20240416030555-aa744f426379
# open-cluster-management.io/sdk-go v0.13.1-0.20240416062924-20307e6fe090
## explicit; go 1.21
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1alpha1
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1beta1
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a9162b6

Please sign in to comment.