update kube and vendor dependencies

With kubernetes 1.18 release of client-go, signatures on methods in
generated clientsets, dynamic, metadata, and scale clients have been
modified to accept context.Context as a first argument.
Signatures of Create, Update, and Patch methods have been updated
to accept CreateOptions, UpdateOptions and PatchOptions respectively.
Signatures of Delete and DeleteCollection methods now accept
DeleteOptions by value instead of by reference.
These changes are now accommodated with this PR and client-go
and dependencies are updated to v1.18.0

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal
2020-05-03 21:51:04 +05:30
parent d6be7e120d
commit b72230379f
1008 changed files with 20764 additions and 82152 deletions

View File

@@ -29,9 +29,6 @@ import (
"strings"
flag "github.com/spf13/pflag"
"gonum.org/v1/gonum/graph"
"gonum.org/v1/gonum/graph/simple"
"gonum.org/v1/gonum/graph/topo"
"k8s.io/code-generator/pkg/util"
"k8s.io/gengo/args"
@@ -374,38 +371,73 @@ func deps(c *generator.Context, pkgs []*protobufPackage) map[string][]string {
return ret
}
// given a set of pkg->[]deps, return the order that ensures all deps are processed before the things that depend on them
func importOrder(deps map[string][]string) ([]string, error) {
nodes := map[string]graph.Node{}
names := map[int64]string{}
g := simple.NewDirectedGraph()
for pkg, imports := range deps {
for _, imp := range imports {
if _, found := nodes[pkg]; !found {
n := g.NewNode()
g.AddNode(n)
nodes[pkg] = n
names[n.ID()] = pkg
}
if _, found := nodes[imp]; !found {
n := g.NewNode()
g.AddNode(n)
nodes[imp] = n
names[n.ID()] = imp
}
g.SetEdge(g.NewEdge(nodes[imp], nodes[pkg]))
// add all nodes and edges
var remainingNodes = map[string]struct{}{}
var graph = map[edge]struct{}{}
for to, froms := range deps {
remainingNodes[to] = struct{}{}
for _, from := range froms {
remainingNodes[from] = struct{}{}
graph[edge{from: from, to: to}] = struct{}{}
}
}
ret := []string{}
sorted, err := topo.Sort(g)
if err != nil {
return nil, err
// find initial nodes without any dependencies
sorted := findAndRemoveNodesWithoutDependencies(remainingNodes, graph)
for i := 0; i < len(sorted); i++ {
node := sorted[i]
removeEdgesFrom(node, graph)
sorted = append(sorted, findAndRemoveNodesWithoutDependencies(remainingNodes, graph)...)
}
if len(remainingNodes) > 0 {
return nil, fmt.Errorf("cycle: remaining nodes: %#v, remaining edges: %#v", remainingNodes, graph)
}
for _, n := range sorted {
ret = append(ret, names[n.ID()])
fmt.Println("topological order", names[n.ID()])
fmt.Println("topological order", n)
}
return sorted, nil
}
// edge describes a from->to relationship in a graph
type edge struct {
from string
to string
}
// findAndRemoveNodesWithoutDependencies finds nodes in the given set which are not pointed to by any edges in the graph,
// removes them from the set of nodes, and returns them in sorted order
func findAndRemoveNodesWithoutDependencies(nodes map[string]struct{}, graph map[edge]struct{}) []string {
roots := []string{}
// iterate over all nodes as potential "to" nodes
for node := range nodes {
incoming := false
// iterate over all remaining edges
for edge := range graph {
// if there's any edge to the node we care about, it's not a root
if edge.to == node {
incoming = true
break
}
}
// if there are no incoming edges, remove from the set of remaining nodes and add to our results
if !incoming {
delete(nodes, node)
roots = append(roots, node)
}
}
sort.Strings(roots)
return roots
}
// removeEdgesFrom removes any edges from the graph where edge.from == node
func removeEdgesFrom(node string, graph map[edge]struct{}) {
for edge := range graph {
if edge.from == node {
delete(graph, edge)
}
}
return ret, nil
}
type positionOrder struct {