From e901c522efc8a1660748993c924ab3929cfe8e28 Mon Sep 17 00:00:00 2001 From: lgtm <1gtm@users.noreply.github.com> Date: Thu, 25 May 2023 03:20:38 -0700 Subject: [PATCH] Update for release ByteBuilders@v2023.05.25 (#38) ProductLine: ByteBuilders Release: v2023.05.25 Signed-off-by: 1gtm <1gtm@appscode.com> --- go.mod | 6 +- go.sum | 13 +- .../gomodules.xyz/jsonpatch/v2/jsonpatch.go | 160 ++++-------------- vendor/kmodules.xyz/client-go/Makefile | 20 ++- .../kmodules.xyz/client-go/api/v1/object.go | 30 +--- .../client-go/api/v1/object_enum.go | 145 ++++++++++++++++ .../resource-metadata/hub/edges.go | 45 ----- vendor/modules.txt | 8 +- 8 files changed, 218 insertions(+), 209 deletions(-) create mode 100644 vendor/kmodules.xyz/client-go/api/v1/object_enum.go delete mode 100644 vendor/kmodules.xyz/resource-metadata/hub/edges.go diff --git a/go.mod b/go.mod index dea98e1e..f9b78d62 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,8 @@ require ( k8s.io/apimachinery v0.25.3 k8s.io/client-go v0.25.3 k8s.io/klog/v2 v2.80.1 - kmodules.xyz/client-go v0.25.22 - kmodules.xyz/resource-metadata v0.17.3 + kmodules.xyz/client-go v0.25.23 + kmodules.xyz/resource-metadata v0.17.4 sigs.k8s.io/controller-runtime v0.13.1 ) @@ -79,7 +79,7 @@ require ( gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect gomodules.xyz/encoding v0.0.7 // indirect gomodules.xyz/flags v0.1.3 // indirect - gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect gomodules.xyz/jsonpath v0.0.2 // indirect gomodules.xyz/mergo v0.3.13 // indirect gomodules.xyz/sets v0.2.1 // indirect diff --git a/go.sum b/go.sum index f024e5ea..7bd08452 100644 --- a/go.sum +++ b/go.sum @@ -89,7 +89,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF 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/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= @@ -616,8 +615,8 @@ gomodules.xyz/encoding v0.0.7 h1:Y4PaflVS+vkYgkw6FwyF1S0ab4Y1BAdOqB3Uwjcx8qI= gomodules.xyz/encoding v0.0.7/go.mod h1:blYJWy456Bzxj3L2G7G5WV1l5rFXl6uYXrmeFqxxqk8= gomodules.xyz/flags v0.1.3 h1:jQ06+EfmoMv5NvjXvJon03dOhLU+FF0TQMWN7I6qpzs= gomodules.xyz/flags v0.1.3/go.mod h1:e+kvBLnqdEWGG670SKOYag1CXStM2Slrxq01OIK3tFs= -gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= -gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= +gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc= +gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= gomodules.xyz/jsonpath v0.0.2 h1:taUvqxKQ9KqVl3vq/+hLg7rCZUIQjq+izhbvo6nTIkE= gomodules.xyz/jsonpath v0.0.2/go.mod h1:du28vmLHrgEV48JqK/7rn92YHsVDoQuqrowb2w6YZmE= gomodules.xyz/logs v0.0.6 h1:8+9Wkud5yBPtIvkVszubyTeFxNII30lWODom0+GZD8U= @@ -758,10 +757,10 @@ k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsM k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.25.22 h1:gtRyVl5Ar87zzKj4g7Nx+0QSeWq9yTKADoasZP+brZg= -kmodules.xyz/client-go v0.25.22/go.mod h1:KWVpgjAj/VNzCzj/BihpJkY39aWIqe8qMp5RuPsuSJA= -kmodules.xyz/resource-metadata v0.17.3 h1:AdJBaMmXT4l8YR91l3kKz3911f3RkAkrjQudbzRrE6g= -kmodules.xyz/resource-metadata v0.17.3/go.mod h1:w1Mdovr5Jo0Tuyum2yAH4UAvmsz7d7w30WC5ED4IKOE= +kmodules.xyz/client-go v0.25.23 h1:qz5XJYHLVZUowqfRXEJD7JQ4iaLLzQ1O1zPMmsdrkJw= +kmodules.xyz/client-go v0.25.23/go.mod h1:wbdzLEoDYiCPI6dTW0mIAGNwkwFV4lC5BN1FJxiDsbw= +kmodules.xyz/resource-metadata v0.17.4 h1:zLc4q9+5pvI7jJdc3mG+MpuBlIijym9nHuuwgrSs4V0= +kmodules.xyz/resource-metadata v0.17.4/go.mod h1:gUy7cQ7QvB/SQ3upgsmS4BVxm5NLbJEXBI7M2CLSymA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go b/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go index 0ffb3156..a411d542 100644 --- a/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go +++ b/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go @@ -1,7 +1,6 @@ package jsonpatch import ( - "bytes" "encoding/json" "fmt" "reflect" @@ -24,21 +23,28 @@ func (j *Operation) Json() string { } func (j *Operation) MarshalJSON() ([]byte, error) { - var b bytes.Buffer - b.WriteString("{") - b.WriteString(fmt.Sprintf(`"op":"%s"`, j.Operation)) - b.WriteString(fmt.Sprintf(`,"path":"%s"`, j.Path)) - // Consider omitting Value for non-nullable operations. - if j.Value != nil || j.Operation == "replace" || j.Operation == "add" { - v, err := json.Marshal(j.Value) - if err != nil { - return nil, err - } - b.WriteString(`,"value":`) - b.Write(v) - } - b.WriteString("}") - return b.Bytes(), nil + // Ensure for add and replace we emit `value: null` + if j.Value == nil && (j.Operation == "replace" || j.Operation == "add") { + return json.Marshal(struct { + Operation string `json:"op"` + Path string `json:"path"` + Value interface{} `json:"value"` + }{ + Operation: j.Operation, + Path: j.Path, + }) + } + // otherwise just marshal normally. We cannot literally do json.Marshal(j) as it would be recursively + // calling this function. + return json.Marshal(struct { + Operation string `json:"op"` + Path string `json:"path"` + Value interface{} `json:"value,omitempty"` + }{ + Operation: j.Operation, + Path: j.Path, + Value: j.Value, + }) } type ByPath []Operation @@ -149,9 +155,6 @@ func makePath(path string, newPart interface{}) string { if path == "" { return "/" + key } - if strings.HasSuffix(path, "/") { - return path + key - } return path + "/" + key } @@ -211,22 +214,18 @@ func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation, } case []interface{}: bt := bv.([]interface{}) - if isSimpleArray(at) && isSimpleArray(bt) { - patch = append(patch, compareEditDistance(at, bt, p)...) - } else { - n := min(len(at), len(bt)) - for i := len(at) - 1; i >= n; i-- { - patch = append(patch, NewOperation("remove", makePath(p, i), nil)) - } - for i := n; i < len(bt); i++ { - patch = append(patch, NewOperation("add", makePath(p, i), bt[i])) - } - for i := 0; i < n; i++ { - var err error - patch, err = handleValues(at[i], bt[i], makePath(p, i), patch) - if err != nil { - return nil, err - } + n := min(len(at), len(bt)) + for i := len(at) - 1; i >= n; i-- { + patch = append(patch, NewOperation("remove", makePath(p, i), nil)) + } + for i := n; i < len(bt); i++ { + patch = append(patch, NewOperation("add", makePath(p, i), bt[i])) + } + for i := 0; i < n; i++ { + var err error + patch, err = handleValues(at[i], bt[i], makePath(p, i), patch) + if err != nil { + return nil, err } } default: @@ -235,100 +234,9 @@ func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation, return patch, nil } -func isBasicType(a interface{}) bool { - switch a.(type) { - case string, float64, bool: - default: - return false - } - return true -} - -func isSimpleArray(a []interface{}) bool { - for i := range a { - switch a[i].(type) { - case string, float64, bool: - default: - val := reflect.ValueOf(a[i]) - if val.Kind() == reflect.Map { - for _, k := range val.MapKeys() { - av := val.MapIndex(k) - if av.Kind() == reflect.Ptr || av.Kind() == reflect.Interface { - if av.IsNil() { - continue - } - av = av.Elem() - } - if av.Kind() != reflect.String && av.Kind() != reflect.Float64 && av.Kind() != reflect.Bool { - return false - } - } - return true - } - return false - } - } - return true -} - -// https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm -// Adapted from https://github.com/texttheater/golang-levenshtein -func compareEditDistance(s, t []interface{}, p string) []Operation { - m := len(s) - n := len(t) - - d := make([][]int, m+1) - for i := 0; i <= m; i++ { - d[i] = make([]int, n+1) - d[i][0] = i - } - for j := 0; j <= n; j++ { - d[0][j] = j - } - - for j := 1; j <= n; j++ { - for i := 1; i <= m; i++ { - if reflect.DeepEqual(s[i-1], t[j-1]) { - d[i][j] = d[i-1][j-1] // no op required - } else { - del := d[i-1][j] + 1 - add := d[i][j-1] + 1 - rep := d[i-1][j-1] + 1 - d[i][j] = min(rep, min(add, del)) - } - } - } - - return backtrace(s, t, p, m, n, d) -} - func min(x int, y int) int { if y < x { return y } return x } - -func backtrace(s, t []interface{}, p string, i int, j int, matrix [][]int) []Operation { - if i > 0 && matrix[i-1][j]+1 == matrix[i][j] { - op := NewOperation("remove", makePath(p, i-1), nil) - return append([]Operation{op}, backtrace(s, t, p, i-1, j, matrix)...) - } - if j > 0 && matrix[i][j-1]+1 == matrix[i][j] { - op := NewOperation("add", makePath(p, i), t[j-1]) - return append([]Operation{op}, backtrace(s, t, p, i, j-1, matrix)...) - } - if i > 0 && j > 0 && matrix[i-1][j-1]+1 == matrix[i][j] { - if isBasicType(s[0]) { - op := NewOperation("replace", makePath(p, i-1), t[j-1]) - return append([]Operation{op}, backtrace(s, t, p, i-1, j-1, matrix)...) - } - - p2, _ := handleValues(s[i-1], t[j-1], makePath(p, i-1), []Operation{}) - return append(p2, backtrace(s, t, p, i-1, j-1, matrix)...) - } - if i > 0 && j > 0 && matrix[i-1][j-1] == matrix[i][j] { - return backtrace(s, t, p, i-1, j-1, matrix) - } - return []Operation{} -} diff --git a/vendor/kmodules.xyz/client-go/Makefile b/vendor/kmodules.xyz/client-go/Makefile index 160375bc..441dd38e 100644 --- a/vendor/kmodules.xyz/client-go/Makefile +++ b/vendor/kmodules.xyz/client-go/Makefile @@ -153,8 +153,26 @@ gen-crd-protos: --apimachinery-packages=-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/apimachinery/pkg/apis/meta/v1beta1,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/util/intstr \ --packages=-k8s.io/api/core/v1,kmodules.xyz/client-go/api/v1 +.PHONY: gen-enum +gen-enum: + @docker run \ + -i \ + --rm \ + -u $$(id -u):$$(id -g) \ + -v $$(pwd):/src \ + -w /src \ + -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin \ + -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH) \ + -v $$(pwd)/.go/cache:/.cache \ + --env HTTP_PROXY=$(HTTP_PROXY) \ + --env HTTPS_PROXY=$(HTTPS_PROXY) \ + $(BUILD_IMAGE) \ + /bin/bash -c " \ + go generate ./api/... \ + " + .PHONY: gen -gen: clientset openapi gen-crd-protos +gen: clientset gen-enum openapi gen-crd-protos fmt: $(BUILD_DIRS) @docker run \ diff --git a/vendor/kmodules.xyz/client-go/api/v1/object.go b/vendor/kmodules.xyz/client-go/api/v1/object.go index d7983414..eed83c3f 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/object.go +++ b/vendor/kmodules.xyz/client-go/api/v1/object.go @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +//go:generate go-enum --mustparse --names --values package v1 import ( @@ -207,30 +208,13 @@ type ObjectInfo struct { Ref ObjectReference `json:"ref" protobuf:"bytes,2,opt,name=ref"` } -// +kubebuilder:validation:Enum=id;config;backup_via;catalog;connect_via;exposed_by;monitored_by;offshoot;restore_into;scaled_by;view;cert_issuer;policy;recommended_for;ops +// +kubebuilder:validation:Enum=backup_via;catalog;cert_issuer;config;connect_via;exposed_by;id;located_on;monitored_by;offshoot;ops;policy;recommended_for;restore_into;scaled_by;view +// ENUM(backup_via,catalog,cert_issuer,config,connect_via,exposed_by,id,located_on,monitored_by,offshoot,ops,policy,recommended_for,restore_into,scaled_by,view) type EdgeLabel string -const ( - EdgeId EdgeLabel = "id" - EdgeConfig EdgeLabel = "config" - EdgeBackupVia EdgeLabel = "backup_via" - EdgeCatalog EdgeLabel = "catalog" - EdgeConnectVia EdgeLabel = "connect_via" - EdgeExposedBy EdgeLabel = "exposed_by" - EdgeMonitoredBy EdgeLabel = "monitored_by" - EdgeOffshoot EdgeLabel = "offshoot" - EdgeRestoreInto EdgeLabel = "restore_into" - EdgeScaledBy EdgeLabel = "scaled_by" - EdgeView EdgeLabel = "view" - EdgeCertIssuer EdgeLabel = "cert_issuer" - EdgePolicy EdgeLabel = "policy" - EdgeOps EdgeLabel = "ops" - EdgeRecommendedFor EdgeLabel = "recommended_for" -) - func (e EdgeLabel) Direct() bool { - return e == EdgeOffshoot || - e == EdgeView || - e == EdgeOps || - e == EdgeRecommendedFor + return e == EdgeLabelOffshoot || + e == EdgeLabelView || + e == EdgeLabelOps || + e == EdgeLabelRecommendedFor } diff --git a/vendor/kmodules.xyz/client-go/api/v1/object_enum.go b/vendor/kmodules.xyz/client-go/api/v1/object_enum.go new file mode 100644 index 00000000..2309b52c --- /dev/null +++ b/vendor/kmodules.xyz/client-go/api/v1/object_enum.go @@ -0,0 +1,145 @@ +// Code generated by go-enum DO NOT EDIT. +// Version: +// Revision: +// Build Date: +// Built By: + +package v1 + +import ( + "fmt" + strings "strings" +) + +const ( + // EdgeLabelBackupVia is a EdgeLabel of type backup_via. + EdgeLabelBackupVia EdgeLabel = "backup_via" + // EdgeLabelCatalog is a EdgeLabel of type catalog. + EdgeLabelCatalog EdgeLabel = "catalog" + // EdgeLabelCertIssuer is a EdgeLabel of type cert_issuer. + EdgeLabelCertIssuer EdgeLabel = "cert_issuer" + // EdgeLabelConfig is a EdgeLabel of type config. + EdgeLabelConfig EdgeLabel = "config" + // EdgeLabelConnectVia is a EdgeLabel of type connect_via. + EdgeLabelConnectVia EdgeLabel = "connect_via" + // EdgeLabelExposedBy is a EdgeLabel of type exposed_by. + EdgeLabelExposedBy EdgeLabel = "exposed_by" + // EdgeLabelId is a EdgeLabel of type id. + EdgeLabelId EdgeLabel = "id" + // EdgeLabelLocatedOn is a EdgeLabel of type located_on. + EdgeLabelLocatedOn EdgeLabel = "located_on" + // EdgeLabelMonitoredBy is a EdgeLabel of type monitored_by. + EdgeLabelMonitoredBy EdgeLabel = "monitored_by" + // EdgeLabelOffshoot is a EdgeLabel of type offshoot. + EdgeLabelOffshoot EdgeLabel = "offshoot" + // EdgeLabelOps is a EdgeLabel of type ops. + EdgeLabelOps EdgeLabel = "ops" + // EdgeLabelPolicy is a EdgeLabel of type policy. + EdgeLabelPolicy EdgeLabel = "policy" + // EdgeLabelRecommendedFor is a EdgeLabel of type recommended_for. + EdgeLabelRecommendedFor EdgeLabel = "recommended_for" + // EdgeLabelRestoreInto is a EdgeLabel of type restore_into. + EdgeLabelRestoreInto EdgeLabel = "restore_into" + // EdgeLabelScaledBy is a EdgeLabel of type scaled_by. + EdgeLabelScaledBy EdgeLabel = "scaled_by" + // EdgeLabelView is a EdgeLabel of type view. + EdgeLabelView EdgeLabel = "view" +) + +var ErrInvalidEdgeLabel = fmt.Errorf("not a valid EdgeLabel, try [%s]", strings.Join(_EdgeLabelNames, ", ")) + +var _EdgeLabelNames = []string{ + string(EdgeLabelBackupVia), + string(EdgeLabelCatalog), + string(EdgeLabelCertIssuer), + string(EdgeLabelConfig), + string(EdgeLabelConnectVia), + string(EdgeLabelExposedBy), + string(EdgeLabelId), + string(EdgeLabelLocatedOn), + string(EdgeLabelMonitoredBy), + string(EdgeLabelOffshoot), + string(EdgeLabelOps), + string(EdgeLabelPolicy), + string(EdgeLabelRecommendedFor), + string(EdgeLabelRestoreInto), + string(EdgeLabelScaledBy), + string(EdgeLabelView), +} + +// EdgeLabelNames returns a list of possible string values of EdgeLabel. +func EdgeLabelNames() []string { + tmp := make([]string, len(_EdgeLabelNames)) + copy(tmp, _EdgeLabelNames) + return tmp +} + +// EdgeLabelValues returns a list of the values for EdgeLabel +func EdgeLabelValues() []EdgeLabel { + return []EdgeLabel{ + EdgeLabelBackupVia, + EdgeLabelCatalog, + EdgeLabelCertIssuer, + EdgeLabelConfig, + EdgeLabelConnectVia, + EdgeLabelExposedBy, + EdgeLabelId, + EdgeLabelLocatedOn, + EdgeLabelMonitoredBy, + EdgeLabelOffshoot, + EdgeLabelOps, + EdgeLabelPolicy, + EdgeLabelRecommendedFor, + EdgeLabelRestoreInto, + EdgeLabelScaledBy, + EdgeLabelView, + } +} + +// String implements the Stringer interface. +func (x EdgeLabel) String() string { + return string(x) +} + +// IsValid provides a quick way to determine if the typed value is +// part of the allowed enumerated values +func (x EdgeLabel) IsValid() bool { + _, err := ParseEdgeLabel(string(x)) + return err == nil +} + +var _EdgeLabelValue = map[string]EdgeLabel{ + "backup_via": EdgeLabelBackupVia, + "catalog": EdgeLabelCatalog, + "cert_issuer": EdgeLabelCertIssuer, + "config": EdgeLabelConfig, + "connect_via": EdgeLabelConnectVia, + "exposed_by": EdgeLabelExposedBy, + "id": EdgeLabelId, + "located_on": EdgeLabelLocatedOn, + "monitored_by": EdgeLabelMonitoredBy, + "offshoot": EdgeLabelOffshoot, + "ops": EdgeLabelOps, + "policy": EdgeLabelPolicy, + "recommended_for": EdgeLabelRecommendedFor, + "restore_into": EdgeLabelRestoreInto, + "scaled_by": EdgeLabelScaledBy, + "view": EdgeLabelView, +} + +// ParseEdgeLabel attempts to convert a string to a EdgeLabel. +func ParseEdgeLabel(name string) (EdgeLabel, error) { + if x, ok := _EdgeLabelValue[name]; ok { + return x, nil + } + return EdgeLabel(""), fmt.Errorf("%s is %w", name, ErrInvalidEdgeLabel) +} + +// MustParseEdgeLabel converts a string to a EdgeLabel, and panics if is not valid. +func MustParseEdgeLabel(name string) EdgeLabel { + val, err := ParseEdgeLabel(name) + if err != nil { + panic(err) + } + return val +} diff --git a/vendor/kmodules.xyz/resource-metadata/hub/edges.go b/vendor/kmodules.xyz/resource-metadata/hub/edges.go deleted file mode 100644 index 04763cbe..00000000 --- a/vendor/kmodules.xyz/resource-metadata/hub/edges.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright AppsCode Inc. and Contributors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package hub - -import ( - kmapi "kmodules.xyz/client-go/api/v1" - "kmodules.xyz/resource-metadata/apis/meta/v1alpha1" - - "k8s.io/apimachinery/pkg/util/sets" -) - -func ListEdgeLabels(skipLabels ...kmapi.EdgeLabel) []kmapi.EdgeLabel { - labels := sets.NewString() - reg := NewRegistryOfKnownResources() - reg.Visit(func(key string, rd *v1alpha1.ResourceDescriptor) { - for _, c := range rd.Spec.Connections { - for _, lbl := range c.Labels { - labels.Insert(string(lbl)) - } - } - }) - for _, skipLabel := range skipLabels { - labels.Delete(string(skipLabel)) - } - - result := make([]kmapi.EdgeLabel, 0, len(labels)) - for lbl := range labels { - result = append(result, kmapi.EdgeLabel(lbl)) - } - return result -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 5c3f36ad..cd7e7215 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -235,8 +235,8 @@ gomodules.xyz/encoding/json # gomodules.xyz/flags v0.1.3 ## explicit; go 1.16 gomodules.xyz/flags -# gomodules.xyz/jsonpatch/v2 v2.2.0 -## explicit; go 1.12 +# gomodules.xyz/jsonpatch/v2 v2.3.0 +## explicit; go 1.20 gomodules.xyz/jsonpatch/v2 # gomodules.xyz/jsonpath v0.0.2 ## explicit; go 1.16 @@ -582,7 +582,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.25.22 +# kmodules.xyz/client-go v0.25.23 ## explicit; go 1.18 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1 @@ -591,7 +591,7 @@ kmodules.xyz/client-go/apiextensions/v1 kmodules.xyz/client-go/discovery kmodules.xyz/client-go/meta kmodules.xyz/client-go/tools/parser -# kmodules.xyz/resource-metadata v0.17.3 +# kmodules.xyz/resource-metadata v0.17.4 ## explicit; go 1.18 kmodules.xyz/resource-metadata/apis/meta kmodules.xyz/resource-metadata/apis/meta/v1alpha1