Skip to content
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

Remove secrets queue and secretSynced MCM usage #780

Merged
merged 2 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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