From 8bd1e76877612d60f38595eb4087b12b5e46d028 Mon Sep 17 00:00:00 2001 From: Christoph Barbian Date: Wed, 28 Aug 2024 15:01:26 +0200 Subject: [PATCH] adapt incompaible changes in client-go, sops --- internal/decrypt/sops.go | 7 ++++--- internal/flux/cache.go | 8 ++++---- pkg/operator/cache.go | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/decrypt/sops.go b/internal/decrypt/sops.go index bafcc46..564406b 100644 --- a/internal/decrypt/sops.go +++ b/internal/decrypt/sops.go @@ -27,6 +27,7 @@ import ( sopsage "github.com/getsops/sops/v3/age" sopscommon "github.com/getsops/sops/v3/cmd/sops/common" sopsformats "github.com/getsops/sops/v3/cmd/sops/formats" + sopsconfig "github.com/getsops/sops/v3/config" sopskeys "github.com/getsops/sops/v3/keys" sopskeyservice "github.com/getsops/sops/v3/keyservice" sopslogging "github.com/getsops/sops/v3/logging" @@ -117,7 +118,7 @@ func (d *SopsDecryptor) SopsDecryptWithFormat(input []byte, inputFormat sopsform } }() - store := sopscommon.StoreForFormat(inputFormat) + store := sopscommon.StoreForFormat(inputFormat, sopsconfig.NewStoresConfig()) tree, err := store.LoadEncryptedFile(input) if err != nil { @@ -130,7 +131,7 @@ func (d *SopsDecryptor) SopsDecryptWithFormat(input []byte, inputFormat sopsform }) } - metadataKey, err := tree.Metadata.GetDataKeyWithKeyServices(d.keyServices) + metadataKey, err := tree.Metadata.GetDataKeyWithKeyServices(d.keyServices, sops.DefaultDecryptionOrder) if err != nil { return nil, sopsUserErr("cannot get sops data key", err) } @@ -140,7 +141,7 @@ func (d *SopsDecryptor) SopsDecryptWithFormat(input []byte, inputFormat sopsform return nil, sopsUserErr("error decrypting sops tree", err) } - outputStore := sopscommon.StoreForFormat(outputFormat) + outputStore := sopscommon.StoreForFormat(outputFormat, sopsconfig.NewStoresConfig()) out, err := outputStore.EmitPlainFile(tree.Branches) if err != nil { return nil, sopsUserErr(fmt.Sprintf("failed to emit encrypted %s file as decrypted %s", diff --git a/internal/flux/cache.go b/internal/flux/cache.go index f6fd180..5ab5f6d 100644 --- a/internal/flux/cache.go +++ b/internal/flux/cache.go @@ -115,11 +115,11 @@ func newHandler(cache cache.Cache, indexKey string) handler.EventHandler { } } -func (h *sourceHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) { +func (h *sourceHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { // new sources will never be immediately ready, so nothing has to be done here } -func (h *sourceHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { +func (h *sourceHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { newSource := e.ObjectNew.(Source) if !object.IsReady(newSource) { @@ -154,10 +154,10 @@ func (h *sourceHandler) Update(ctx context.Context, e event.UpdateEvent, q workq } } -func (h *sourceHandler) Delete(ctx context.Context, e event.DeleteEvent, q workqueue.RateLimitingInterface) { +func (h *sourceHandler) Delete(ctx context.Context, e event.DeleteEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { // no need to queue components if source is deleted (reconciliation of the component would anyway fail) } -func (h *sourceHandler) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) { +func (h *sourceHandler) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) { // generic events are not expected to arrive on the watch that uses this handler, so nothing to do here } diff --git a/pkg/operator/cache.go b/pkg/operator/cache.go index ff3f2d0..95d1f20 100644 --- a/pkg/operator/cache.go +++ b/pkg/operator/cache.go @@ -61,11 +61,11 @@ func newHandler(cache cache.Cache, indexKey string) handler.EventHandler { } } -func (h *componentHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) { +func (h *componentHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { // new components will never be immediately ready, so nothing has to be done here } -func (h *componentHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { +func (h *componentHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { newComponent := e.ObjectNew.(*operatorv1alpha1.Component) if !newComponent.IsReady() { @@ -89,7 +89,7 @@ func (h *componentHandler) Update(ctx context.Context, e event.UpdateEvent, q wo } } -func (h *componentHandler) Delete(ctx context.Context, e event.DeleteEvent, q workqueue.RateLimitingInterface) { +func (h *componentHandler) Delete(ctx context.Context, e event.DeleteEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request]) { component := e.Object.(*operatorv1alpha1.Component) for _, dependency := range component.Spec.Dependencies { q.Add(reconcile.Request{NamespacedName: apitypes.NamespacedName{ @@ -99,6 +99,6 @@ func (h *componentHandler) Delete(ctx context.Context, e event.DeleteEvent, q wo } } -func (h *componentHandler) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) { +func (h *componentHandler) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) { // generic events are not expected to arrive on the watch that uses this handler, so nothing to do here }