openyurtio / yurt-app-manager

The workload controller manager from NodePool level in OpenYurt cluster
Apache License 2.0
6 stars 1 forks source link

bugfix: yurt-app-manager cache not started error #8

Closed kadisi closed 3 years ago

kadisi commented 3 years ago

when upgrade the version of controll-runtime to 0.7.0. yurt-app-amanger will come the error:

the cache is not started, can not read objects

this pr fix this error.

Signed-off-by: kadisi iamkadisi@163.com

@charleszheng44

Fei-Guo commented 3 years ago

There are quite a few clean ups in this change. Which is the part of the code that resolves the problem mentioned in the PR title?

kadisi commented 3 years ago

There are quite a few clean ups in this change. Which is the part of the code that resolves the problem mentioned in the PR title?

@Fei-Guo

this is the part of the code:

func Initialize(mgr manager.Manager, stopCh <-chan struct{}) error {
    cli, err := client.NewDelegatingClient(client.NewDelegatingClientInput{
        CacheReader: mgr.GetAPIReader(),
        Client:      mgr.GetClient(),
    })
    if err != n

The "Initialize" method is executed when the cache is not yet synchronized, so it gets an cache not started error when it gets the secret。 so the CacheReader doesn't have to be assigned with mgr.GetCache().