From 310f4e20dcd3fd757d8b310f21710f21433363eb Mon Sep 17 00:00:00 2001 From: Arnob kumar saha Date: Tue, 27 Feb 2024 17:24:48 +0600 Subject: [PATCH] Update client-go deps Signed-off-by: Arnob kumar saha --- go.mod | 2 +- go.sum | 4 +- .../kmodules.xyz/client-go/api/v1/cluster.go | 17 +++- .../client-go/api/v1/cluster_enum.go | 84 +++++++++++++++++++ .../client-go/core/v1/kubernetes.go | 18 +++- vendor/modules.txt | 2 +- 6 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 vendor/kmodules.xyz/client-go/api/v1/cluster_enum.go diff --git a/go.mod b/go.mod index 64204c9e66..7af40533f3 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( k8s.io/kube-aggregator v0.29.0 k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a k8s.io/metrics v0.25.1 - kmodules.xyz/client-go v0.29.9 + kmodules.xyz/client-go v0.29.11 kmodules.xyz/crd-schema-fuzz v0.29.1 kmodules.xyz/custom-resources v0.29.1 kmodules.xyz/monitoring-agent-api v0.29.0 diff --git a/go.sum b/go.sum index 1300afe156..cb844c0d4c 100644 --- a/go.sum +++ b/go.sum @@ -653,8 +653,8 @@ k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6R k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= 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.29.9 h1:nZcKM4YzmHAAQ62EYLep1NQdhARA9uOnYOiHMRf2VVg= -kmodules.xyz/client-go v0.29.9/go.mod h1:WYM/ZC3I5/AUGHYyYYEzYHFhnSwK+tEZyGld6KpLoxI= +kmodules.xyz/client-go v0.29.11 h1:bODrLulo39rq2My0FMy4lT+x0oJ+j7EW2HUvkFC5Gr8= +kmodules.xyz/client-go v0.29.11/go.mod h1:WYM/ZC3I5/AUGHYyYYEzYHFhnSwK+tEZyGld6KpLoxI= kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs= kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= kmodules.xyz/custom-resources v0.29.1 h1:xiNylhs3ILRbcUhxxy306AOy9GMA4Mq7xFIptZKgal4= diff --git a/vendor/kmodules.xyz/client-go/api/v1/cluster.go b/vendor/kmodules.xyz/client-go/api/v1/cluster.go index 77c999d645..046ba4855a 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/cluster.go +++ b/vendor/kmodules.xyz/client-go/api/v1/cluster.go @@ -49,15 +49,28 @@ type ClusterMetadata struct { Provider HostingProvider `json:"provider,omitempty" protobuf:"bytes,4,opt,name=provider,casttype=HostingProvider"` } +/* +ENUM( + + ACE = 1 + OCMHub = 2 + OCMMulticlusterControlplane = 4 + OCMSpoke = 8 + OpenShift = 16 + Rancher = 32 + VirtualCluster = 64 + +) +*/ type ClusterManager int const ( ClusterManagerACE ClusterManager = 1 << iota ClusterManagerOCMHub - ClusterManagerOCMSpoke ClusterManagerOCMMulticlusterControlplane - ClusterManagerRancher + ClusterManagerOCMSpoke ClusterManagerOpenShift + ClusterManagerRancher ClusterManagerVirtualCluster ) diff --git a/vendor/kmodules.xyz/client-go/api/v1/cluster_enum.go b/vendor/kmodules.xyz/client-go/api/v1/cluster_enum.go new file mode 100644 index 0000000000..7f84b9027e --- /dev/null +++ b/vendor/kmodules.xyz/client-go/api/v1/cluster_enum.go @@ -0,0 +1,84 @@ +/* +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 v1 + +import ( + "fmt" + "strings" +) + +var ErrInvalidClusterManager = fmt.Errorf("not a valid ClusterManager, try [%s]", strings.Join(_ClusterManagerNames, ", ")) + +const _ClusterManagerName = "ACEOCMHubOCMMulticlusterControlplaneOCMSpokeOpenShiftRancherVirtualCluster" + +var _ClusterManagerNames = []string{ + _ClusterManagerName[0:3], + _ClusterManagerName[3:9], + _ClusterManagerName[9:36], + _ClusterManagerName[36:44], + _ClusterManagerName[44:53], + _ClusterManagerName[53:60], + _ClusterManagerName[60:74], +} + +// ClusterManagerNames returns a list of possible string values of ClusterManager. +func ClusterManagerNames() []string { + tmp := make([]string, len(_ClusterManagerNames)) + copy(tmp, _ClusterManagerNames) + return tmp +} + +// ClusterManagerValues returns a list of the values for ClusterManager +func ClusterManagerValues() []ClusterManager { + return []ClusterManager{ + ClusterManagerACE, + ClusterManagerOCMHub, + ClusterManagerOCMMulticlusterControlplane, + ClusterManagerOCMSpoke, + ClusterManagerOpenShift, + ClusterManagerRancher, + ClusterManagerVirtualCluster, + } +} + +var _ClusterManagerMap = map[ClusterManager]string{ + ClusterManagerACE: _ClusterManagerName[0:3], + ClusterManagerOCMHub: _ClusterManagerName[3:9], + ClusterManagerOCMMulticlusterControlplane: _ClusterManagerName[9:36], + ClusterManagerOCMSpoke: _ClusterManagerName[36:44], + ClusterManagerOpenShift: _ClusterManagerName[44:53], + ClusterManagerRancher: _ClusterManagerName[53:60], + ClusterManagerVirtualCluster: _ClusterManagerName[60:74], +} + +var _ClusterManagerValue = map[string]ClusterManager{ + _ClusterManagerName[0:3]: ClusterManagerACE, + _ClusterManagerName[3:9]: ClusterManagerOCMHub, + _ClusterManagerName[9:36]: ClusterManagerOCMMulticlusterControlplane, + _ClusterManagerName[36:44]: ClusterManagerOCMSpoke, + _ClusterManagerName[44:53]: ClusterManagerOpenShift, + _ClusterManagerName[53:60]: ClusterManagerRancher, + _ClusterManagerName[60:74]: ClusterManagerVirtualCluster, +} + +// ParseClusterManager attempts to convert a string to a ClusterManager. +func ParseClusterManager(name string) (ClusterManager, error) { + if x, ok := _ClusterManagerValue[name]; ok { + return x, nil + } + return ClusterManager(0), fmt.Errorf("%s is %w", name, ErrInvalidClusterManager) +} diff --git a/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go b/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go index 6354737390..2e5a69a1d6 100644 --- a/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go +++ b/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go @@ -111,7 +111,7 @@ func UpsertContainer(containers []core.Container, upsert core.Container) []core. } func MergeContainer(container core.Container, containerTemplate core.Container) core.Container { - container.Command = containerTemplate.Command + container.Command = UpsertCommand(container.Command, containerTemplate.Command) container.Args = meta.UpsertArgumentList(container.Args, containerTemplate.Args) container.WorkingDir = containerTemplate.WorkingDir container.EnvFrom = containerTemplate.EnvFrom @@ -352,6 +352,22 @@ func EnsureEnvVarDeleted(vars []core.EnvVar, name string) []core.EnvVar { return vars } +func UpsertCommand(commands []string, nc []string) []string { + upsert := func(newCommand string) { + for _, c := range commands { + if c == newCommand { + return + } + } + commands = append(commands, newCommand) + } + + for _, command := range nc { + upsert(command) + } + return commands +} + func MergeLocalObjectReferences(l1, l2 []core.LocalObjectReference) []core.LocalObjectReference { result := make([]core.LocalObjectReference, 0, len(l1)+len(l2)) m := make(map[string]core.LocalObjectReference) diff --git a/vendor/modules.txt b/vendor/modules.txt index 170454cf6c..614d3f6cb6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1571,7 +1571,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.29.9 +# kmodules.xyz/client-go v0.29.11 ## explicit; go 1.21.5 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1