Update go dependencies
This commit is contained in:
parent
7169f3ba46
commit
ec3da4d2c9
24 changed files with 402 additions and 173 deletions
29
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/crd.go
generated
vendored
29
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/crd.go
generated
vendored
|
|
@ -278,10 +278,16 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
|
|||
var (
|
||||
err error
|
||||
info os.FileInfo
|
||||
crds []*unstructured.Unstructured
|
||||
files []os.FileInfo
|
||||
)
|
||||
|
||||
type GVKN struct {
|
||||
GVK schema.GroupVersionKind
|
||||
Name string
|
||||
}
|
||||
|
||||
crds := map[GVKN]*unstructured.Unstructured{}
|
||||
|
||||
for _, path := range options.Paths {
|
||||
var filePath = path
|
||||
|
||||
|
|
@ -294,7 +300,7 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
|
|||
}
|
||||
|
||||
if !info.IsDir() {
|
||||
filePath, files = filepath.Dir(path), append(files, info)
|
||||
filePath, files = filepath.Dir(path), []os.FileInfo{info}
|
||||
} else {
|
||||
if files, err = ioutil.ReadDir(path); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -307,14 +313,23 @@ func renderCRDs(options *CRDInstallOptions) ([]runtime.Object, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// If CRD already in the list, skip it.
|
||||
if existsUnstructured(crds, crdList) {
|
||||
continue
|
||||
for i, crd := range crdList {
|
||||
gvkn := GVKN{GVK: crd.GroupVersionKind(), Name: crd.GetName()}
|
||||
if _, found := crds[gvkn]; found {
|
||||
// Currently, we only print a log when there are duplicates. We may want to error out if that makes more sense.
|
||||
log.Info("there are more than one CRD definitions with the same <Group, Version, Kind, Name>", "GVKN", gvkn)
|
||||
}
|
||||
// We always use the CRD definition that we found last.
|
||||
crds[gvkn] = crdList[i]
|
||||
}
|
||||
crds = append(crds, crdList...)
|
||||
}
|
||||
|
||||
return unstructuredCRDListToRuntime(crds), nil
|
||||
// Converting map to a list to return
|
||||
var res []runtime.Object
|
||||
for _, obj := range crds {
|
||||
res = append(res, obj)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// readCRDs reads the CRDs from files and Unmarshals them into structs
|
||||
|
|
|
|||
22
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/helper.go
generated
vendored
22
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/helper.go
generated
vendored
|
|
@ -1,8 +1,6 @@
|
|||
package envtest
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
|
@ -57,18 +55,6 @@ func mergeCRDs(s1, s2 []runtime.Object) []runtime.Object {
|
|||
return merged
|
||||
}
|
||||
|
||||
// existsUnstructured verify if a any item is common between two lists.
|
||||
func existsUnstructured(s1, s2 []*unstructured.Unstructured) bool {
|
||||
for _, s1obj := range s1 {
|
||||
for _, s2obj := range s2 {
|
||||
if reflect.DeepEqual(s1obj, s2obj) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func runtimeCRDListToUnstructured(l []runtime.Object) []*unstructured.Unstructured {
|
||||
res := []*unstructured.Unstructured{}
|
||||
for _, obj := range l {
|
||||
|
|
@ -81,11 +67,3 @@ func runtimeCRDListToUnstructured(l []runtime.Object) []*unstructured.Unstructur
|
|||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func unstructuredCRDListToRuntime(l []*unstructured.Unstructured) []runtime.Object {
|
||||
res := []runtime.Object{}
|
||||
for _, obj := range l {
|
||||
res = append(res, obj.DeepCopy())
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
4
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/webhook.go
generated
vendored
4
vendor/sigs.k8s.io/controller-runtime/pkg/envtest/webhook.go
generated
vendored
|
|
@ -376,8 +376,8 @@ func readWebhooks(path string) ([]runtime.Object, []runtime.Object, error) {
|
|||
}
|
||||
|
||||
const (
|
||||
admissionregv1 = "admissionregistration.k8s.io/v1beta1"
|
||||
admissionregv1beta1 = "admissionregistration.k8s.io/v1"
|
||||
admissionregv1 = "admissionregistration.k8s.io/v1"
|
||||
admissionregv1beta1 = "admissionregistration.k8s.io/v1beta1"
|
||||
)
|
||||
switch {
|
||||
case generic.Kind == "MutatingWebhookConfiguration":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue