Skip to content

Commit

Permalink
Update client-go deps
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <arnob@appscode.com>
  • Loading branch information
ArnobKumarSaha committed Feb 27, 2024
1 parent a28e643 commit 310f4e2
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
17 changes: 15 additions & 2 deletions vendor/kmodules.xyz/client-go/api/v1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
84 changes: 84 additions & 0 deletions vendor/kmodules.xyz/client-go/api/v1/cluster_enum.go
Original file line number Diff line number Diff line change
@@ -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)
}
18 changes: 17 additions & 1 deletion vendor/kmodules.xyz/client-go/core/v1/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 310f4e2

Please sign in to comment.