Skip to content

Commit

Permalink
Remove secrets queue and secretSynced MCM usage (#780)
Browse files Browse the repository at this point in the history
* remove secrets queue and secretSynced MCM usage

* fix test for secrets queue, secretSynced usage
  • Loading branch information
elankath authored Feb 14, 2023
1 parent 60cb776 commit f9558dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
6 changes: 1 addition & 5 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func NewController(
targetCoreClient: targetCoreClient,
recorder: recorder,
expectations: NewUIDTrackingContExpectations(NewContExpectations()),
secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"),
nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"),
machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"),
machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"),
Expand Down Expand Up @@ -192,14 +191,12 @@ type controller struct {
machineSetLister machinelisters.MachineSetLister
machineDeploymentLister machinelisters.MachineDeploymentLister
// queues
secretQueue workqueue.RateLimitingInterface
nodeQueue workqueue.RateLimitingInterface
machineQueue workqueue.RateLimitingInterface
machineSetQueue workqueue.RateLimitingInterface
machineDeploymentQueue workqueue.RateLimitingInterface
machineSafetyOvershootingQueue workqueue.RateLimitingInterface
// syncs
secretSynced cache.InformerSynced
nodeSynced cache.InformerSynced
machineSynced cache.InformerSynced
machineSetSynced cache.InformerSynced
Expand All @@ -214,13 +211,12 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {

defer runtimeutil.HandleCrash()
defer c.nodeQueue.ShutDown()
defer c.secretQueue.ShutDown()
defer c.machineQueue.ShutDown()
defer c.machineSetQueue.ShutDown()
defer c.machineDeploymentQueue.ShutDown()
defer c.machineSafetyOvershootingQueue.ShutDown()

if !cache.WaitForCacheSync(stopCh, c.secretSynced, c.nodeSynced, c.machineSynced, c.machineSetSynced, c.machineDeploymentSynced) {
if !cache.WaitForCacheSync(stopCh, c.nodeSynced, c.machineSynced, c.machineSetSynced, c.machineDeploymentSynced) {
runtimeutil.HandleError(fmt.Errorf("Timed out waiting for caches to sync"))
return
}
Expand Down
19 changes: 8 additions & 11 deletions pkg/controller/controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ import (
"testing"
"time"

machine_internal "github.com/gardener/machine-controller-manager/pkg/apis/machine"
"github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
faketyped "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake"
machineinformers "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions"
customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
"github.com/gardener/machine-controller-manager/pkg/options"
"github.com/gardener/machine-controller-manager/pkg/util/provider/cache"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
Expand All @@ -44,6 +37,14 @@ import (
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"

machine_internal "github.com/gardener/machine-controller-manager/pkg/apis/machine"
"github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
faketyped "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake"
machineinformers "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions"
customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
"github.com/gardener/machine-controller-manager/pkg/options"
"github.com/gardener/machine-controller-manager/pkg/util/provider/cache"
)

func TestMachineControllerManagerSuite(t *testing.T) {
Expand Down Expand Up @@ -473,8 +474,6 @@ func createController(
nil,
)
defer coreControlInformerFactory.Start(stop)
coreControlSharedInformers := coreControlInformerFactory.Core().V1()
secret := coreControlSharedInformers.Secrets()

controlMachineInformerFactory := machineinformers.NewFilteredSharedInformerFactory(
fakeControlMachineClient,
Expand Down Expand Up @@ -514,8 +513,6 @@ func createController(
machineSetSynced: machineSets.Informer().HasSynced,
machineDeploymentSynced: machineDeployments.Informer().HasSynced,
nodeSynced: nodes.Informer().HasSynced,
secretSynced: secret.Informer().HasSynced,
secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"),
nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"),
machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"),
machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"),
Expand Down

0 comments on commit f9558dd

Please sign in to comment.