From 97446b4940930e5076d1857544d39c3b5385c3b1 Mon Sep 17 00:00:00 2001 From: void404 Date: Thu, 19 Dec 2024 08:57:34 +0100 Subject: [PATCH 01/16] Implement CRB cleanup --- hack/runtime-migrator/cmd/crb-cleanup/main.go | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/main.go diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go new file mode 100644 index 00000000..4e494dc5 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -0,0 +1,156 @@ +package main + +import ( + "context" + "flag" + "fmt" + "log/slog" + "os" + "path/filepath" + + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/clientcmd" + "k8s.io/client-go/util/homedir" +) + +// const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" +const LabelSelectorOld = "reconciler.kyma-project.io/managed-by=infrastructure-manager" +const LabelSelectorNew = "reconciler.kyma-project.io/managed-by=infrastructure-manager" + +func main() { + // ################### + // ### Parse flags ### + // ################### + + kubeconfig := filepath.Join(homedir.HomeDir(), ".kube", "config") + if envKubeconfig := os.Getenv("KUBECONFIG"); envKubeconfig != "" { + kubeconfig = envKubeconfig + } + + pretend := flag.Bool("pretend", false, "Don't remove CRBs, print what would be removed (you might want to increase log level)") + verbose := flag.Bool("verbose", false, "Increase the log level to debug (default: info)") + kubeconfigFlag := flag.String("kubeconfig", "", fmt.Sprintf("Kubeconfig file path, if not set: %s", kubeconfig)) + flag.Parse() + if kubeconfigFlag != nil && len(*kubeconfigFlag) > 0 { + kubeconfig = *kubeconfigFlag + } + + _ = pretend + + // ################### + + if verbose != nil && *verbose { + slog.SetLogLoggerLevel(slog.LevelDebug) + } else { + slog.SetLogLoggerLevel(slog.LevelInfo) + } + + clientset := setupKubectl(kubeconfig) + var remover RBACRemover + if *pretend { + remover = RBACMockRemover{} + } else { + remover = RBACRemoverImpl{clientset: clientset} + } + ctx := context.Background() + + // ########################### + // ### List CRBs to remove ### + // ########################### + + crbsOld, err := clientset.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ + LabelSelector: LabelSelectorOld, + }) + if err != nil { + slog.Error("Error listing old CRBs", "error", err) + os.Exit(1) + } + + crbsNew, err := clientset.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ + LabelSelector: LabelSelectorNew, + }) + if err != nil { + slog.Error("Error listing new CRBs", "error", err) + os.Exit(1) + } + + // ############################################## + // ### Remove CRBs with migrated counterparts ### + // ############################################## + + for _, crb := range crbsOld.Items { + slog.Debug("Comparing CRB", "name", crb.Name) + if !existsNew(crb, crbsNew) { + slog.Warn("CRB new counterpart not found", "name", crb.Name) + continue + } + slog.Debug("CRB exists in new form", "name", crb.Name) + slog.Info("Removing CRB", "name", crb.Name) + if err := remover.RemoveClusterRoleBinding(ctx, crb); err != nil { + slog.Error("Error removing CRB", "name", crb.Name, "error", err) + } + } + +} + +func existsNew(old v1.ClusterRoleBinding, new *v1.ClusterRoleBindingList) bool { +crbs: + for _, crb := range new.Items { + subjectsMap := make(map[v1.Subject]bool) + for _, subject := range crb.Subjects { + subjectsMap[subject] = true + } + + for _, subject := range old.Subjects { + if !subjectsMap[subject] { + slog.Debug("Subject not found", "subject", subject, "old", old.Name, "new", crb.Name) + continue crbs + } + } + + if old.RoleRef == crb.RoleRef { + return true + } + slog.Debug("RoleRef not found", "old", old.Name, "new", crb.Name) + } + + return false +} + +type RBACRemover interface { + RemoveClusterRoleBinding(ctx context.Context, crb v1.ClusterRoleBinding) error +} + +type RBACRemoverImpl struct { + clientset kubernetes.Interface +} + +func (r RBACRemoverImpl) RemoveClusterRoleBinding(ctx context.Context, crb v1.ClusterRoleBinding) error { + slog.Info("Removing CRB", "name", crb.Name) + return r.clientset.RbacV1().ClusterRoleBindings().Delete(ctx, crb.Name, metav1.DeleteOptions{}) +} + +type RBACMockRemover struct{} + +func (r RBACMockRemover) RemoveClusterRoleBinding(_ context.Context, crb v1.ClusterRoleBinding) error { + slog.Debug("Mock client: [remove CRB]", "name", crb.Name) + return nil +} + +func setupKubectl(kubeconfig string) *kubernetes.Clientset { + config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) + if err != nil { + slog.Error("Error building kubeconfig", "error", err) + os.Exit(1) + } + + clientset, err := kubernetes.NewForConfig(config) + if err != nil { + slog.Error("Error building clientset", "error", err) + os.Exit(1) + } + + return clientset +} From b409500ecf06b3a4829451f3494a780c250fae98 Mon Sep 17 00:00:00 2001 From: void404 Date: Tue, 7 Jan 2025 15:16:02 +0100 Subject: [PATCH 02/16] Implement initial version --- .../runtime-migrator/cmd/crb-cleanup/Makefile | 15 + .../cmd/crb-cleanup/cleaner.go | 66 +++++ .../cmd/crb-cleanup/config.go | 67 +++++ .../cmd/crb-cleanup/crb_cleanup_suite_test.go | 13 + .../cmd/crb-cleanup/fetcher.go | 51 ++++ hack/runtime-migrator/cmd/crb-cleanup/main.go | 143 ++------- .../cmd/crb-cleanup/main_test.go | 84 ++++++ .../cmd/crb-cleanup/main_test.go.bak | 86 ++++++ .../runtime-migrator/cmd/crb-cleanup/utils.go | 67 +++++ .../cmd/crb-cleanup/utils_test.go | 25 ++ hack/runtime-migrator/go.mod | 10 +- hack/runtime-migrator/go.sum | 278 ++++++++++++++++++ 12 files changed, 783 insertions(+), 122 deletions(-) create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/Makefile create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/cleaner.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/config.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/crb_cleanup_suite_test.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/fetcher.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/main_test.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/utils.go create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/utils_test.go diff --git a/hack/runtime-migrator/cmd/crb-cleanup/Makefile b/hack/runtime-migrator/cmd/crb-cleanup/Makefile new file mode 100644 index 00000000..d9be5aa2 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/Makefile @@ -0,0 +1,15 @@ +ENVTEST_K8S_VERSION = 1.31.0 +ENVTEST_VERSION ?= release-0.19 + +LOCALBIN ?= $(shell pwd)/bin +$(LOCALBIN): + mkdir -p $(LOCALBIN) + +ENVTEST ?= $(LOCALBIN)/setup-envtest +.PHONY: envtest +envtest: $(ENVTEST) ## Download setup-envtest locally if necessary. +$(ENVTEST): $(LOCALBIN) + test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest + +test: envtest ## Run tests. + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out -v \ No newline at end of file diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go new file mode 100644 index 00000000..1942e311 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -0,0 +1,66 @@ +package main + +import ( + "context" + + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type KubeDeleter interface { + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error +} + +type Compared struct { + old []v1.ClusterRoleBinding + new []v1.ClusterRoleBinding + missing []v1.ClusterRoleBinding + additional []v1.ClusterRoleBinding +} + +type Cleaner interface { + Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared + Clean(context.Context, []v1.ClusterRoleBinding) []Failure +} + +type CRBCleaner struct { + client KubeDeleter +} + +type Failure struct { + CRB v1.ClusterRoleBinding `json:"crb"` + Err error `json:"error"` +} + +func (c CRBCleaner) Clean(ctx context.Context, crbs []v1.ClusterRoleBinding) []Failure { + failures := make([]Failure, 0) + + for _, crb := range crbs { + err := c.client.Delete(ctx, crb.Name, metav1.DeleteOptions{}) + if err != nil { + failures = append(failures, Failure{ + CRB: crb, + Err: err, + }) + } + } + + return failures +} + +func (c CRBCleaner) Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared { + missing, additional := difference(old, new, CRBEquals) + + return Compared{ + old: old, + new: new, + missing: missing, + additional: additional, + } +} + +func NewCRBCleaner(client KubeDeleter) Cleaner { + return CRBCleaner{ + client: client, + } +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go new file mode 100644 index 00000000..796f55c8 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -0,0 +1,67 @@ +package main + +import ( + "flag" + "log/slog" + "os" + "reflect" + "strings" + + "github.com/knadh/koanf" + "github.com/knadh/koanf/providers/basicflag" +) + +var k = koanf.New("/") + +type Config struct { + Kubeconfig string `koanf:"kubeconfig"` + Pretend bool `koanf:"pretend"` + Verbose bool `koanf:"verbose"` + Force bool `koanf:"force"` + OldLabel string `koanf:"oldLabel"` + NewLabel string `koanf:"newLabel"` +} + +func ParseConfig() Config { + fs := flag.NewFlagSet("", flag.ExitOnError) + fs.String("kubeconfig", "", "Kubeconfig file path") + fs.String("oldLabel", LabelSelectorOld, "Label marking old CRBs") + fs.String("newLabel", LabelSelectorNew, "Label marking new CRBs") + fs.Bool("pretend", false, "Don't remove CRBs, print what would be removed (you might want to increase log level)") + fs.Bool("verbose", false, "Increase the log level to debug (default: info)") + fs.Bool("force", false, "Force remove CRBs without checking migration status") + + if err := fs.Parse(os.Args[1:]); err != nil { + slog.Error("Error parsing flags", "error", err) + os.Exit(1) + } + + if err := k.Load(basicflag.Provider(fs, "/"), nil); err != nil { + slog.Error("Error loading config", "error", err) + os.Exit(1) + } + + cfg := Config{ + OldLabel: LabelSelectorOld, + NewLabel: LabelSelectorNew, + } + if err := k.Unmarshal("", &cfg); err != nil { + slog.Error("Error unmarshalling config", "error", err) + os.Exit(1) + } + slog.Info("Parsed config", Spread(cfg)...) + return cfg +} + +// Spread returns list of struct fields in the format ["field_name", "field_value", /* ... */] +func Spread(val interface{}) []interface{} { + v := reflect.ValueOf(val) + t := v.Type() + + var res []interface{} + for i := 0; i < v.NumField(); i++ { + res = append(res, strings.ToLower(t.Field(i).Name), v.Field(i).Interface()) + } + + return res +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/crb_cleanup_suite_test.go b/hack/runtime-migrator/cmd/crb-cleanup/crb_cleanup_suite_test.go new file mode 100644 index 00000000..f9e592a1 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/crb_cleanup_suite_test.go @@ -0,0 +1,13 @@ +package main_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestCrbCleanup(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "CrbCleanup Suite") +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go b/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go new file mode 100644 index 00000000..d65f28fa --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go @@ -0,0 +1,51 @@ +package main + +import ( + "context" + + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Fetcher interface { + FetchNew(context.Context) ([]v1.ClusterRoleBinding, error) + FetchOld(context.Context) ([]v1.ClusterRoleBinding, error) +} + +type KubeLister interface { + List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterRoleBindingList, error) +} + +type CRBFetcher struct { + labelNew string + labelOld string + client KubeLister +} + +func (f CRBFetcher) fetch(ctx context.Context, label string) ([]v1.ClusterRoleBinding, error) { + list, err := f.client.List(ctx, metav1.ListOptions{ + LabelSelector: label, + }) + + if err != nil { + return nil, err + } + + return list.Items, nil +} + +func (f CRBFetcher) FetchNew(ctx context.Context) ([]v1.ClusterRoleBinding, error) { + return f.fetch(ctx, f.labelNew) +} + +func (f CRBFetcher) FetchOld(ctx context.Context) ([]v1.ClusterRoleBinding, error) { + return f.fetch(ctx, f.labelOld) +} + +func NewCRBFetcher(client KubeLister, labelOld, labelNew string) Fetcher { + return CRBFetcher{ + labelNew: labelNew, + labelOld: labelOld, + client: client, + } +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 4e494dc5..c3576d2c 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -2,17 +2,8 @@ package main import ( "context" - "flag" - "fmt" "log/slog" "os" - "path/filepath" - - v1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/util/homedir" ) // const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" @@ -20,137 +11,47 @@ const LabelSelectorOld = "reconciler.kyma-project.io/managed-by=infrastructure-m const LabelSelectorNew = "reconciler.kyma-project.io/managed-by=infrastructure-manager" func main() { - // ################### - // ### Parse flags ### - // ################### - - kubeconfig := filepath.Join(homedir.HomeDir(), ".kube", "config") - if envKubeconfig := os.Getenv("KUBECONFIG"); envKubeconfig != "" { - kubeconfig = envKubeconfig - } - - pretend := flag.Bool("pretend", false, "Don't remove CRBs, print what would be removed (you might want to increase log level)") - verbose := flag.Bool("verbose", false, "Increase the log level to debug (default: info)") - kubeconfigFlag := flag.String("kubeconfig", "", fmt.Sprintf("Kubeconfig file path, if not set: %s", kubeconfig)) - flag.Parse() - if kubeconfigFlag != nil && len(*kubeconfigFlag) > 0 { - kubeconfig = *kubeconfigFlag - } + cfg := ParseConfig() - _ = pretend - - // ################### - - if verbose != nil && *verbose { + if cfg.Verbose { slog.SetLogLoggerLevel(slog.LevelDebug) } else { slog.SetLogLoggerLevel(slog.LevelInfo) } - clientset := setupKubectl(kubeconfig) - var remover RBACRemover - if *pretend { - remover = RBACMockRemover{} - } else { - remover = RBACRemoverImpl{clientset: clientset} - } - ctx := context.Background() + client := setupKubectl(cfg.Kubeconfig).RbacV1().ClusterRoleBindings() + fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) + cleaner := NewCRBCleaner(client) - // ########################### - // ### List CRBs to remove ### - // ########################### + ProcessCRBs(fetcher, cleaner, cfg) +} - crbsOld, err := clientset.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ - LabelSelector: LabelSelectorOld, - }) +func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) []Failure { + ctx := context.Background() + oldCRBs, err := fetcher.FetchOld(ctx) if err != nil { - slog.Error("Error listing old CRBs", "error", err) + slog.Error("Error fetching old CRBs", "error", err) os.Exit(1) } - crbsNew, err := clientset.RbacV1().ClusterRoleBindings().List(context.TODO(), metav1.ListOptions{ - LabelSelector: LabelSelectorNew, - }) + newCRBs, err := fetcher.FetchNew(ctx) if err != nil { - slog.Error("Error listing new CRBs", "error", err) + slog.Error("Error fetching new CRBs", "error", err) os.Exit(1) } - // ############################################## - // ### Remove CRBs with migrated counterparts ### - // ############################################## + compared := cleaner.Compare(ctx, oldCRBs, newCRBs) - for _, crb := range crbsOld.Items { - slog.Debug("Comparing CRB", "name", crb.Name) - if !existsNew(crb, crbsNew) { - slog.Warn("CRB new counterpart not found", "name", crb.Name) - continue - } - slog.Debug("CRB exists in new form", "name", crb.Name) - slog.Info("Removing CRB", "name", crb.Name) - if err := remover.RemoveClusterRoleBinding(ctx, crb); err != nil { - slog.Error("Error removing CRB", "name", crb.Name, "error", err) - } + if len(compared.additional) != 0 { + slog.Info("New CRBs not found in old CRBs", "crbs", compared.additional) } - -} - -func existsNew(old v1.ClusterRoleBinding, new *v1.ClusterRoleBindingList) bool { -crbs: - for _, crb := range new.Items { - subjectsMap := make(map[v1.Subject]bool) - for _, subject := range crb.Subjects { - subjectsMap[subject] = true - } - - for _, subject := range old.Subjects { - if !subjectsMap[subject] { - slog.Debug("Subject not found", "subject", subject, "old", old.Name, "new", crb.Name) - continue crbs - } - } - - if old.RoleRef == crb.RoleRef { - return true + if len(compared.missing) != 0 { + slog.Warn("Old CRBs not found in new CRBs", "crbs", compared.missing) + if !cfg.Force { + slog.Info("Use -force to remove old CRBs without match") + os.Exit(1) } - slog.Debug("RoleRef not found", "old", old.Name, "new", crb.Name) - } - - return false -} - -type RBACRemover interface { - RemoveClusterRoleBinding(ctx context.Context, crb v1.ClusterRoleBinding) error -} - -type RBACRemoverImpl struct { - clientset kubernetes.Interface -} - -func (r RBACRemoverImpl) RemoveClusterRoleBinding(ctx context.Context, crb v1.ClusterRoleBinding) error { - slog.Info("Removing CRB", "name", crb.Name) - return r.clientset.RbacV1().ClusterRoleBindings().Delete(ctx, crb.Name, metav1.DeleteOptions{}) -} - -type RBACMockRemover struct{} - -func (r RBACMockRemover) RemoveClusterRoleBinding(_ context.Context, crb v1.ClusterRoleBinding) error { - slog.Debug("Mock client: [remove CRB]", "name", crb.Name) - return nil -} - -func setupKubectl(kubeconfig string) *kubernetes.Clientset { - config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) - if err != nil { - slog.Error("Error building kubeconfig", "error", err) - os.Exit(1) - } - - clientset, err := kubernetes.NewForConfig(config) - if err != nil { - slog.Error("Error building clientset", "error", err) - os.Exit(1) } - return clientset + return cleaner.Clean(ctx, oldCRBs) } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go new file mode 100644 index 00000000..94712837 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -0,0 +1,84 @@ +package main_test + +import ( + "context" + "fmt" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "sigs.k8s.io/controller-runtime/pkg/envtest" +) + +var _ = Describe("Envtest", func() { + ctx := context.Background() + testenv := &envtest.Environment{} + cfg, err := testenv.Start() + Expect(err).ToNot(HaveOccurred()) + + client, err := kubernetes.NewForConfig(cfg) + Expect(err).ToNot(HaveOccurred()) + crbClient := client.RbacV1().ClusterRoleBindings() + fetcher := NewCRBFetcher(crbClient, "old=true", "new=true") + cleaner := NewCRBCleaner(crbClient) + + It("removes old CRBs", func() { + By("Generate test data") + old, new := generateCRBs(5) + + for _, crb := range append(old, new...) { + _, err := crbClient.Create(ctx, crb, metav1.CreateOptions{}) + Expect(err).ToNot(HaveOccurred(), "Failed to create CRB %q", crb.Name) + } + + By("Processing CRBs") + failures := ProcessCRBs(fetcher, cleaner, Config{ + Kubeconfig: "", + Pretend: false, + Verbose: false, + Force: false, + OldLabel: "", + NewLabel: "", + }) + + Expect(failures).To(BeEmpty()) + Eventually(func() ([]rbacv1.ClusterRoleBinding, error) { + return fetcher.FetchOld(ctx) + }).Should(BeEmpty()) + }) +}) + +func generateCRBs(count int) ([]*rbacv1.ClusterRoleBinding, []*rbacv1.ClusterRoleBinding) { + old, new := make([]*rbacv1.ClusterRoleBinding, count), make([]*rbacv1.ClusterRoleBinding, count) + for i := 0; i < count; i++ { + old[i] = ClusterRoleBinding(fmt.Sprintf("old%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "old", "true") + new[i] = ClusterRoleBinding(fmt.Sprintf("new%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "new", "true") + } + return old, new +} + +func ClusterRoleBinding(name, user, role string, labels ...string) *rbacv1.ClusterRoleBinding { + labelsMap := map[string]string{} + for i := 0; i < len(labels); i += 2 { + labelsMap[labels[i]] = labels[i+1] + } + return &rbacv1.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Labels: labelsMap, + }, + Subjects: []rbacv1.Subject{ + { + Kind: "User", + Name: user, + }, + }, + RoleRef: rbacv1.RoleRef{ + APIGroup: "rbac.authorization.k8s.io", + Kind: "ClusterRole", + Name: role, + }, + } +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak new file mode 100644 index 00000000..442c0ed3 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak @@ -0,0 +1,86 @@ +package main + +import ( + "context" + "fmt" + "testing" + + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + + "github.com/stretchr/testify/assert" + "sigs.k8s.io/controller-runtime/pkg/envtest" +) + +func TestSimple(t *testing.T) { + ctx := context.Background() + testenv := &envtest.Environment{} + cfg, err := testenv.Start() + assert.NoError(t, err) + + // create a client + client, err := kubernetes.NewForConfig(cfg) + assert.NoError(t, err) + crbClient := client.RbacV1().ClusterRoleBindings() + + old, new := generateCRBs(5) + + for _, crb := range append(old, new...) { + _, err := crbClient.Create(ctx, crb, metav1.CreateOptions{}) + assert.NoError(t, err, "Error creating %q", crb.Name) + } + + fetcher := NewCRBFetcher(crbClient, "old=true", "new=true") + cleaner := NewCRBCleaner(crbClient) + failures := ProcessCRBs(fetcher, cleaner, Config{ + Kubeconfig: "", + Pretend: false, + Verbose: false, + Force: false, + OldLabel: "", + NewLabel: "", + }) + + assert.Len(t, failures, 0) + + _, err = crbClient.Get(ctx, "admin0", metav1.GetOptions{}) + assert.True(t, errors.IsNotFound(err), "Old CRB wasn't deleted") + + err = testenv.Stop() + assert.NoError(t, err) +} + +func generateCRBs(count int) ([]*rbacv1.ClusterRoleBinding, []*rbacv1.ClusterRoleBinding) { + old, new := make([]*rbacv1.ClusterRoleBinding, count), make([]*rbacv1.ClusterRoleBinding, count) + for i := 0; i < count; i++ { + old[i] = ClusterRoleBinding(fmt.Sprintf("old%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "old", "true") + new[i] = ClusterRoleBinding(fmt.Sprintf("new%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "new", "true") + } + return old, new +} + +func ClusterRoleBinding(name, user, role string, labels ...string) *rbacv1.ClusterRoleBinding { + labelsMap := map[string]string{} + for i := 0; i < len(labels); i += 2 { + labelsMap[labels[i]] = labels[i+1] + } + return &rbacv1.ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Labels: labelsMap, + }, + Subjects: []rbacv1.Subject{ + { + Kind: "User", + Name: user, + }, + }, + RoleRef: rbacv1.RoleRef{ + APIGroup: "rbac.authorization.k8s.io", + Kind: "ClusterRole", + Name: role, + }, + } +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils.go b/hack/runtime-migrator/cmd/crb-cleanup/utils.go new file mode 100644 index 00000000..787faf61 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils.go @@ -0,0 +1,67 @@ +package main + +import ( + "log/slog" + "os" + + v1 "k8s.io/api/rbac/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/clientcmd" +) + +func difference[T any](a, b []T, eql func(*T, *T) bool) ([]T, []T) { + var missing []T + + // Find elements in `a` that are not in `b` + for _, itemA := range a { + found := false + for i, itemB := range b { + if eql(&itemA, &itemB) { + found = true + b = append(b[:i], b[i+1:]...) + break + } + } + if !found { + missing = append(missing, itemA) + } + } + + return missing, b +} + +// CRBEquals checks if crbA is included in crbB +func CRBEquals(crbA, crbB *v1.ClusterRoleBinding) bool { + if crbA.RoleRef != crbB.RoleRef { + return false + } + + subjectsMap := make(map[v1.Subject]bool) + for _, subject := range crbA.Subjects { + subjectsMap[subject] = true + } + + for _, subject := range crbB.Subjects { + if _, ok := subjectsMap[subject]; !ok { + return false + } + } + return true +} + + +func setupKubectl(kubeconfig string) *kubernetes.Clientset { + config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) + if err != nil { + slog.Error("Error building kubeconfig", "error", err) + os.Exit(1) + } + + clientset, err := kubernetes.NewForConfig(config) + if err != nil { + slog.Error("Error building clientset", "error", err) + os.Exit(1) + } + + return clientset +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils_test.go b/hack/runtime-migrator/cmd/crb-cleanup/utils_test.go new file mode 100644 index 00000000..3399cff5 --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils_test.go @@ -0,0 +1,25 @@ +package main + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("Utils", func() { + Describe("Array difference", func() { + It("returns all unique elements", func() { + arr1 := []int{1, 2, 3, 4, 5} + arr2 := []int{3, 4, 5, 6, 7} + missing := []int{1, 2} + additional := []int{6, 7} + + intEql := func(a, b *int) bool { + return *a == *b + } + actualMissing, actualAdditional := difference(arr1, arr2, intEql) + + Expect(actualMissing).To(Equal(missing)) + Expect(actualAdditional).To(Equal(additional)) + }) + }) +}) diff --git a/hack/runtime-migrator/go.mod b/hack/runtime-migrator/go.mod index 6b70ec8e..ce263597 100644 --- a/hack/runtime-migrator/go.mod +++ b/hack/runtime-migrator/go.mod @@ -5,8 +5,11 @@ go 1.23.1 require ( github.com/gardener/gardener v1.110.0 github.com/go-playground/validator/v10 v10.23.0 + github.com/knadh/koanf v1.5.0 github.com/kyma-project/infrastructure-manager v0.0.0-20241023155010-55a6abeb1690 github.com/kyma-project/infrastructure-manager/hack/shoot-comparator v0.0.0-20241023155010-55a6abeb1690 + github.com/onsi/ginkgo/v2 v2.22.0 + github.com/onsi/gomega v1.36.1 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.10.0 k8s.io/api v0.32.0 @@ -35,11 +38,13 @@ require ( github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect @@ -47,10 +52,12 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/onsi/gomega v1.36.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/x448/float16 v0.8.4 // indirect @@ -63,6 +70,7 @@ require ( golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.8.0 // indirect + golang.org/x/tools v0.28.0 // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/hack/runtime-migrator/go.sum b/hack/runtime-migrator/go.sum index 74fe630e..e300274c 100644 --- a/hack/runtime-migrator/go.sum +++ b/hack/runtime-migrator/go.sum @@ -1,5 +1,8 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -9,24 +12,66 @@ github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lpr github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= +github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= +github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= +github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= +github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cyphar/filepath-securejoin v0.3.4 h1:VBWugsJh2ZxJmLFSM06/0qzQyiQX2Qs0ViKrUAcqdZ8= github.com/cyphar/filepath-securejoin v0.3.4/go.mod h1:8s/MCNJREmFK0H02MF6Ihv1nakJe4L/w3WZLHNkvlYM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fluent/fluent-operator/v2 v2.9.0 h1:VFGgRPOI+yxnOrTIAL6sgFCtc+quDda12iyVL1lRQag= github.com/fluent/fluent-operator/v2 v2.9.0/go.mod h1:Hthhi/3oO26udvro6t5foUx20PZAMn7WGUhSnEWUV9U= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -47,6 +92,14 @@ github.com/gardener/gardener-extension-shoot-dns-service v1.53.0 h1:WXSjw6y2bLCx github.com/gardener/gardener-extension-shoot-dns-service v1.53.0/go.mod h1:HG9iWR/XszjmH0mmTHIKmX2Egwo8+giSCF8pjqlIPfM= github.com/gardener/machine-controller-manager v0.55.1 h1:d6mTnuYko+jWeIi7tAFWgWnL1nR5hGcI6pRCDcH0TGY= github.com/gardener/machine-controller-manager v0.55.1/go.mod h1:eCng7De6OE15rndmMm6Q1fwMQI39esASCd3WKZ/lLmY= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -67,16 +120,47 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49/go.mod h1:BkkQ4L1KS1xMt2aWSPStnn55ChGC0DPOn2FQYj+f25M= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -85,27 +169,84 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= +github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= +github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= +github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= +github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hjson/hjson-go/v4 v4.0.0 h1:wlm6IYYqHjOdXH1gHev4VoXCaW20HdQAGCxdOEEg2cs= +github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs= +github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA= @@ -114,8 +255,31 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= @@ -123,41 +287,86 @@ github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVO github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.2 h1:SyoVBXD/r0PntR1rprb90ClI32FSUNOCWqqTatnipHM= github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.2/go.mod h1:SvsRXw4m1F2vk7HquU5h475bFpke27mIUswfyw9u3ug= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -169,24 +378,46 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= +go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0= golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= @@ -196,28 +427,74 @@ golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 h1:fVoAXEKA4+yufmbdVYv+SE73+cPZbbbe8paLsHfkK+U= google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53/go.mod h1:riSXTwQ4+nqmPGtobMFyW5FqVAmIs0St6VPp4Ug7CE4= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= helm.sh/helm/v3 v3.16.3 h1:kb8bSxMeRJ+knsK/ovvlaVPfdis0X3/ZhYCSFRP+YmY= helm.sh/helm/v3 v3.16.3/go.mod h1:zeVWGDR4JJgiRbT3AnNsjYaX8OTJlIE9zC+Q7F7iUSU= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= istio.io/api v1.23.3 h1:+CP0AHz8/+WJ7ZKJLbilHEiqBCi5KLe1Yil9bJI39ow= istio.io/api v1.23.3/go.mod h1:QPSTGXuIQdnZFEm3myf9NZ5uBMwCdJWUvfj9ZZ+2oBM= istio.io/client-go v1.23.3 h1:rs+mO4A+NaXVcZgDO0RRZE7KRAlDooq2PSkxl7tevig= @@ -252,5 +529,6 @@ sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1 sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A= sigs.k8s.io/structured-merge-diff/v4 v4.4.3/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 2040cec4d74b5281e7c4511fe45447a436e3adf8 Mon Sep 17 00:00:00 2001 From: void404 Date: Wed, 8 Jan 2025 09:50:48 +0100 Subject: [PATCH 03/16] Improve reporting + small fixes --- .../cmd/crb-cleanup/cleaner.go | 26 +++++- hack/runtime-migrator/cmd/crb-cleanup/main.go | 53 +++++++++--- .../cmd/crb-cleanup/main_test.go | 68 ++++++++++++++- .../cmd/crb-cleanup/main_test.go.bak | 86 ------------------- .../runtime-migrator/cmd/crb-cleanup/utils.go | 2 +- 5 files changed, 134 insertions(+), 101 deletions(-) delete mode 100644 hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go index 1942e311..0425c312 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -2,6 +2,9 @@ package main import ( "context" + "encoding/json" + "io" + "log/slog" v1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -19,7 +22,6 @@ type Compared struct { } type Cleaner interface { - Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared Clean(context.Context, []v1.ClusterRoleBinding) []Failure } @@ -32,12 +34,15 @@ type Failure struct { Err error `json:"error"` } +// Clean deletes CRBs, returning list of deleting errors func (c CRBCleaner) Clean(ctx context.Context, crbs []v1.ClusterRoleBinding) []Failure { failures := make([]Failure, 0) for _, crb := range crbs { + slog.Debug("Removing CRB", "crb", crb.Name) err := c.client.Delete(ctx, crb.Name, metav1.DeleteOptions{}) if err != nil { + slog.Error("Error removing CRB", "crb", crb.Name) failures = append(failures, Failure{ CRB: crb, Err: err, @@ -48,7 +53,8 @@ func (c CRBCleaner) Clean(ctx context.Context, crbs []v1.ClusterRoleBinding) []F return failures } -func (c CRBCleaner) Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared { +// Compare returns missing, additional and original CRBs +func Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared { missing, additional := difference(old, new, CRBEquals) return Compared{ @@ -64,3 +70,19 @@ func NewCRBCleaner(client KubeDeleter) Cleaner { client: client, } } + +type PretendCleaner struct { + removed io.Writer +} + +func (p PretendCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) []Failure { + err := json.NewEncoder(p.removed).Encode(crbs) + slog.Error("Error saving removed CRBs", "error", err, "crbs", crbs) + return nil +} + +func NewPretendCleaner(removed io.Writer) Cleaner { + return PretendCleaner{ + removed: removed, + } +} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index c3576d2c..65a6c087 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -4,10 +4,11 @@ import ( "context" "log/slog" "os" + + "encoding/json" ) -// const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" -const LabelSelectorOld = "reconciler.kyma-project.io/managed-by=infrastructure-manager" +const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" const LabelSelectorNew = "reconciler.kyma-project.io/managed-by=infrastructure-manager" func main() { @@ -21,26 +22,58 @@ func main() { client := setupKubectl(cfg.Kubeconfig).RbacV1().ClusterRoleBindings() fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) - cleaner := NewCRBCleaner(client) - ProcessCRBs(fetcher, cleaner, cfg) + var cleaner Cleaner + if cfg.Pretend { + slog.Info("Running in pretend mode") + file, err := os.OpenFile("./removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + slog.Error("Error opening file, to save list of removed", "error", err) + os.Exit(1) + } + defer file.Close() + cleaner = NewPretendCleaner(file) + } else { + cleaner = NewCRBCleaner(client) + } + + file, err := os.OpenFile("./failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + slog.Error("Error opening file, to save list of failures", "error", err) + os.Exit(1) + } + defer file.Close() + failures, err := ProcessCRBs(fetcher, cleaner, cfg) + if err != nil { + slog.Error("Error processing CRBs", "error", err) + os.Exit(1) + } + err = json.NewEncoder(file).Encode(failures) + if err != nil { + slog.Error("Error marshaling list of failures", "error", err, "failures", failures) + os.Exit(1) + } } -func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) []Failure { +// ProcessCRBs fetches old and new CRBs, compares them and cleans old CRBs +// It returns error on fetch errors +// It does nothing, if old CRBs are not found in new CRBs, unless force flag is set +// It returns list of failures on removal errors +func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) ([]Failure, error) { ctx := context.Background() oldCRBs, err := fetcher.FetchOld(ctx) if err != nil { slog.Error("Error fetching old CRBs", "error", err) - os.Exit(1) + return nil, err } newCRBs, err := fetcher.FetchNew(ctx) if err != nil { slog.Error("Error fetching new CRBs", "error", err) - os.Exit(1) + return nil, err } - compared := cleaner.Compare(ctx, oldCRBs, newCRBs) + compared := Compare(ctx, oldCRBs, newCRBs) if len(compared.additional) != 0 { slog.Info("New CRBs not found in old CRBs", "crbs", compared.additional) @@ -49,9 +82,9 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) []Failure { slog.Warn("Old CRBs not found in new CRBs", "crbs", compared.missing) if !cfg.Force { slog.Info("Use -force to remove old CRBs without match") - os.Exit(1) + return nil, nil } } - return cleaner.Clean(ctx, oldCRBs) + return cleaner.Clean(ctx, oldCRBs), nil } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go index 94712837..ce2aaa07 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -1,4 +1,4 @@ -package main_test +package main import ( "context" @@ -24,6 +24,16 @@ var _ = Describe("Envtest", func() { fetcher := NewCRBFetcher(crbClient, "old=true", "new=true") cleaner := NewCRBCleaner(crbClient) + BeforeEach(func() { + new, err := fetcher.FetchNew(ctx) + Expect(err).ToNot(HaveOccurred()) + + old, err := fetcher.FetchOld(ctx) + Expect(err).ToNot(HaveOccurred()) + + cleaner.Clean(ctx, append(new, old...)) + }) + It("removes old CRBs", func() { By("Generate test data") old, new := generateCRBs(5) @@ -34,7 +44,34 @@ var _ = Describe("Envtest", func() { } By("Processing CRBs") - failures := ProcessCRBs(fetcher, cleaner, Config{ + failures, err := ProcessCRBs(fetcher, cleaner, Config{ + Kubeconfig: "", + Pretend: false, + Verbose: false, + Force: false, + OldLabel: "", + NewLabel: "", + }) + + Expect(err).ToNot(HaveOccurred()) + Expect(failures).To(BeEmpty()) + + Eventually(func() ([]rbacv1.ClusterRoleBinding, error) { + return fetcher.FetchOld(ctx) + }).Should(BeEmpty()) + }) + + It("skips removal when mismatch is found", func() { + By("Generate test data") + old, new := generateCRBs(5) + + for _, crb := range append(old, new[3:]...) { + _, err := crbClient.Create(ctx, crb, metav1.CreateOptions{}) + Expect(err).ToNot(HaveOccurred(), "Failed to create CRB %q", crb.Name) + } + + By("Processing CRBs") + failures, err := ProcessCRBs(fetcher, cleaner, Config{ Kubeconfig: "", Pretend: false, Verbose: false, @@ -43,6 +80,33 @@ var _ = Describe("Envtest", func() { NewLabel: "", }) + Expect(err).ToNot(HaveOccurred()) + Expect(failures).To(BeEmpty()) + Consistently(func() ([]rbacv1.ClusterRoleBinding, error) { + return fetcher.FetchOld(ctx) + }).Should(HaveLen(5)) + }) + + It("removes despite mismatch, with -force", func() { + By("Generate test data") + old, new := generateCRBs(5) + + for _, crb := range append(old, new[3:]...) { + _, err := crbClient.Create(ctx, crb, metav1.CreateOptions{}) + Expect(err).ToNot(HaveOccurred(), "Failed to create CRB %q", crb.Name) + } + + By("Processing CRBs") + failures, err := ProcessCRBs(fetcher, cleaner, Config{ + Kubeconfig: "", + Pretend: false, + Verbose: false, + Force: true, + OldLabel: "", + NewLabel: "", + }) + + Expect(err).ToNot(HaveOccurred()) Expect(failures).To(BeEmpty()) Eventually(func() ([]rbacv1.ClusterRoleBinding, error) { return fetcher.FetchOld(ctx) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak deleted file mode 100644 index 442c0ed3..00000000 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go.bak +++ /dev/null @@ -1,86 +0,0 @@ -package main - -import ( - "context" - "fmt" - "testing" - - rbacv1 "k8s.io/api/rbac/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" - - "github.com/stretchr/testify/assert" - "sigs.k8s.io/controller-runtime/pkg/envtest" -) - -func TestSimple(t *testing.T) { - ctx := context.Background() - testenv := &envtest.Environment{} - cfg, err := testenv.Start() - assert.NoError(t, err) - - // create a client - client, err := kubernetes.NewForConfig(cfg) - assert.NoError(t, err) - crbClient := client.RbacV1().ClusterRoleBindings() - - old, new := generateCRBs(5) - - for _, crb := range append(old, new...) { - _, err := crbClient.Create(ctx, crb, metav1.CreateOptions{}) - assert.NoError(t, err, "Error creating %q", crb.Name) - } - - fetcher := NewCRBFetcher(crbClient, "old=true", "new=true") - cleaner := NewCRBCleaner(crbClient) - failures := ProcessCRBs(fetcher, cleaner, Config{ - Kubeconfig: "", - Pretend: false, - Verbose: false, - Force: false, - OldLabel: "", - NewLabel: "", - }) - - assert.Len(t, failures, 0) - - _, err = crbClient.Get(ctx, "admin0", metav1.GetOptions{}) - assert.True(t, errors.IsNotFound(err), "Old CRB wasn't deleted") - - err = testenv.Stop() - assert.NoError(t, err) -} - -func generateCRBs(count int) ([]*rbacv1.ClusterRoleBinding, []*rbacv1.ClusterRoleBinding) { - old, new := make([]*rbacv1.ClusterRoleBinding, count), make([]*rbacv1.ClusterRoleBinding, count) - for i := 0; i < count; i++ { - old[i] = ClusterRoleBinding(fmt.Sprintf("old%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "old", "true") - new[i] = ClusterRoleBinding(fmt.Sprintf("new%2d", i), fmt.Sprintf("user%d@sap.com", i), fmt.Sprintf("role%2d", i), "new", "true") - } - return old, new -} - -func ClusterRoleBinding(name, user, role string, labels ...string) *rbacv1.ClusterRoleBinding { - labelsMap := map[string]string{} - for i := 0; i < len(labels); i += 2 { - labelsMap[labels[i]] = labels[i+1] - } - return &rbacv1.ClusterRoleBinding{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: labelsMap, - }, - Subjects: []rbacv1.Subject{ - { - Kind: "User", - Name: user, - }, - }, - RoleRef: rbacv1.RoleRef{ - APIGroup: "rbac.authorization.k8s.io", - Kind: "ClusterRole", - Name: role, - }, - } -} diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils.go b/hack/runtime-migrator/cmd/crb-cleanup/utils.go index 787faf61..46f450f0 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/utils.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils.go @@ -49,8 +49,8 @@ func CRBEquals(crbA, crbB *v1.ClusterRoleBinding) bool { return true } - func setupKubectl(kubeconfig string) *kubernetes.Clientset { + slog.Info("Loading kubeconfig", "path", kubeconfig) config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) if err != nil { slog.Error("Error building kubeconfig", "error", err) From 8488d3f28de89a2c85990ff342996f33042b8d95 Mon Sep 17 00:00:00 2001 From: void404 Date: Wed, 8 Jan 2025 10:13:35 +0100 Subject: [PATCH 04/16] Improve reporting --- .../cmd/crb-cleanup/cleaner.go | 5 +++- .../cmd/crb-cleanup/config.go | 2 +- hack/runtime-migrator/cmd/crb-cleanup/main.go | 28 +++++++++++++++---- .../cmd/crb-cleanup/main_test.go | 6 ++-- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go index 0425c312..ce493cb1 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -76,8 +76,11 @@ type PretendCleaner struct { } func (p PretendCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) []Failure { + slog.Debug("Removing CRBs", "crbs", crbs) err := json.NewEncoder(p.removed).Encode(crbs) - slog.Error("Error saving removed CRBs", "error", err, "crbs", crbs) + if err != nil { + slog.Error("Error saving removed CRBs", "error", err, "crbs", crbs) + } return nil } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index 796f55c8..dbeb0b40 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -27,7 +27,7 @@ func ParseConfig() Config { fs.String("kubeconfig", "", "Kubeconfig file path") fs.String("oldLabel", LabelSelectorOld, "Label marking old CRBs") fs.String("newLabel", LabelSelectorNew, "Label marking new CRBs") - fs.Bool("pretend", false, "Don't remove CRBs, print what would be removed (you might want to increase log level)") + fs.Bool("pretend", false, "Don't remove CRBs, write what would be removed to ./removed.json") fs.Bool("verbose", false, "Increase the log level to debug (default: info)") fs.Bool("force", false, "Force remove CRBs without checking migration status") diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 65a6c087..91d23f85 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "io" "log/slog" "os" @@ -20,7 +21,8 @@ func main() { slog.SetLogLoggerLevel(slog.LevelInfo) } - client := setupKubectl(cfg.Kubeconfig).RbacV1().ClusterRoleBindings() + kubectl := setupKubectl(cfg.Kubeconfig) + client := kubectl.RbacV1().ClusterRoleBindings() fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) var cleaner Cleaner @@ -37,18 +39,26 @@ func main() { cleaner = NewCRBCleaner(client) } - file, err := os.OpenFile("./failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + failureFile, err := os.OpenFile("./failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of failures", "error", err) os.Exit(1) } - defer file.Close() - failures, err := ProcessCRBs(fetcher, cleaner, cfg) + defer failureFile.Close() + + missingFile, err := os.OpenFile("./missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + slog.Error("Error opening file, to save list of failures", "error", err) + os.Exit(1) + } + defer missingFile.Close() + + failures, err := ProcessCRBs(fetcher, cleaner, missingFile, cfg) if err != nil { slog.Error("Error processing CRBs", "error", err) os.Exit(1) } - err = json.NewEncoder(file).Encode(failures) + err = json.NewEncoder(failureFile).Encode(failures) if err != nil { slog.Error("Error marshaling list of failures", "error", err, "failures", failures) os.Exit(1) @@ -59,7 +69,7 @@ func main() { // It returns error on fetch errors // It does nothing, if old CRBs are not found in new CRBs, unless force flag is set // It returns list of failures on removal errors -func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) ([]Failure, error) { +func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, unmatched io.Writer, cfg Config) ([]Failure, error) { ctx := context.Background() oldCRBs, err := fetcher.FetchOld(ctx) if err != nil { @@ -80,6 +90,12 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, cfg Config) ([]Failure, error } if len(compared.missing) != 0 { slog.Warn("Old CRBs not found in new CRBs", "crbs", compared.missing) + if unmatched != nil { + err := json.NewEncoder(unmatched).Encode(compared.missing) + if err != nil { + slog.Error("Error saving unmatched CRBs", "error", err) + } + } if !cfg.Force { slog.Info("Use -force to remove old CRBs without match") return nil, nil diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go index ce2aaa07..5226d3e3 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -44,7 +44,7 @@ var _ = Describe("Envtest", func() { } By("Processing CRBs") - failures, err := ProcessCRBs(fetcher, cleaner, Config{ + failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ Kubeconfig: "", Pretend: false, Verbose: false, @@ -71,7 +71,7 @@ var _ = Describe("Envtest", func() { } By("Processing CRBs") - failures, err := ProcessCRBs(fetcher, cleaner, Config{ + failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ Kubeconfig: "", Pretend: false, Verbose: false, @@ -97,7 +97,7 @@ var _ = Describe("Envtest", func() { } By("Processing CRBs") - failures, err := ProcessCRBs(fetcher, cleaner, Config{ + failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ Kubeconfig: "", Pretend: false, Verbose: false, From ecf01f12ac6d87fcf23d338131842c60e5c10b79 Mon Sep 17 00:00:00 2001 From: void404 Date: Wed, 8 Jan 2025 10:31:11 +0100 Subject: [PATCH 05/16] Simplify config code --- .../cmd/crb-cleanup/config.go | 53 +--- .../cmd/crb-cleanup/main_test.go | 24 +- hack/runtime-migrator/go.mod | 4 - hack/runtime-migrator/go.sum | 278 ------------------ 4 files changed, 21 insertions(+), 338 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index dbeb0b40..3471efb7 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -3,52 +3,29 @@ package main import ( "flag" "log/slog" - "os" "reflect" "strings" - - "github.com/knadh/koanf" - "github.com/knadh/koanf/providers/basicflag" ) -var k = koanf.New("/") - type Config struct { - Kubeconfig string `koanf:"kubeconfig"` - Pretend bool `koanf:"pretend"` - Verbose bool `koanf:"verbose"` - Force bool `koanf:"force"` - OldLabel string `koanf:"oldLabel"` - NewLabel string `koanf:"newLabel"` + Kubeconfig string + Pretend bool + Verbose bool + Force bool + OldLabel string + NewLabel string + Prefix string } func ParseConfig() Config { - fs := flag.NewFlagSet("", flag.ExitOnError) - fs.String("kubeconfig", "", "Kubeconfig file path") - fs.String("oldLabel", LabelSelectorOld, "Label marking old CRBs") - fs.String("newLabel", LabelSelectorNew, "Label marking new CRBs") - fs.Bool("pretend", false, "Don't remove CRBs, write what would be removed to ./removed.json") - fs.Bool("verbose", false, "Increase the log level to debug (default: info)") - fs.Bool("force", false, "Force remove CRBs without checking migration status") - - if err := fs.Parse(os.Args[1:]); err != nil { - slog.Error("Error parsing flags", "error", err) - os.Exit(1) - } - - if err := k.Load(basicflag.Provider(fs, "/"), nil); err != nil { - slog.Error("Error loading config", "error", err) - os.Exit(1) - } - - cfg := Config{ - OldLabel: LabelSelectorOld, - NewLabel: LabelSelectorNew, - } - if err := k.Unmarshal("", &cfg); err != nil { - slog.Error("Error unmarshalling config", "error", err) - os.Exit(1) - } + cfg := Config{} + flag.StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Kubeconfig file path") + flag.StringVar(&cfg.OldLabel, "oldLabel", LabelSelectorOld, "Label marking old CRBs") + flag.StringVar(&cfg.NewLabel, "newLabel", LabelSelectorNew, "Label marking new CRBs") + flag.BoolVar(&cfg.Pretend, "pretend", false, "Don't remove CRBs, write what would be removed to ./removed.json") + flag.BoolVar(&cfg.Verbose, "verbose", false, "Increase the log level to debug (default: info)") + flag.BoolVar(&cfg.Force, "force", false, "Force remove CRBs without checking migration status") + flag.Parse() slog.Info("Parsed config", Spread(cfg)...) return cfg } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go index 5226d3e3..2eb02883 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -45,12 +45,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Kubeconfig: "", - Pretend: false, - Verbose: false, - Force: false, - OldLabel: "", - NewLabel: "", + Pretend: false, + Force: false, }) Expect(err).ToNot(HaveOccurred()) @@ -72,12 +68,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Kubeconfig: "", - Pretend: false, - Verbose: false, - Force: false, - OldLabel: "", - NewLabel: "", + Pretend: false, + Force: false, }) Expect(err).ToNot(HaveOccurred()) @@ -98,12 +90,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Kubeconfig: "", - Pretend: false, - Verbose: false, - Force: true, - OldLabel: "", - NewLabel: "", + Pretend: false, + Force: true, }) Expect(err).ToNot(HaveOccurred()) diff --git a/hack/runtime-migrator/go.mod b/hack/runtime-migrator/go.mod index ce263597..2e9943e5 100644 --- a/hack/runtime-migrator/go.mod +++ b/hack/runtime-migrator/go.mod @@ -5,7 +5,6 @@ go 1.23.1 require ( github.com/gardener/gardener v1.110.0 github.com/go-playground/validator/v10 v10.23.0 - github.com/knadh/koanf v1.5.0 github.com/kyma-project/infrastructure-manager v0.0.0-20241023155010-55a6abeb1690 github.com/kyma-project/infrastructure-manager/hack/shoot-comparator v0.0.0-20241023155010-55a6abeb1690 github.com/onsi/ginkgo/v2 v2.22.0 @@ -52,9 +51,6 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/hack/runtime-migrator/go.sum b/hack/runtime-migrator/go.sum index e300274c..74fe630e 100644 --- a/hack/runtime-migrator/go.sum +++ b/hack/runtime-migrator/go.sum @@ -1,8 +1,5 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -12,66 +9,24 @@ github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lpr github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= -github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cyphar/filepath-securejoin v0.3.4 h1:VBWugsJh2ZxJmLFSM06/0qzQyiQX2Qs0ViKrUAcqdZ8= github.com/cyphar/filepath-securejoin v0.3.4/go.mod h1:8s/MCNJREmFK0H02MF6Ihv1nakJe4L/w3WZLHNkvlYM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fluent/fluent-operator/v2 v2.9.0 h1:VFGgRPOI+yxnOrTIAL6sgFCtc+quDda12iyVL1lRQag= github.com/fluent/fluent-operator/v2 v2.9.0/go.mod h1:Hthhi/3oO26udvro6t5foUx20PZAMn7WGUhSnEWUV9U= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -92,14 +47,6 @@ github.com/gardener/gardener-extension-shoot-dns-service v1.53.0 h1:WXSjw6y2bLCx github.com/gardener/gardener-extension-shoot-dns-service v1.53.0/go.mod h1:HG9iWR/XszjmH0mmTHIKmX2Egwo8+giSCF8pjqlIPfM= github.com/gardener/machine-controller-manager v0.55.1 h1:d6mTnuYko+jWeIi7tAFWgWnL1nR5hGcI6pRCDcH0TGY= github.com/gardener/machine-controller-manager v0.55.1/go.mod h1:eCng7De6OE15rndmMm6Q1fwMQI39esASCd3WKZ/lLmY= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -120,47 +67,16 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49/go.mod h1:BkkQ4L1KS1xMt2aWSPStnn55ChGC0DPOn2FQYj+f25M= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -169,84 +85,27 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= -github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hjson/hjson-go/v4 v4.0.0 h1:wlm6IYYqHjOdXH1gHev4VoXCaW20HdQAGCxdOEEg2cs= -github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs= -github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA= @@ -255,31 +114,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= @@ -287,86 +123,41 @@ github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVO github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.2 h1:SyoVBXD/r0PntR1rprb90ClI32FSUNOCWqqTatnipHM= github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.2/go.mod h1:SvsRXw4m1F2vk7HquU5h475bFpke27mIUswfyw9u3ug= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -378,46 +169,24 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0= golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= @@ -427,74 +196,28 @@ golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 h1:fVoAXEKA4+yufmbdVYv+SE73+cPZbbbe8paLsHfkK+U= google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53/go.mod h1:riSXTwQ4+nqmPGtobMFyW5FqVAmIs0St6VPp4Ug7CE4= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= helm.sh/helm/v3 v3.16.3 h1:kb8bSxMeRJ+knsK/ovvlaVPfdis0X3/ZhYCSFRP+YmY= helm.sh/helm/v3 v3.16.3/go.mod h1:zeVWGDR4JJgiRbT3AnNsjYaX8OTJlIE9zC+Q7F7iUSU= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= istio.io/api v1.23.3 h1:+CP0AHz8/+WJ7ZKJLbilHEiqBCi5KLe1Yil9bJI39ow= istio.io/api v1.23.3/go.mod h1:QPSTGXuIQdnZFEm3myf9NZ5uBMwCdJWUvfj9ZZ+2oBM= istio.io/client-go v1.23.3 h1:rs+mO4A+NaXVcZgDO0RRZE7KRAlDooq2PSkxl7tevig= @@ -529,6 +252,5 @@ sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1 sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A= sigs.k8s.io/structured-merge-diff/v4 v4.4.3/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 8bb5e8d35c70dbfe7be45cfcb1c1e926c16a126e Mon Sep 17 00:00:00 2001 From: void404 Date: Wed, 8 Jan 2025 10:35:13 +0100 Subject: [PATCH 06/16] Allow for file prefixing --- hack/runtime-migrator/cmd/crb-cleanup/config.go | 1 + hack/runtime-migrator/cmd/crb-cleanup/main.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index 3471efb7..0aefa255 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -22,6 +22,7 @@ func ParseConfig() Config { flag.StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Kubeconfig file path") flag.StringVar(&cfg.OldLabel, "oldLabel", LabelSelectorOld, "Label marking old CRBs") flag.StringVar(&cfg.NewLabel, "newLabel", LabelSelectorNew, "Label marking new CRBs") + flag.StringVar(&cfg.Prefix, "prefix", "", "Prefix for created files (can be a folder, eg ./foo/)") flag.BoolVar(&cfg.Pretend, "pretend", false, "Don't remove CRBs, write what would be removed to ./removed.json") flag.BoolVar(&cfg.Verbose, "verbose", false, "Increase the log level to debug (default: info)") flag.BoolVar(&cfg.Force, "force", false, "Force remove CRBs without checking migration status") diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 91d23f85..dd769d9f 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -28,7 +28,7 @@ func main() { var cleaner Cleaner if cfg.Pretend { slog.Info("Running in pretend mode") - file, err := os.OpenFile("./removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + file, err := os.OpenFile(cfg.Prefix+"removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of removed", "error", err) os.Exit(1) @@ -39,14 +39,14 @@ func main() { cleaner = NewCRBCleaner(client) } - failureFile, err := os.OpenFile("./failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + failureFile, err := os.OpenFile(cfg.Prefix+"failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of failures", "error", err) os.Exit(1) } defer failureFile.Close() - missingFile, err := os.OpenFile("./missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + missingFile, err := os.OpenFile(cfg.Prefix+"missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of failures", "error", err) os.Exit(1) From dc2550a2af79e1ee8684105894bbe0d4f97d0d4b Mon Sep 17 00:00:00 2001 From: void404 Date: Thu, 9 Jan 2025 16:17:10 +0100 Subject: [PATCH 07/16] Add README --- .../cmd/crb-cleanup/README.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 hack/runtime-migrator/cmd/crb-cleanup/README.md diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md new file mode 100644 index 00000000..0325cb3c --- /dev/null +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -0,0 +1,44 @@ +# CRB Cleanup script + +This script is used to clean up old ClusterRoleBindings (CRBs) after migration. +It looks for old and new CRBs, compares them, +and if all old ones have a new equivalent - it removes the old ones. + +The cleanup script is run locally, with kubeconfig pointing to the cluster. + +## Configuration + +| flag | description | default | +| ------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `-kubeconfig` | Path to the kubeconfig file | in-cluster config | +| `-oldLabel` | Label selector for old CRBs | `kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner` | +| `-newLabel` | Label selector for new CRBs | `reconciler.kyma-project.io/managed-by=infrastructure-manager` | +| `-prefix` | Prefix for created logs | _empty_ | +| `-pretend` | Don't perform any destructive actions | `false` | +| `-verbose` | Print detailed logs | `false` | +| `-force` | Delete old CRBs even if they have no new equivalent | `false` | + +## Usage + +To run cleanup script, execute: + +```bash +go run ./cmd/crb-cleanup -prefix=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeconfig +``` + +If there are missing CRBs, the script will print a list of them and exit with a zero status code. +Missing CRBs can be inspected as JSON in `./dev/logs/my-cluster/missing.json`. + +After inspecting the missing CRBs, you can run the script again with the `-force` flag to delete them. + +If no CRBs are missing, the script will remove old CRBs. +Removed CRBs can be inspected as JSON in `./dev/logs/my-cluster/removed.json`. + +If any errors occured during deletion (eg. permission error), the CRBs that failed will be listed in `./dev/logs/my-cluster/failures.json`. + +All of the log files will be created either way. + +### `-pretend` mode + +When running the script with `-pretend` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. +No destructive actions will be performed. From 8d68bd016c3db8a2dc33ec1f568d5314ee2baa24 Mon Sep 17 00:00:00 2001 From: void404 Date: Thu, 9 Jan 2025 16:19:38 +0100 Subject: [PATCH 08/16] fixup! Add README --- hack/runtime-migrator/cmd/crb-cleanup/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index 0325cb3c..05337fcd 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -27,9 +27,9 @@ go run ./cmd/crb-cleanup -prefix=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeco ``` If there are missing CRBs, the script will print a list of them and exit with a zero status code. -Missing CRBs can be inspected as JSON in `./dev/logs/my-cluster/missing.json`. +Missing CRBs can be inspected as JSON in `./dev/logs/my-cluster/missing.json`. No CRBs will be removed. -After inspecting the missing CRBs, you can run the script again with the `-force` flag to delete them. +After inspecting the missing CRBs, you can re-run the script with the `-force` flag to delete them. If no CRBs are missing, the script will remove old CRBs. Removed CRBs can be inspected as JSON in `./dev/logs/my-cluster/removed.json`. From 47afd55e0b7c3611a463b98818c9f5efbe87f3fd Mon Sep 17 00:00:00 2001 From: void404 Date: Tue, 21 Jan 2025 11:33:36 +0100 Subject: [PATCH 09/16] Rename options, support KUBECONFIG env --- hack/runtime-migrator/cmd/crb-cleanup/README.md | 14 +++++++++----- hack/runtime-migrator/cmd/crb-cleanup/cleaner.go | 8 ++++---- hack/runtime-migrator/cmd/crb-cleanup/config.go | 14 ++++++++++---- hack/runtime-migrator/cmd/crb-cleanup/main.go | 12 ++++++------ hack/runtime-migrator/cmd/crb-cleanup/main_test.go | 12 ++++++------ 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index 05337fcd..7be9332c 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -13,17 +13,21 @@ The cleanup script is run locally, with kubeconfig pointing to the cluster. | `-kubeconfig` | Path to the kubeconfig file | in-cluster config | | `-oldLabel` | Label selector for old CRBs | `kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner` | | `-newLabel` | Label selector for new CRBs | `reconciler.kyma-project.io/managed-by=infrastructure-manager` | -| `-prefix` | Prefix for created logs | _empty_ | -| `-pretend` | Don't perform any destructive actions | `false` | +| `-output` | Output dir for created logs. | _empty_ (acts like `./ `) | +| `-dry-run` | Don't perform any destructive actions | `false` | | `-verbose` | Print detailed logs | `false` | | `-force` | Delete old CRBs even if they have no new equivalent | `false` | +> [!NOTE] +> if `-output` doesn't end with `/`, the name of the files will be prefixed with last segment. +> eg. `-output=./dev/log/cluster_a-` will create files like `./dev/log/cluster_a-missing.json`, `./dev/log/cluster_a-removed.json`, etc. + ## Usage To run cleanup script, execute: ```bash -go run ./cmd/crb-cleanup -prefix=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeconfig +go run ./cmd/crb-cleanup -output=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeconfig ``` If there are missing CRBs, the script will print a list of them and exit with a zero status code. @@ -38,7 +42,7 @@ If any errors occured during deletion (eg. permission error), the CRBs that fail All of the log files will be created either way. -### `-pretend` mode +### `-dry-run` mode -When running the script with `-pretend` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. +When running the script with `-dry-run` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. No destructive actions will be performed. diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go index ce493cb1..d2a511c5 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -71,11 +71,11 @@ func NewCRBCleaner(client KubeDeleter) Cleaner { } } -type PretendCleaner struct { +type DryCleaner struct { removed io.Writer } -func (p PretendCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) []Failure { +func (p DryCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) []Failure { slog.Debug("Removing CRBs", "crbs", crbs) err := json.NewEncoder(p.removed).Encode(crbs) if err != nil { @@ -84,8 +84,8 @@ func (p PretendCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) [ return nil } -func NewPretendCleaner(removed io.Writer) Cleaner { - return PretendCleaner{ +func NewDryCleaner(removed io.Writer) Cleaner { + return DryCleaner{ removed: removed, } } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index 0aefa255..5775036e 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -3,18 +3,19 @@ package main import ( "flag" "log/slog" + "os" "reflect" "strings" ) type Config struct { Kubeconfig string - Pretend bool + DryRun bool Verbose bool Force bool OldLabel string NewLabel string - Prefix string + Output string } func ParseConfig() Config { @@ -22,11 +23,16 @@ func ParseConfig() Config { flag.StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Kubeconfig file path") flag.StringVar(&cfg.OldLabel, "oldLabel", LabelSelectorOld, "Label marking old CRBs") flag.StringVar(&cfg.NewLabel, "newLabel", LabelSelectorNew, "Label marking new CRBs") - flag.StringVar(&cfg.Prefix, "prefix", "", "Prefix for created files (can be a folder, eg ./foo/)") - flag.BoolVar(&cfg.Pretend, "pretend", false, "Don't remove CRBs, write what would be removed to ./removed.json") + flag.StringVar(&cfg.Output, "output", "", "Output folder for created files. Can also contain file prefix, if it doesn't end with `/` (can be a folder, eg ./foo/)") + flag.BoolVar(&cfg.DryRun, "dry-run", false, "Don't remove CRBs, write what would be removed to ./removed.json") flag.BoolVar(&cfg.Verbose, "verbose", false, "Increase the log level to debug (default: info)") flag.BoolVar(&cfg.Force, "force", false, "Force remove CRBs without checking migration status") flag.Parse() + if cfg.Kubeconfig == "" { + if k, ok := os.LookupEnv("KUBECONFIG"); ok { + cfg.Kubeconfig = k + } + } slog.Info("Parsed config", Spread(cfg)...) return cfg } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index dd769d9f..3959809d 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -26,27 +26,27 @@ func main() { fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) var cleaner Cleaner - if cfg.Pretend { - slog.Info("Running in pretend mode") - file, err := os.OpenFile(cfg.Prefix+"removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if cfg.DryRun { + slog.Info("Running in dry-run mode") + file, err := os.OpenFile(cfg.Output+"removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of removed", "error", err) os.Exit(1) } defer file.Close() - cleaner = NewPretendCleaner(file) + cleaner = NewDryCleaner(file) } else { cleaner = NewCRBCleaner(client) } - failureFile, err := os.OpenFile(cfg.Prefix+"failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + failureFile, err := os.OpenFile(cfg.Output+"failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of failures", "error", err) os.Exit(1) } defer failureFile.Close() - missingFile, err := os.OpenFile(cfg.Prefix+"missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + missingFile, err := os.OpenFile(cfg.Output+"missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) if err != nil { slog.Error("Error opening file, to save list of failures", "error", err) os.Exit(1) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go index 2eb02883..86d9cf67 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -45,8 +45,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Pretend: false, - Force: false, + DryRun: false, + Force: false, }) Expect(err).ToNot(HaveOccurred()) @@ -68,8 +68,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Pretend: false, - Force: false, + DryRun: false, + Force: false, }) Expect(err).ToNot(HaveOccurred()) @@ -90,8 +90,8 @@ var _ = Describe("Envtest", func() { By("Processing CRBs") failures, err := ProcessCRBs(fetcher, cleaner, nil, Config{ - Pretend: false, - Force: true, + DryRun: false, + Force: true, }) Expect(err).ToNot(HaveOccurred()) From eadf175eda34db732338233e6f35fe456781d722 Mon Sep 17 00:00:00 2001 From: void404 Date: Thu, 23 Jan 2025 12:25:01 +0100 Subject: [PATCH 10/16] Log CRBs as only names --- hack/runtime-migrator/cmd/crb-cleanup/main.go | 4 ++-- hack/runtime-migrator/cmd/crb-cleanup/utils.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 3959809d..1e20cc6f 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -86,10 +86,10 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, unmatched io.Writer, cfg Conf compared := Compare(ctx, oldCRBs, newCRBs) if len(compared.additional) != 0 { - slog.Info("New CRBs not found in old CRBs", "crbs", compared.additional) + slog.Info("New CRBs not found in old CRBs", CRBNames(compared.additional)) } if len(compared.missing) != 0 { - slog.Warn("Old CRBs not found in new CRBs", "crbs", compared.missing) + slog.Warn("Old CRBs not found in new CRBs", CRBNames(compared.missing)) if unmatched != nil { err := json.NewEncoder(unmatched).Encode(compared.missing) if err != nil { diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils.go b/hack/runtime-migrator/cmd/crb-cleanup/utils.go index 46f450f0..41c2871e 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/utils.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils.go @@ -3,6 +3,7 @@ package main import ( "log/slog" "os" + "strconv" v1 "k8s.io/api/rbac/v1" "k8s.io/client-go/kubernetes" @@ -65,3 +66,12 @@ func setupKubectl(kubeconfig string) *kubernetes.Clientset { return clientset } + +func CRBNames(crbs []v1.ClusterRoleBinding) slog.Attr { + names := make([]any, len(crbs)) + for i := range crbs { + names[i] = slog.String(strconv.Itoa(i), crbs[i].Name) + } + + return slog.Group("crbs", names...) +} From 5136b15656e675d4121ca2519b44ee6730db1178 Mon Sep 17 00:00:00 2001 From: void404 Date: Thu, 23 Jan 2025 12:27:25 +0100 Subject: [PATCH 11/16] Inverse dry-run defaults --- hack/runtime-migrator/cmd/crb-cleanup/README.md | 11 +++++++---- hack/runtime-migrator/cmd/crb-cleanup/config.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index 7be9332c..2ddfdedd 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -13,8 +13,8 @@ The cleanup script is run locally, with kubeconfig pointing to the cluster. | `-kubeconfig` | Path to the kubeconfig file | in-cluster config | | `-oldLabel` | Label selector for old CRBs | `kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner` | | `-newLabel` | Label selector for new CRBs | `reconciler.kyma-project.io/managed-by=infrastructure-manager` | -| `-output` | Output dir for created logs. | _empty_ (acts like `./ `) | -| `-dry-run` | Don't perform any destructive actions | `false` | +| `-output` | Output dir for created logs. | _empty_ (acts like `./ `) | +| `-dry-run` | Don't perform any destructive actions | `true` | | `-verbose` | Print detailed logs | `false` | | `-force` | Delete old CRBs even if they have no new equivalent | `false` | @@ -22,12 +22,15 @@ The cleanup script is run locally, with kubeconfig pointing to the cluster. > if `-output` doesn't end with `/`, the name of the files will be prefixed with last segment. > eg. `-output=./dev/log/cluster_a-` will create files like `./dev/log/cluster_a-missing.json`, `./dev/log/cluster_a-removed.json`, etc. +> [!WARNING] +> without `-dry-run=false` the script won't delete anything, even with a `-force` flag + ## Usage To run cleanup script, execute: ```bash -go run ./cmd/crb-cleanup -output=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeconfig +go run ./cmd/crb-cleanup -output=./dev/logs/my-cluster/ -kubeconfig=./dev/kubeconfig -dry-run=false ``` If there are missing CRBs, the script will print a list of them and exit with a zero status code. @@ -44,5 +47,5 @@ All of the log files will be created either way. ### `-dry-run` mode -When running the script with `-dry-run` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. +When running the script without `-dry-run=false` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. No destructive actions will be performed. diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index 5775036e..b30abd08 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -24,7 +24,7 @@ func ParseConfig() Config { flag.StringVar(&cfg.OldLabel, "oldLabel", LabelSelectorOld, "Label marking old CRBs") flag.StringVar(&cfg.NewLabel, "newLabel", LabelSelectorNew, "Label marking new CRBs") flag.StringVar(&cfg.Output, "output", "", "Output folder for created files. Can also contain file prefix, if it doesn't end with `/` (can be a folder, eg ./foo/)") - flag.BoolVar(&cfg.DryRun, "dry-run", false, "Don't remove CRBs, write what would be removed to ./removed.json") + flag.BoolVar(&cfg.DryRun, "dry-run", true, "Don't remove CRBs, write what would be removed to ./removed.json") flag.BoolVar(&cfg.Verbose, "verbose", false, "Increase the log level to debug (default: info)") flag.BoolVar(&cfg.Force, "force", false, "Force remove CRBs without checking migration status") flag.Parse() From 2d1363322c05b09b6b94e0db98b39f78ee3baf36 Mon Sep 17 00:00:00 2001 From: void404 Date: Fri, 24 Jan 2025 09:24:29 +0100 Subject: [PATCH 12/16] Improve file handling --- .../cmd/crb-cleanup/README.md | 10 ++ .../cmd/crb-cleanup/cleaner.go | 12 +- hack/runtime-migrator/cmd/crb-cleanup/main.go | 37 ++---- .../runtime-migrator/cmd/crb-cleanup/utils.go | 105 ++++++++++++++++++ 4 files changed, 128 insertions(+), 36 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index 2ddfdedd..c3458e63 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -45,6 +45,16 @@ If any errors occured during deletion (eg. permission error), the CRBs that fail All of the log files will be created either way. +### prefixing logs based on env + +Create a script: +```bash +#!/bin/bash +crb-cleanup -output=./logs/${RUNTIME_NAME}_ -dry-run=true +``` + +When run, the script will create files like `./logs/some_runtime_missing.json` + ### `-dry-run` mode When running the script without `-dry-run=false` flag, CRBs that _would_ be removed will be listed as JSON in `./dev/logs/my-cluster/removed.json`. diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go index d2a511c5..953e35cb 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -2,8 +2,6 @@ package main import ( "context" - "encoding/json" - "io" "log/slog" v1 "k8s.io/api/rbac/v1" @@ -72,20 +70,20 @@ func NewCRBCleaner(client KubeDeleter) Cleaner { } type DryCleaner struct { - removed io.Writer + filer Filer } func (p DryCleaner) Clean(_ context.Context, crbs []v1.ClusterRoleBinding) []Failure { slog.Debug("Removing CRBs", "crbs", crbs) - err := json.NewEncoder(p.removed).Encode(crbs) + err := p.filer.Removed(crbs) if err != nil { - slog.Error("Error saving removed CRBs", "error", err, "crbs", crbs) + slog.Error("Error saving removed CRBs", "error", err, "crbs", CRBNames(crbs)) } return nil } -func NewDryCleaner(removed io.Writer) Cleaner { +func NewDryCleaner(filer Filer) Cleaner { return DryCleaner{ - removed: removed, + filer: filer, } } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 1e20cc6f..147c4c8d 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -2,11 +2,8 @@ package main import ( "context" - "io" "log/slog" "os" - - "encoding/json" ) const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" @@ -25,40 +22,22 @@ func main() { client := kubectl.RbacV1().ClusterRoleBindings() fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) + filer := NewJSONFiler(cfg.Output) + var cleaner Cleaner if cfg.DryRun { slog.Info("Running in dry-run mode") - file, err := os.OpenFile(cfg.Output+"removed.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) - if err != nil { - slog.Error("Error opening file, to save list of removed", "error", err) - os.Exit(1) - } - defer file.Close() - cleaner = NewDryCleaner(file) + cleaner = NewDryCleaner(filer) } else { cleaner = NewCRBCleaner(client) } - failureFile, err := os.OpenFile(cfg.Output+"failures.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) - if err != nil { - slog.Error("Error opening file, to save list of failures", "error", err) - os.Exit(1) - } - defer failureFile.Close() - - missingFile, err := os.OpenFile(cfg.Output+"missing.json", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) - if err != nil { - slog.Error("Error opening file, to save list of failures", "error", err) - os.Exit(1) - } - defer missingFile.Close() - - failures, err := ProcessCRBs(fetcher, cleaner, missingFile, cfg) + failures, err := ProcessCRBs(fetcher, cleaner, filer, cfg) if err != nil { slog.Error("Error processing CRBs", "error", err) os.Exit(1) } - err = json.NewEncoder(failureFile).Encode(failures) + err = filer.Failures(failures) if err != nil { slog.Error("Error marshaling list of failures", "error", err, "failures", failures) os.Exit(1) @@ -69,7 +48,7 @@ func main() { // It returns error on fetch errors // It does nothing, if old CRBs are not found in new CRBs, unless force flag is set // It returns list of failures on removal errors -func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, unmatched io.Writer, cfg Config) ([]Failure, error) { +func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, filer Filer, cfg Config) ([]Failure, error) { ctx := context.Background() oldCRBs, err := fetcher.FetchOld(ctx) if err != nil { @@ -90,8 +69,8 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, unmatched io.Writer, cfg Conf } if len(compared.missing) != 0 { slog.Warn("Old CRBs not found in new CRBs", CRBNames(compared.missing)) - if unmatched != nil { - err := json.NewEncoder(unmatched).Encode(compared.missing) + if filer != nil { + err := filer.Missing(compared.missing) if err != nil { slog.Error("Error saving unmatched CRBs", "error", err) } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils.go b/hack/runtime-migrator/cmd/crb-cleanup/utils.go index 41c2871e..1e498086 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/utils.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils.go @@ -1,8 +1,11 @@ package main import ( + "encoding/json" + "io" "log/slog" "os" + "path" "strconv" v1 "k8s.io/api/rbac/v1" @@ -75,3 +78,105 @@ func CRBNames(crbs []v1.ClusterRoleBinding) slog.Attr { return slog.Group("crbs", names...) } + +type Filer interface { + Missing(crbs []v1.ClusterRoleBinding) error + Removed(crbs []v1.ClusterRoleBinding) error + Failures(failures []Failure) error +} + +type nopFiler struct{} + +func (n nopFiler) Failures(failures []Failure) error { + return nil +} + +func (n nopFiler) Missing(crbs []v1.ClusterRoleBinding) error { + return nil +} + +func (n nopFiler) Removed(crbs []v1.ClusterRoleBinding) error { + return nil +} + +func NewNopFiler() Filer { + return nopFiler{} +} + +type JSONFiler struct { + prefix string + missing io.Writer + removed io.Writer + failures io.Writer +} + +// Failures implements Filer. +func (j JSONFiler) Failures(failures []Failure) error { + if failures == nil || len(failures) <= 0 { + return nil + } + path := j.prefix + "failures.json" + err := j.ensure(path) + if err != nil { + return err + } + if j.failures == nil { + j.failures, err = os.Create(path) + if err != nil { + return err + } + } + return json.NewEncoder(j.failures).Encode(failures) +} + +// Missing implements Filer. +func (j JSONFiler) Missing(crbs []v1.ClusterRoleBinding) error { + if crbs == nil || len(crbs) <= 0 { + return nil + } + path := j.prefix + "missing.json" + err := j.ensure(path) + if err != nil { + return err + } + if j.missing == nil { + j.missing, err = os.Create(path) + if err != nil { + return err + } + } + return json.NewEncoder(j.missing).Encode(crbs) +} + +// Removed implements Filer. +func (j JSONFiler) Removed(crbs []v1.ClusterRoleBinding) error { + if crbs == nil || len(crbs) <= 0 { + return nil + } + path := j.prefix + "removed.json" + err := j.ensure(path) + if err != nil { + return err + } + if j.removed == nil { + j.removed, err = os.Create(path) + if err != nil { + return err + } + } + return json.NewEncoder(j.removed).Encode(crbs) +} + +func (j JSONFiler) ensure(file string) error { + dir := path.Dir(file) + return os.MkdirAll(dir, os.ModePerm) +} + +func NewJSONFiler(prefix string) Filer { + return JSONFiler{ + prefix: prefix, + missing: nil, + removed: nil, + failures: nil, + } +} From 56d2fd744e8c5dbe252e4d6c745f40145c6c6a0f Mon Sep 17 00:00:00 2001 From: void404 Date: Fri, 24 Jan 2025 09:26:05 +0100 Subject: [PATCH 13/16] Correct logging --- hack/runtime-migrator/cmd/crb-cleanup/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 147c4c8d..118c9327 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -42,6 +42,7 @@ func main() { slog.Error("Error marshaling list of failures", "error", err, "failures", failures) os.Exit(1) } + slog.Info("Completed without errors") } // ProcessCRBs fetches old and new CRBs, compares them and cleans old CRBs @@ -64,9 +65,6 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, filer Filer, cfg Config) ([]F compared := Compare(ctx, oldCRBs, newCRBs) - if len(compared.additional) != 0 { - slog.Info("New CRBs not found in old CRBs", CRBNames(compared.additional)) - } if len(compared.missing) != 0 { slog.Warn("Old CRBs not found in new CRBs", CRBNames(compared.missing)) if filer != nil { From 651921cec4deae5d46a7c262f5f15f2b7c815352 Mon Sep 17 00:00:00 2001 From: void404 Date: Fri, 24 Jan 2025 09:46:42 +0100 Subject: [PATCH 14/16] Rename old/new to provisioner/kim --- .../cmd/crb-cleanup/README.md | 26 +++++++++---------- .../cmd/crb-cleanup/cleaner.go | 20 +++++++------- .../cmd/crb-cleanup/config.go | 18 ++++++------- .../cmd/crb-cleanup/fetcher.go | 26 +++++++++---------- hack/runtime-migrator/cmd/crb-cleanup/main.go | 26 +++++++++---------- .../cmd/crb-cleanup/main_test.go | 10 +++---- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index c3458e63..01c2368c 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -1,22 +1,22 @@ # CRB Cleanup script -This script is used to clean up old ClusterRoleBindings (CRBs) after migration. -It looks for old and new CRBs, compares them, -and if all old ones have a new equivalent - it removes the old ones. +This script is used to clean up provisioner's ClusterRoleBindings (CRBs) after migration. +It looks for provisioner and kim CRBs, compares them, +and if all of provisioner's CRBs have a KIM equivalent - it removes the provisioner's ones. The cleanup script is run locally, with kubeconfig pointing to the cluster. ## Configuration -| flag | description | default | -| ------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `-kubeconfig` | Path to the kubeconfig file | in-cluster config | -| `-oldLabel` | Label selector for old CRBs | `kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner` | -| `-newLabel` | Label selector for new CRBs | `reconciler.kyma-project.io/managed-by=infrastructure-manager` | -| `-output` | Output dir for created logs. | _empty_ (acts like `./ `) | -| `-dry-run` | Don't perform any destructive actions | `true` | -| `-verbose` | Print detailed logs | `false` | -| `-force` | Delete old CRBs even if they have no new equivalent | `false` | +| flag | description | default | +| ------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `-kubeconfig` | Path to the kubeconfig file | in-cluster config | +| `-provisionerLabel` | Label selector for provisioner CRBs | `kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner` | +| `-kimLabel` | Label selector for kim CRBs | `reconciler.kyma-project.io/managed-by=infrastructure-manager` | +| `-output` | Output dir for created logs. | _empty_ (acts like `./ `) | +| `-dry-run` | Don't perform any destructive actions | `true` | +| `-verbose` | Print detailed logs | `false` | +| `-force` | Delete provisioner CRBs even if they have no kim equivalent | `false` | > [!NOTE] > if `-output` doesn't end with `/`, the name of the files will be prefixed with last segment. @@ -38,7 +38,7 @@ Missing CRBs can be inspected as JSON in `./dev/logs/my-cluster/missing.json`. N After inspecting the missing CRBs, you can re-run the script with the `-force` flag to delete them. -If no CRBs are missing, the script will remove old CRBs. +If no CRBs are missing, the script will remove provisioner CRBs. Removed CRBs can be inspected as JSON in `./dev/logs/my-cluster/removed.json`. If any errors occured during deletion (eg. permission error), the CRBs that failed will be listed in `./dev/logs/my-cluster/failures.json`. diff --git a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go index 953e35cb..8b3d3dc4 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/cleaner.go @@ -13,10 +13,10 @@ type KubeDeleter interface { } type Compared struct { - old []v1.ClusterRoleBinding - new []v1.ClusterRoleBinding - missing []v1.ClusterRoleBinding - additional []v1.ClusterRoleBinding + provisioner []v1.ClusterRoleBinding + kim []v1.ClusterRoleBinding + missing []v1.ClusterRoleBinding + additional []v1.ClusterRoleBinding } type Cleaner interface { @@ -52,14 +52,14 @@ func (c CRBCleaner) Clean(ctx context.Context, crbs []v1.ClusterRoleBinding) []F } // Compare returns missing, additional and original CRBs -func Compare(ctx context.Context, old []v1.ClusterRoleBinding, new []v1.ClusterRoleBinding) Compared { - missing, additional := difference(old, new, CRBEquals) +func Compare(ctx context.Context, provisioner []v1.ClusterRoleBinding, kim []v1.ClusterRoleBinding) Compared { + missing, additional := difference(provisioner, kim, CRBEquals) return Compared{ - old: old, - new: new, - missing: missing, - additional: additional, + provisioner: provisioner, + kim: kim, + missing: missing, + additional: additional, } } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/config.go b/hack/runtime-migrator/cmd/crb-cleanup/config.go index b30abd08..c9fccfff 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/config.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/config.go @@ -9,20 +9,20 @@ import ( ) type Config struct { - Kubeconfig string - DryRun bool - Verbose bool - Force bool - OldLabel string - NewLabel string - Output string + Kubeconfig string + DryRun bool + Verbose bool + Force bool + ProvisionerLabel string + KimLabel string + Output string } func ParseConfig() Config { cfg := Config{} flag.StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Kubeconfig file path") - flag.StringVar(&cfg.OldLabel, "oldLabel", LabelSelectorOld, "Label marking old CRBs") - flag.StringVar(&cfg.NewLabel, "newLabel", LabelSelectorNew, "Label marking new CRBs") + flag.StringVar(&cfg.ProvisionerLabel, "provisionerLabel", LabelSelectorProvisioner, "Label marking provisioner's CRBs") + flag.StringVar(&cfg.KimLabel, "kimLabel", LabelSelectorKim, "Label marking kim's CRBs") flag.StringVar(&cfg.Output, "output", "", "Output folder for created files. Can also contain file prefix, if it doesn't end with `/` (can be a folder, eg ./foo/)") flag.BoolVar(&cfg.DryRun, "dry-run", true, "Don't remove CRBs, write what would be removed to ./removed.json") flag.BoolVar(&cfg.Verbose, "verbose", false, "Increase the log level to debug (default: info)") diff --git a/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go b/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go index d65f28fa..f188a161 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/fetcher.go @@ -8,8 +8,8 @@ import ( ) type Fetcher interface { - FetchNew(context.Context) ([]v1.ClusterRoleBinding, error) - FetchOld(context.Context) ([]v1.ClusterRoleBinding, error) + FetchKim(context.Context) ([]v1.ClusterRoleBinding, error) + FetchProvisioner(context.Context) ([]v1.ClusterRoleBinding, error) } type KubeLister interface { @@ -17,9 +17,9 @@ type KubeLister interface { } type CRBFetcher struct { - labelNew string - labelOld string - client KubeLister + labelKim string + labelProvisioner string + client KubeLister } func (f CRBFetcher) fetch(ctx context.Context, label string) ([]v1.ClusterRoleBinding, error) { @@ -34,18 +34,18 @@ func (f CRBFetcher) fetch(ctx context.Context, label string) ([]v1.ClusterRoleBi return list.Items, nil } -func (f CRBFetcher) FetchNew(ctx context.Context) ([]v1.ClusterRoleBinding, error) { - return f.fetch(ctx, f.labelNew) +func (f CRBFetcher) FetchKim(ctx context.Context) ([]v1.ClusterRoleBinding, error) { + return f.fetch(ctx, f.labelKim) } -func (f CRBFetcher) FetchOld(ctx context.Context) ([]v1.ClusterRoleBinding, error) { - return f.fetch(ctx, f.labelOld) +func (f CRBFetcher) FetchProvisioner(ctx context.Context) ([]v1.ClusterRoleBinding, error) { + return f.fetch(ctx, f.labelProvisioner) } -func NewCRBFetcher(client KubeLister, labelOld, labelNew string) Fetcher { +func NewCRBFetcher(client KubeLister, labelProvisioner, labelKim string) Fetcher { return CRBFetcher{ - labelNew: labelNew, - labelOld: labelOld, - client: client, + labelKim: labelKim, + labelProvisioner: labelProvisioner, + client: client, } } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main.go b/hack/runtime-migrator/cmd/crb-cleanup/main.go index 118c9327..bca364d3 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main.go @@ -6,8 +6,8 @@ import ( "os" ) -const LabelSelectorOld = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" -const LabelSelectorNew = "reconciler.kyma-project.io/managed-by=infrastructure-manager" +const LabelSelectorProvisioner = "kyma-project.io/deprecation=to-be-removed-soon,reconciler.kyma-project.io/managed-by=provisioner" +const LabelSelectorKim = "reconciler.kyma-project.io/managed-by=infrastructure-manager" func main() { cfg := ParseConfig() @@ -20,7 +20,7 @@ func main() { kubectl := setupKubectl(cfg.Kubeconfig) client := kubectl.RbacV1().ClusterRoleBindings() - fetcher := NewCRBFetcher(client, cfg.OldLabel, cfg.NewLabel) + fetcher := NewCRBFetcher(client, cfg.ProvisionerLabel, cfg.KimLabel) filer := NewJSONFiler(cfg.Output) @@ -45,28 +45,28 @@ func main() { slog.Info("Completed without errors") } -// ProcessCRBs fetches old and new CRBs, compares them and cleans old CRBs +// ProcessCRBs fetches provisioner's and kim's CRBs, compares them and cleans provisioner's CRBs // It returns error on fetch errors -// It does nothing, if old CRBs are not found in new CRBs, unless force flag is set +// It does nothing, if provisioner's CRBs are not found in kim's CRBs, unless force flag is set // It returns list of failures on removal errors func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, filer Filer, cfg Config) ([]Failure, error) { ctx := context.Background() - oldCRBs, err := fetcher.FetchOld(ctx) + provisionerCRBs, err := fetcher.FetchProvisioner(ctx) if err != nil { - slog.Error("Error fetching old CRBs", "error", err) + slog.Error("Error fetching provisioner CRBs", "error", err) return nil, err } - newCRBs, err := fetcher.FetchNew(ctx) + kimCRBs, err := fetcher.FetchKim(ctx) if err != nil { - slog.Error("Error fetching new CRBs", "error", err) + slog.Error("Error fetching kim CRBs", "error", err) return nil, err } - compared := Compare(ctx, oldCRBs, newCRBs) + compared := Compare(ctx, provisionerCRBs, kimCRBs) if len(compared.missing) != 0 { - slog.Warn("Old CRBs not found in new CRBs", CRBNames(compared.missing)) + slog.Warn("Provisioner CRBs not found in kim CRBs", CRBNames(compared.missing)) if filer != nil { err := filer.Missing(compared.missing) if err != nil { @@ -74,10 +74,10 @@ func ProcessCRBs(fetcher Fetcher, cleaner Cleaner, filer Filer, cfg Config) ([]F } } if !cfg.Force { - slog.Info("Use -force to remove old CRBs without match") + slog.Info("Use -force to remove provisioner CRBs without match") return nil, nil } } - return cleaner.Clean(ctx, oldCRBs), nil + return cleaner.Clean(ctx, provisionerCRBs), nil } diff --git a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go index 86d9cf67..3c3b0545 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/main_test.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/main_test.go @@ -25,10 +25,10 @@ var _ = Describe("Envtest", func() { cleaner := NewCRBCleaner(crbClient) BeforeEach(func() { - new, err := fetcher.FetchNew(ctx) + new, err := fetcher.FetchKim(ctx) Expect(err).ToNot(HaveOccurred()) - old, err := fetcher.FetchOld(ctx) + old, err := fetcher.FetchProvisioner(ctx) Expect(err).ToNot(HaveOccurred()) cleaner.Clean(ctx, append(new, old...)) @@ -53,7 +53,7 @@ var _ = Describe("Envtest", func() { Expect(failures).To(BeEmpty()) Eventually(func() ([]rbacv1.ClusterRoleBinding, error) { - return fetcher.FetchOld(ctx) + return fetcher.FetchProvisioner(ctx) }).Should(BeEmpty()) }) @@ -75,7 +75,7 @@ var _ = Describe("Envtest", func() { Expect(err).ToNot(HaveOccurred()) Expect(failures).To(BeEmpty()) Consistently(func() ([]rbacv1.ClusterRoleBinding, error) { - return fetcher.FetchOld(ctx) + return fetcher.FetchProvisioner(ctx) }).Should(HaveLen(5)) }) @@ -97,7 +97,7 @@ var _ = Describe("Envtest", func() { Expect(err).ToNot(HaveOccurred()) Expect(failures).To(BeEmpty()) Eventually(func() ([]rbacv1.ClusterRoleBinding, error) { - return fetcher.FetchOld(ctx) + return fetcher.FetchProvisioner(ctx) }).Should(BeEmpty()) }) }) From 83827f9efa85b2dc38a307de979e8d9a6b947905 Mon Sep 17 00:00:00 2001 From: void404 Date: Fri, 24 Jan 2025 13:26:30 +0100 Subject: [PATCH 15/16] Refactor filer --- .../runtime-migrator/cmd/crb-cleanup/utils.go | 50 +++++-------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/utils.go b/hack/runtime-migrator/cmd/crb-cleanup/utils.go index 1e498086..a747f7ef 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/utils.go +++ b/hack/runtime-migrator/cmd/crb-cleanup/utils.go @@ -115,18 +115,7 @@ func (j JSONFiler) Failures(failures []Failure) error { if failures == nil || len(failures) <= 0 { return nil } - path := j.prefix + "failures.json" - err := j.ensure(path) - if err != nil { - return err - } - if j.failures == nil { - j.failures, err = os.Create(path) - if err != nil { - return err - } - } - return json.NewEncoder(j.failures).Encode(failures) + return saveLogs(failures, j.prefix+"failures.json") } // Missing implements Filer. @@ -134,18 +123,7 @@ func (j JSONFiler) Missing(crbs []v1.ClusterRoleBinding) error { if crbs == nil || len(crbs) <= 0 { return nil } - path := j.prefix + "missing.json" - err := j.ensure(path) - if err != nil { - return err - } - if j.missing == nil { - j.missing, err = os.Create(path) - if err != nil { - return err - } - } - return json.NewEncoder(j.missing).Encode(crbs) + return saveLogs(crbs, j.prefix+"missing.json") } // Removed implements Filer. @@ -153,23 +131,21 @@ func (j JSONFiler) Removed(crbs []v1.ClusterRoleBinding) error { if crbs == nil || len(crbs) <= 0 { return nil } - path := j.prefix + "removed.json" - err := j.ensure(path) + return saveLogs(crbs, j.prefix+"removed.json") +} + +func saveLogs[T any](data T, path_ string) error { + dir := path.Dir(path_) + err := os.MkdirAll(dir, os.ModePerm) if err != nil { return err } - if j.removed == nil { - j.removed, err = os.Create(path) - if err != nil { - return err - } + file, err := os.Create(path_) + if err != nil { + return err } - return json.NewEncoder(j.removed).Encode(crbs) -} - -func (j JSONFiler) ensure(file string) error { - dir := path.Dir(file) - return os.MkdirAll(dir, os.ModePerm) + defer file.Close() + return json.NewEncoder(file).Encode(data) } func NewJSONFiler(prefix string) Filer { From 8c8ffb03680ccbb83d4c77ac25e4f71fe29e81e4 Mon Sep 17 00:00:00 2001 From: void404 Date: Fri, 24 Jan 2025 13:27:09 +0100 Subject: [PATCH 16/16] Correct headers in README --- hack/runtime-migrator/cmd/crb-cleanup/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/runtime-migrator/cmd/crb-cleanup/README.md b/hack/runtime-migrator/cmd/crb-cleanup/README.md index 01c2368c..6405f674 100644 --- a/hack/runtime-migrator/cmd/crb-cleanup/README.md +++ b/hack/runtime-migrator/cmd/crb-cleanup/README.md @@ -45,9 +45,10 @@ If any errors occured during deletion (eg. permission error), the CRBs that fail All of the log files will be created either way. -### prefixing logs based on env +### prefixing logs in `kcp taskrun` Create a script: + ```bash #!/bin/bash crb-cleanup -output=./logs/${RUNTIME_NAME}_ -dry-run=true