From c17e98a2e10d7feef570f3be426a9417e66d8f58 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Mon, 7 Oct 2024 06:22:41 -0700 Subject: [PATCH] Load resource editor from cluster if overridden Signed-off-by: Tamal Saha --- go.mod | 10 ++--- go.sum | 20 +++++----- pkg/apiserver/apiserver.go | 2 +- pkg/menu/gallery_menu.go | 12 ++---- pkg/menu/lib.go | 2 +- pkg/menu/usermenu.go | 2 +- pkg/registry/meta/resourceeditor/storage.go | 7 +++- .../alessio/shellescape/.golangci.yml | 9 +---- .../alessio/shellescape/.goreleaser.yml | 35 ++++++++++++---- .../docker/cli/cli/config/configfile/file.go | 1 + .../helm/v3/internal/version/version.go | 2 +- .../helm.sh/helm/v3/pkg/chartutil/create.go | 2 +- vendor/helm.sh/helm/v3/pkg/ignore/rules.go | 6 +-- .../v1alpha1/backupconfigurations.yaml | 7 ++++ .../v1alpha1/backupsessions.yaml | 7 ++++ .../kubedb.com/v1/elasticsearches.yaml | 2 +- .../hub/resourceeditors/lib.go | 40 +++++++++---------- .../v1alpha1/backupstorages.yaml | 7 ++++ .../v1alpha1/repositories.yaml | 7 ++++ .../v1alpha1/snapshots.yaml | 7 ++++ .../resource-metadata/pkg/layouts/lib.go | 2 +- .../lib-helm/pkg/values/options.go | 6 +-- .../lib-helm/pkg/values/preset.go | 6 +-- vendor/modules.txt | 12 +++--- 24 files changed, 129 insertions(+), 84 deletions(-) diff --git a/go.mod b/go.mod index ccdfb9de5d..68efd29d55 100644 --- a/go.mod +++ b/go.mod @@ -50,13 +50,13 @@ require ( kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.30.2-0.20241001043315-b98120efea48 kmodules.xyz/offshoot-api v0.30.1 - kmodules.xyz/resource-metadata v0.18.16-0.20240929130110-f5f4e27aae5b + kmodules.xyz/resource-metadata v0.18.16 kmodules.xyz/resource-metrics v0.30.4 kmodules.xyz/resource-metrics/utils v0.30.4 kmodules.xyz/sets v0.29.0 kubeops.dev/falco-ui-server v0.0.4 kubeops.dev/scanner v0.0.18 - kubepack.dev/lib-helm v0.29.10 + kubepack.dev/lib-helm v0.29.11 sigs.k8s.io/cli-utils v0.37.2 sigs.k8s.io/controller-runtime v0.18.4 sigs.k8s.io/yaml v1.4.0 @@ -80,7 +80,7 @@ require ( github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/PuerkitoBio/purell v1.2.1 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect - github.com/alessio/shellescape v1.4.1 // indirect + github.com/alessio/shellescape v1.4.2 // indirect github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go v1.47.9 // indirect @@ -94,7 +94,7 @@ require ( github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/dapr/go-sdk v1.8.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/docker/cli v25.0.1+incompatible // indirect + github.com/docker/cli v26.1.3+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker v26.1.5+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.0 // indirect @@ -236,7 +236,7 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - helm.sh/helm/v3 v3.14.3 // indirect + helm.sh/helm/v3 v3.15.0 // indirect k8s.io/cli-runtime v0.30.1 // indirect k8s.io/component-helpers v0.29.0 // indirect k8s.io/kms v0.30.3 // indirect diff --git a/go.sum b/go.sum index fea2ab3f56..265febd144 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= -github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= +github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= +github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= @@ -118,8 +118,8 @@ github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkz github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= -github.com/docker/cli v25.0.1+incompatible h1:mFpqnrS6Hsm3v1k7Wa/BO23oz0k121MTbTO1lpcGSkU= -github.com/docker/cli v25.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v26.1.3+incompatible h1:bUpXT/N0kDE3VUHI2r5VMsYQgi38kYuoC0oL9yt3lqc= +github.com/docker/cli v26.1.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= @@ -885,8 +885,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -helm.sh/helm/v3 v3.14.3 h1:HmvRJlwyyt9HjgmAuxHbHv3PhMz9ir/XNWHyXfmnOP4= -helm.sh/helm/v3 v3.14.3/go.mod h1:v6myVbyseSBJTzhmeE39UcPLNv6cQK6qss3dvgAySaE= +helm.sh/helm/v3 v3.15.0 h1:gcLxHeFp0Hfo7lYi6KIZ84ZyvlAnfFRSJ8lTL3zvG5U= +helm.sh/helm/v3 v3.15.0/go.mod h1:fvfoRcB8UKRUV5jrIfOTaN/pG1TPhuqSb56fjYdTKXg= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -934,8 +934,8 @@ kmodules.xyz/monitoring-agent-api v0.30.2-0.20241001043315-b98120efea48 h1:kJdO7 kmodules.xyz/monitoring-agent-api v0.30.2-0.20241001043315-b98120efea48/go.mod h1:oR3tk5O4koYar4cD9N3AjbBFr9XTwBU3sw9qD2NdNQc= kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI= kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g= -kmodules.xyz/resource-metadata v0.18.16-0.20240929130110-f5f4e27aae5b h1:lnjpyQOfirCPMq5lgLJMUPnPqMRgHQLqHaZCkBk+dm8= -kmodules.xyz/resource-metadata v0.18.16-0.20240929130110-f5f4e27aae5b/go.mod h1:Q02Xh75qc9MB2rdeo1wbpBn4WCXwoDBxLtonxz57Dng= +kmodules.xyz/resource-metadata v0.18.16 h1:wQG8VgO/ySZcwp2eLe9xe5pI+IC1JJH7eDJnMZIC48Y= +kmodules.xyz/resource-metadata v0.18.16/go.mod h1:+oaGJj871hYXqUWDFgqf4Tc8Lz5F8rBco+Bq34DqLus= kmodules.xyz/resource-metrics v0.30.4 h1:8HBPtYmo9ETY91gsc55JE8Z986+3ZuRq57M0wZ9npqI= kmodules.xyz/resource-metrics v0.30.4/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ= kmodules.xyz/resource-metrics/utils v0.30.4 h1:bJS/x0Qr7N1FFdxugFbzZ/Es6HVs4ptsFlhkmgj3jac= @@ -946,8 +946,8 @@ kubeops.dev/falco-ui-server v0.0.4 h1:47kA+B4pJTgru3P60ng9eC+c3TP8Gcq61c91FB3ZoB kubeops.dev/falco-ui-server v0.0.4/go.mod h1:ApHVuTyGAqbuDK1dBiuP+5iuLv5vUZe10+5JOYRI0TU= kubeops.dev/scanner v0.0.18 h1:j00BXav9dFH3ucqoROjfbXTdpKWpy7tL3RynWxkLXU4= kubeops.dev/scanner v0.0.18/go.mod h1:uyhpFCDysphXUMIWytSyyv0LjY+49z2jfuC3rK0HFTA= -kubepack.dev/lib-helm v0.29.10 h1:DxqVpid7Ez+lp/jRHO6b1kqBEdAb+AdkYCGcsZVJd6A= -kubepack.dev/lib-helm v0.29.10/go.mod h1:vrVvhzbL/SNRuS5FTn53bnpLAWoNta31ETCeaOczAcM= +kubepack.dev/lib-helm v0.29.11 h1:5/vReFNh1fN1XP862Hc6rXEq6opJrtr6mNLEzxIiFqQ= +kubepack.dev/lib-helm v0.29.11/go.mod h1:XZnORjUeidNX08ws9FnLy1VyGYq4hhdGqE553QzKLIo= kubevault.dev/apimachinery v0.18.3 h1:Bq180AGBYnRXXNWbJ6Zg82+8/3M1Y8WYPez32uTry8I= kubevault.dev/apimachinery v0.18.3/go.mod h1:b9uUVFx3a3ThDziL2J2O4xQL+muY1/pGavAhDdJC99E= moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 h1:NykkTlRB+X40z86cLHdEmuoTxhNKhQebLT379b1EumA= diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 571ac553dd..631c864c40 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -329,7 +329,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { v1alpha1storage[rsapi.ResourceResourceLayouts] = resourcelayout.NewStorage(ctrlClient) v1alpha1storage[rsapi.ResourceResourceOutlines] = resourceoutline.NewStorage() v1alpha1storage[rsapi.ResourceClusterProfiles] = clusterprofilestorage.NewStorage() - v1alpha1storage[uiapi.ResourceResourceEditors] = resourceeditor.NewStorage() + v1alpha1storage[uiapi.ResourceResourceEditors] = resourceeditor.NewStorage(ctrlClient) v1alpha1storage[rsapi.ResourceResourceQueries] = resourcequery.NewStorage(ctrlClient, rbacAuthorizer) v1alpha1storage[rsapi.ResourceResourceTableDefinitions] = resourcetabledefinition.NewStorage() diff --git a/pkg/menu/gallery_menu.go b/pkg/menu/gallery_menu.go index 8b6cd15e8f..d0e87b1c31 100644 --- a/pkg/menu/gallery_menu.go +++ b/pkg/menu/gallery_menu.go @@ -83,16 +83,10 @@ func RenderGalleryMenu(kc client.Client, disco discovery.DiscoveryInterface, in mi.Missing = true } - ed, ok := resourceeditors.LoadByResourceID(kc, mi.Resource) - if !ok || ed.Spec.UI == nil || ed.Spec.UI.Options == nil || len(ed.Spec.Variants) == 0 { + ed, err := resourceeditors.LoadByResourceID(kc, mi.Resource) + if err != nil || ed.Spec.UI == nil || ed.Spec.UI.Options == nil || len(ed.Spec.Variants) == 0 { items = append(items, mi) - } else if mi.Resource != nil { - gvr := mi.Resource.GroupVersionResource() - ed, ok := resourceeditors.LoadByGVR(kc, gvr) - if !ok { - return nil, fmt.Errorf("ResourceEditor not defined for %+v", gvr) - } - + } else { chartRef := ed.Spec.UI.Options if chartRef.SourceRef.Namespace == "" { chartRef.SourceRef.Namespace = mu.PodNamespace() diff --git a/pkg/menu/lib.go b/pkg/menu/lib.go index 71ece3ddfa..47a7441c06 100644 --- a/pkg/menu/lib.go +++ b/pkg/menu/lib.go @@ -92,7 +92,7 @@ func GenerateMenuItems(kc client.Client, disco discovery.DiscoveryInterface) (ma // Icons: rd.Spec.Icons, // Installer: rd.Spec.Installer, } - if ed, ok := resourceeditors.LoadByGVR(kc, gvr); ok { + if ed, err := resourceeditors.LoadByGVR(kc, gvr); err == nil { me.Icons = ed.Spec.Icons me.Installer = ed.Spec.Installer diff --git a/pkg/menu/usermenu.go b/pkg/menu/usermenu.go index e131ccee4f..dc120022ac 100644 --- a/pkg/menu/usermenu.go +++ b/pkg/menu/usermenu.go @@ -103,7 +103,7 @@ func updateMenuItemVariantsInfo(kc client.Client, in []rsapi.MenuItem) []rsapi.M for _, item := range in { if item.Resource != nil { gvr := item.Resource.GroupVersionResource() - if ed, ok := resourceeditors.LoadByGVR(kc, gvr); ok { + if ed, err := resourceeditors.LoadByGVR(kc, gvr); err == nil { item.AvailableVariants = len(ed.Spec.Variants) if item.AvailableVariants == 1 { item.Variant = ed.Spec.Variants[0].Name diff --git a/pkg/registry/meta/resourceeditor/storage.go b/pkg/registry/meta/resourceeditor/storage.go index 71dd8fa731..14c3a69054 100644 --- a/pkg/registry/meta/resourceeditor/storage.go +++ b/pkg/registry/meta/resourceeditor/storage.go @@ -34,9 +34,11 @@ import ( rsapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1" uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" "kmodules.xyz/resource-metadata/hub/resourceeditors" + "sigs.k8s.io/controller-runtime/pkg/client" ) type Storage struct { + kc client.Client convertor rest.TableConvertor } @@ -49,8 +51,9 @@ var ( _ rest.SingularNameProvider = &Storage{} ) -func NewStorage() *Storage { +func NewStorage(kc client.Client) *Storage { return &Storage{ + kc: kc, convertor: rest.NewDefaultTableConvertor(schema.GroupResource{ Group: rsapi.SchemeGroupVersion.Group, Resource: uiapi.ResourceResourceEditors, @@ -78,7 +81,7 @@ func (r *Storage) New() runtime.Object { func (r *Storage) Destroy() {} func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { - obj, err := resourceeditors.LoadByName(name) + obj, err := resourceeditors.LoadByName(r.kc, name) if err != nil { return nil, kerr.NewNotFound(schema.GroupResource{Group: meta.GroupName, Resource: uiapi.ResourceKindResourceEditor}, name) } diff --git a/vendor/github.com/alessio/shellescape/.golangci.yml b/vendor/github.com/alessio/shellescape/.golangci.yml index cd4a17e442..836dabbba4 100644 --- a/vendor/github.com/alessio/shellescape/.golangci.yml +++ b/vendor/github.com/alessio/shellescape/.golangci.yml @@ -6,25 +6,20 @@ linters: disable-all: true enable: - bodyclose - - deadcode - - depguard - dogsled - goconst - gocritic - gofmt - goimports - - golint - gosec - gosimple - govet - ineffassign - - interfacer - - maligned - misspell - prealloc - - scopelint + - exportloopref + - revive - staticcheck - - structcheck - stylecheck - typecheck - unconvert diff --git a/vendor/github.com/alessio/shellescape/.goreleaser.yml b/vendor/github.com/alessio/shellescape/.goreleaser.yml index 064c9374d7..0915eb869b 100644 --- a/vendor/github.com/alessio/shellescape/.goreleaser.yml +++ b/vendor/github.com/alessio/shellescape/.goreleaser.yml @@ -9,18 +9,39 @@ before: builds: - env: - CGO_ENABLED=0 + - >- + {{- if eq .Os "darwin" }} + {{- if eq .Arch "amd64"}}CC=o64-clang{{- end }} + {{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }} + {{- end }} + {{- if eq .Os "windows" }} + {{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }} + {{- end }} main: ./cmd/escargs goos: - linux - windows - darwin -archives: - - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 + - freebsd + goarch: + - amd64 + - arm64 + - arm + goarm: + - 6 + - 7 + goamd64: + - v2 + - v3 + ignore: + - goos: darwin + goarch: 386 + - goos: linux + goarch: arm + goarm: 7 + - goarm: mips64 + - gomips: hardfloat + - goamd64: v4 checksum: name_template: 'checksums.txt' snapshot: diff --git a/vendor/github.com/docker/cli/cli/config/configfile/file.go b/vendor/github.com/docker/cli/cli/config/configfile/file.go index 442c31110b..ba9bc9d1d0 100644 --- a/vendor/github.com/docker/cli/cli/config/configfile/file.go +++ b/vendor/github.com/docker/cli/cli/config/configfile/file.go @@ -41,6 +41,7 @@ type ConfigFile struct { CLIPluginsExtraDirs []string `json:"cliPluginsExtraDirs,omitempty"` Plugins map[string]map[string]string `json:"plugins,omitempty"` Aliases map[string]string `json:"aliases,omitempty"` + Features map[string]string `json:"features,omitempty"` } // ProxyConfig contains proxy configuration settings diff --git a/vendor/helm.sh/helm/v3/internal/version/version.go b/vendor/helm.sh/helm/v3/internal/version/version.go index 414957bc9f..d20f258977 100644 --- a/vendor/helm.sh/helm/v3/internal/version/version.go +++ b/vendor/helm.sh/helm/v3/internal/version/version.go @@ -29,7 +29,7 @@ var ( // // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. - version = "v3.14" + version = "v3.15" // metadata is extra build time data metadata = "" diff --git a/vendor/helm.sh/helm/v3/pkg/chartutil/create.go b/vendor/helm.sh/helm/v3/pkg/chartutil/create.go index 0bb5a83cd7..50212f9d58 100644 --- a/vendor/helm.sh/helm/v3/pkg/chartutil/create.go +++ b/vendor/helm.sh/helm/v3/pkg/chartutil/create.go @@ -448,7 +448,7 @@ const defaultNotes = `1. Get the application URL by running these commands: echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include ".fullname" . }}' + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include ".fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} diff --git a/vendor/helm.sh/helm/v3/pkg/ignore/rules.go b/vendor/helm.sh/helm/v3/pkg/ignore/rules.go index a80923baf0..88de407ad8 100644 --- a/vendor/helm.sh/helm/v3/pkg/ignore/rules.go +++ b/vendor/helm.sh/helm/v3/pkg/ignore/rules.go @@ -173,7 +173,7 @@ func (r *Rules) parseRule(rule string) error { if strings.HasPrefix(rule, "/") { // Require path matches the root path. - p.match = func(n string, fi os.FileInfo) bool { + p.match = func(n string, _ os.FileInfo) bool { rule = strings.TrimPrefix(rule, "/") ok, err := filepath.Match(rule, n) if err != nil { @@ -184,7 +184,7 @@ func (r *Rules) parseRule(rule string) error { } } else if strings.Contains(rule, "/") { // require structural match. - p.match = func(n string, fi os.FileInfo) bool { + p.match = func(n string, _ os.FileInfo) bool { ok, err := filepath.Match(rule, n) if err != nil { log.Printf("Failed to compile %q: %s", rule, err) @@ -193,7 +193,7 @@ func (r *Rules) parseRule(rule string) error { return ok } } else { - p.match = func(n string, fi os.FileInfo) bool { + p.match = func(n string, _ os.FileInfo) bool { // When there is no slash in the pattern, we evaluate ONLY the // filename. n = filepath.Base(n) diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupconfigurations.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupconfigurations.yaml index 64cf6a39a9..fb43142461 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupconfigurations.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupconfigurations.yaml @@ -29,3 +29,10 @@ spec: name: appscode-charts-oci version: v0.6.0 enforceQuota: false + options: + name: corekubestashcom-backupconfiguration-editor-options + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: appscode-charts-oci + version: v0.6.0 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupsessions.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupsessions.yaml index fe9454ea3f..22b573aac1 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupsessions.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/core.kubestash.com/v1alpha1/backupsessions.yaml @@ -29,3 +29,10 @@ spec: name: appscode-charts-oci version: v0.6.0 enforceQuota: false + options: + name: corekubestashcom-backupsession-editor-options + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: appscode-charts-oci + version: v0.6.0 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/kubedb.com/v1/elasticsearches.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/kubedb.com/v1/elasticsearches.yaml index 56019ebaa8..d4bef8fe55 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/kubedb.com/v1/elasticsearches.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/kubedb.com/v1/elasticsearches.yaml @@ -84,7 +84,7 @@ spec: name: Operations - items: - disabledTemplate: | - {{ not (gt .spec.replicas 1) }} + {{ not (or (hasKey .spec "topology") (gt .spec.replicas 1) )}} editor: name: opskubedbcom-elasticsearchopsrequest-editor sourceRef: diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/lib.go b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/lib.go index 665e35530e..cb388909fe 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/lib.go +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/lib.go @@ -34,7 +34,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" ) @@ -95,7 +94,7 @@ func DefaultEditorName(gvr schema.GroupVersionResource) string { return fmt.Sprintf("%s-%s-%s", gvr.Group, gvr.Version, gvr.Resource) } -func LoadByName(name string) (*v1alpha1.ResourceEditor, error) { +func LoadInternalByName(name string) (*v1alpha1.ResourceEditor, error) { m.Lock() defer m.Unlock() loader.ReloadIfTriggered() @@ -106,26 +105,24 @@ func LoadByName(name string) (*v1alpha1.ResourceEditor, error) { return nil, apierrors.NewNotFound(v1alpha1.Resource(v1alpha1.ResourceKindResourceEditor), name) } -func LoadDefaultByGVR(gvr schema.GroupVersionResource) (*v1alpha1.ResourceEditor, bool) { - m.Lock() - defer m.Unlock() - loader.ReloadIfTriggered() - - name := DefaultEditorName(gvr) - obj, ok := reMap[name] - return obj, ok +func LoadInternalByGVR(gvr schema.GroupVersionResource) (*v1alpha1.ResourceEditor, error) { + return LoadInternalByName(DefaultEditorName(gvr)) } -func LoadByGVR(kc client.Client, gvr schema.GroupVersionResource) (*v1alpha1.ResourceEditor, bool) { +func LoadByName(kc client.Client, name string) (*v1alpha1.ResourceEditor, error) { var ed v1alpha1.ResourceEditor - err := kc.Get(context.TODO(), client.ObjectKey{Name: DefaultEditorName(gvr)}, &ed) - if err == nil { - d, _ := LoadDefaultByGVR(gvr) - return merge(&ed, d), true - } else if !meta.IsNoMatchError(err) && !apierrors.IsNotFound(err) { - klog.V(3).ErrorS(err, fmt.Sprintf("failed to load resource editor for %+v", gvr)) + err := kc.Get(context.TODO(), client.ObjectKey{Name: name}, &ed) + if meta.IsNoMatchError(err) || apierrors.IsNotFound(err) { + return LoadInternalByName(name) + } else if err != nil { + return nil, err } - return LoadDefaultByGVR(gvr) + d, _ := LoadInternalByName(name) + return merge(&ed, d), nil +} + +func LoadByGVR(kc client.Client, gvr schema.GroupVersionResource) (*v1alpha1.ResourceEditor, error) { + return LoadByName(kc, DefaultEditorName(gvr)) } func merge(in, d *v1alpha1.ResourceEditor) *v1alpha1.ResourceEditor { @@ -161,17 +158,16 @@ func merge(in, d *v1alpha1.ResourceEditor) *v1alpha1.ResourceEditor { return in } -func LoadByResourceID(kc client.Client, rid *kmapi.ResourceID) (*v1alpha1.ResourceEditor, bool) { +func LoadByResourceID(kc client.Client, rid *kmapi.ResourceID) (*v1alpha1.ResourceEditor, error) { if rid == nil { - return nil, false + return nil, errors.New("missing ResourceID") } gvr := rid.GroupVersionResource() if gvr.Version == "" || gvr.Resource == "" { id, err := kmapi.ExtractResourceID(kc.RESTMapper(), *rid) if err != nil { - klog.V(3).InfoS(fmt.Sprintf("failed to extract resource id for %+v", *rid)) - return nil, false + return nil, errors.Wrapf(err, "failed to extract resource id for %+v", *rid) } gvr = id.GroupVersionResource() } diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/backupstorages.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/backupstorages.yaml index b4b70d3765..776f21c8bc 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/backupstorages.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/backupstorages.yaml @@ -24,3 +24,10 @@ spec: name: appscode-charts-oci version: v0.6.0 enforceQuota: false + options: + name: storagekubestashcom-backupstorage-editor-options + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: appscode-charts-oci + version: v0.6.0 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/repositories.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/repositories.yaml index ba0a63215a..f8c93365b7 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/repositories.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/repositories.yaml @@ -29,3 +29,10 @@ spec: name: appscode-charts-oci version: v0.6.0 enforceQuota: false + options: + name: storagekubestashcom-repository-editor-options + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: appscode-charts-oci + version: v0.6.0 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/snapshots.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/snapshots.yaml index f7fa25f726..992f30f671 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/snapshots.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourceeditors/storage.kubestash.com/v1alpha1/snapshots.yaml @@ -24,3 +24,10 @@ spec: name: appscode-charts-oci version: v0.6.0 enforceQuota: false + options: + name: storagekubestashcom-snapshot-editor-options + sourceRef: + apiGroup: source.toolkit.fluxcd.io + kind: HelmRepository + name: appscode-charts-oci + version: v0.6.0 diff --git a/vendor/kmodules.xyz/resource-metadata/pkg/layouts/lib.go b/vendor/kmodules.xyz/resource-metadata/pkg/layouts/lib.go index b27f39f210..74b2b205f6 100644 --- a/vendor/kmodules.xyz/resource-metadata/pkg/layouts/lib.go +++ b/vendor/kmodules.xyz/resource-metadata/pkg/layouts/lib.go @@ -172,7 +172,7 @@ func GetResourceLayout(kc client.Client, outline *v1alpha1.ResourceOutline) (*v1 result.ObjectMeta = outline.ObjectMeta result.Spec.DefaultLayout = outline.Spec.DefaultLayout result.Spec.Resource = outline.Spec.Resource - if ed, ok := resourceeditors.LoadByGVR(kc, outline.Spec.Resource.GroupVersionResource()); ok { + if ed, err := resourceeditors.LoadByGVR(kc, outline.Spec.Resource.GroupVersionResource()); err == nil { if ed.Spec.UI != nil { result.Spec.UI = &shared.UIParameterTemplate{ InstanceLabelPaths: ed.Spec.UI.InstanceLabelPaths, diff --git a/vendor/kubepack.dev/lib-helm/pkg/values/options.go b/vendor/kubepack.dev/lib-helm/pkg/values/options.go index 1db354975f..3d936c34b5 100644 --- a/vendor/kubepack.dev/lib-helm/pkg/values/options.go +++ b/vendor/kubepack.dev/lib-helm/pkg/values/options.go @@ -103,7 +103,7 @@ func (opts *Options) MergeValues(chrt *chart.Chart) (map[string]interface{}, err return nil, errors.Wrapf(err, "failed to parse %s", bytes) } // Merge with the previous map - base = mergeMaps(base, currentMap) + base = MergeMaps(base, currentMap) } // User specified a value via --set @@ -130,7 +130,7 @@ func (opts *Options) MergeValues(chrt *chart.Chart) (map[string]interface{}, err return base, nil } -func mergeMaps(a, b map[string]interface{}) map[string]interface{} { +func MergeMaps(a, b map[string]interface{}) map[string]interface{} { out := make(map[string]interface{}, len(a)) for k, v := range a { out[k] = v @@ -139,7 +139,7 @@ func mergeMaps(a, b map[string]interface{}) map[string]interface{} { if v, ok := v.(map[string]interface{}); ok { if bv, ok := out[k]; ok { if bv, ok := bv.(map[string]interface{}); ok { - out[k] = mergeMaps(bv, v) + out[k] = MergeMaps(bv, v) continue } } diff --git a/vendor/kubepack.dev/lib-helm/pkg/values/preset.go b/vendor/kubepack.dev/lib-helm/pkg/values/preset.go index 1f1b1948d2..4a77245f33 100644 --- a/vendor/kubepack.dev/lib-helm/pkg/values/preset.go +++ b/vendor/kubepack.dev/lib-helm/pkg/values/preset.go @@ -31,9 +31,9 @@ func LoadPresetValues(kc client.Client, ref chartsapi.ChartPresetFlatRef) ([]cha if err != nil { return nil, errors.Wrapf(err, "failed to detect resource ID for %#v", *rid) } - ed, ok := resourceeditors.LoadByGVR(kc, rid.GroupVersionResource()) - if !ok { - return nil, errors.Errorf("failed to detect ResourceEditor for %#v", rid.GroupVersionResource()) + ed, err := resourceeditors.LoadByGVR(kc, rid.GroupVersionResource()) + if err != nil { + return nil, err } var variant *uiapi.VariantRef diff --git a/vendor/modules.txt b/vendor/modules.txt index ae9314bcfa..eb2741275c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -68,7 +68,7 @@ github.com/PuerkitoBio/purell # github.com/agnivade/levenshtein v1.1.1 ## explicit; go 1.13 github.com/agnivade/levenshtein -# github.com/alessio/shellescape v1.4.1 +# github.com/alessio/shellescape v1.4.2 ## explicit; go 1.14 github.com/alessio/shellescape # github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df @@ -161,7 +161,7 @@ github.com/dapr/go-sdk/version # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/docker/cli v25.0.1+incompatible +# github.com/docker/cli v26.1.3+incompatible ## explicit github.com/docker/cli/cli/config github.com/docker/cli/cli/config/configfile @@ -1283,8 +1283,8 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# helm.sh/helm/v3 v3.14.3 -## explicit; go 1.21 +# helm.sh/helm/v3 v3.15.0 +## explicit; go 1.22.0 helm.sh/helm/v3/internal/sympath helm.sh/helm/v3/internal/version helm.sh/helm/v3/pkg/chart @@ -2041,7 +2041,7 @@ kmodules.xyz/monitoring-agent-api/client ## explicit; go 1.22.0 kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v2 -# kmodules.xyz/resource-metadata v0.18.16-0.20240929130110-f5f4e27aae5b +# kmodules.xyz/resource-metadata v0.18.16 ## explicit; go 1.22.1 kmodules.xyz/resource-metadata/apis/core/install kmodules.xyz/resource-metadata/apis/core/v1alpha1 @@ -2103,7 +2103,7 @@ kubeops.dev/scanner/apis/scanner kubeops.dev/scanner/apis/scanner/v1alpha1 kubeops.dev/scanner/apis/trivy kubeops.dev/scanner/client/clientset/versioned/scheme -# kubepack.dev/lib-helm v0.29.10 +# kubepack.dev/lib-helm v0.29.11 ## explicit; go 1.22.1 kubepack.dev/lib-helm/pkg/values # kubevault.dev/apimachinery v0.18.3