Skip to content

Commit

Permalink
chore: remove unused node name in rotation reconciler
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
  • Loading branch information
aramase committed Apr 4, 2023
1 parent 42ef595 commit cab63b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/secrets-store-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func mainErr() error {

// Secret rotation
if *enableSecretRotation {
rec, err := rotation.NewReconciler(mgr.GetCache(), scheme, *nodeID, *rotationPollInterval, providerClients, tokenClient)
rec, err := rotation.NewReconciler(mgr.GetCache(), scheme, *rotationPollInterval, providerClients, tokenClient)
if err != nil {
klog.ErrorS(err, "failed to initialize rotation reconciler")
return err
Expand Down
1 change: 0 additions & 1 deletion pkg/rotation/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ type Reconciler struct {
// NewReconciler returns a new reconciler for rotation
func NewReconciler(client client.Reader,
s *runtime.Scheme,
nodeName string,
rotationPollInterval time.Duration,
providerClients *secretsstore.PluginClientBuilder,
tokenClient *k8s.TokenClient) (*Reconciler, error) {
Expand Down
14 changes: 7 additions & 7 deletions pkg/rotation/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func setupScheme() (*runtime.Scheme, error) {
return scheme, nil
}

func newTestReconciler(client client.Reader, s *runtime.Scheme, kubeClient kubernetes.Interface, crdClient *secretsStoreFakeClient.Clientset, rotationPollInterval time.Duration, socketPath string) (*Reconciler, error) {
func newTestReconciler(client client.Reader, kubeClient kubernetes.Interface, crdClient *secretsStoreFakeClient.Clientset, rotationPollInterval time.Duration, socketPath string) (*Reconciler, error) {
secretStore, err := k8s.New(kubeClient, 5*time.Second)
if err != nil {
return nil, err
Expand Down Expand Up @@ -448,7 +448,7 @@ func TestReconcileError(t *testing.T) {
}
client := controllerfake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()

testReconciler, err := newTestReconciler(client, scheme, kubeClient, crdClient, test.rotationPollInterval, test.socketPath)
testReconciler, err := newTestReconciler(client, kubeClient, crdClient, test.rotationPollInterval, test.socketPath)
g.Expect(err).NotTo(HaveOccurred())

err = testReconciler.secretStore.Run(wait.NeverStop)
Expand Down Expand Up @@ -589,7 +589,7 @@ func TestReconcileNoError(t *testing.T) {
}
ctrlClient := controllerfake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()

testReconciler, err := newTestReconciler(ctrlClient, scheme, kubeClient, crdClient, 60*time.Second, socketPath)
testReconciler, err := newTestReconciler(ctrlClient, kubeClient, crdClient, 60*time.Second, socketPath)
g.Expect(err).NotTo(HaveOccurred())
err = testReconciler.secretStore.Run(wait.NeverStop)
g.Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -634,7 +634,7 @@ func TestReconcileNoError(t *testing.T) {
test.nodePublishSecretRefSecretToAdd,
}
ctrlClient = controllerfake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()
testReconciler, err = newTestReconciler(ctrlClient, scheme, kubeClient, crdClient, 60*time.Second, socketPath)
testReconciler, err = newTestReconciler(ctrlClient, kubeClient, crdClient, 60*time.Second, socketPath)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(err).NotTo(HaveOccurred())

Expand All @@ -650,7 +650,7 @@ func TestReconcileNoError(t *testing.T) {
test.nodePublishSecretRefSecretToAdd,
}
ctrlClient = controllerfake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()
testReconciler, err = newTestReconciler(ctrlClient, scheme, kubeClient, crdClient, 60*time.Second, socketPath)
testReconciler, err = newTestReconciler(ctrlClient, kubeClient, crdClient, 60*time.Second, socketPath)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -741,7 +741,7 @@ func TestPatchSecret(t *testing.T) {
}
ctrlClient := controllerfake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()

testReconciler, err := newTestReconciler(ctrlClient, scheme, kubeClient, crdClient, 60*time.Second, "")
testReconciler, err := newTestReconciler(ctrlClient, kubeClient, crdClient, 60*time.Second, "")
g.Expect(err).NotTo(HaveOccurred())
err = testReconciler.secretStore.Run(wait.NeverStop)
g.Expect(err).NotTo(HaveOccurred())
Expand All @@ -766,7 +766,7 @@ func TestPatchSecret(t *testing.T) {
func TestHandleError(t *testing.T) {
g := NewWithT(t)

testReconciler, err := newTestReconciler(nil, nil, nil, nil, 60*time.Second, "")
testReconciler, err := newTestReconciler(nil, nil, nil, 60*time.Second, "")
g.Expect(err).NotTo(HaveOccurred())

testReconciler.handleError(errors.New("failed error"), "key1", false)
Expand Down

0 comments on commit cab63b3

Please sign in to comment.