diff --git a/go.mod b/go.mod index 86dbcb128e8..a477563e744 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.12 require ( github.com/Mellanox/sriovnet v1.0.1 github.com/alauda/felix v3.6.6-0.20201207121355-187332daf314+incompatible - github.com/alauda/kube-ovn v1.6.0 github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 github.com/containernetworking/cni v0.8.0 github.com/containernetworking/plugins v0.8.6 diff --git a/go.sum b/go.sum index 778c796bcaf..c0af5c6e0cf 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,6 @@ github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4Rq github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alauda/felix v3.6.6-0.20201207121355-187332daf314+incompatible h1:f8w9fTcjS9/Zdw57Law9JsFxh/sttnBor4TGkWQpSf8= github.com/alauda/felix v3.6.6-0.20201207121355-187332daf314+incompatible/go.mod h1:NeFJ7/fvKQ8X9styGJvh7sHmZoUprV5ZKzE2Ey82BEA= -github.com/alauda/kube-ovn v1.6.0 h1:/4OoW/4Vzpnp5x1olQwb3ozujAhAqF6+2hGPpxoxQrQ= -github.com/alauda/kube-ovn v1.6.0/go.mod h1:LhmXKFKj775Z1mnRFEdOFbw9NkZ+0iWK+AbXu40eOfE= github.com/alauda/ovsdb v0.0.0-20210113100339-040cf3e76c28 h1:FW5M3SAwSGBdtTboeV5sI7kEY6zraApSZQxTUfZ7LQY= github.com/alauda/ovsdb v0.0.0-20210113100339-040cf3e76c28/go.mod h1:dXpg+IAC2yp2IZQlEVmnmEc1rqEmSZzgNfu6+ai38J4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= diff --git a/vendor/github.com/cnf/structhash/.hound.yml b/vendor/github.com/cnf/structhash/.hound.yml new file mode 100644 index 00000000000..d2ab9016984 --- /dev/null +++ b/vendor/github.com/cnf/structhash/.hound.yml @@ -0,0 +1 @@ +# added hound style checking diff --git a/vendor/github.com/cnf/structhash/.travis.yml b/vendor/github.com/cnf/structhash/.travis.yml new file mode 100644 index 00000000000..be01c5c9896 --- /dev/null +++ b/vendor/github.com/cnf/structhash/.travis.yml @@ -0,0 +1,8 @@ +language: go +go: + - 1.8 + - 1.9 + - tip +arch: + - AMD64 + - ppc64le diff --git a/vendor/github.com/cnf/structhash/LICENSE b/vendor/github.com/cnf/structhash/LICENSE new file mode 100644 index 00000000000..8ad679f48bc --- /dev/null +++ b/vendor/github.com/cnf/structhash/LICENSE @@ -0,0 +1,6 @@ +ISC license +Copyright (c) 2014, Frank Rosquin + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/cnf/structhash/README.md b/vendor/github.com/cnf/structhash/README.md new file mode 100644 index 00000000000..6f1f9a3f8b6 --- /dev/null +++ b/vendor/github.com/cnf/structhash/README.md @@ -0,0 +1,97 @@ +# structhash [![GoDoc](https://godoc.org/github.com/cnf/structhash?status.svg)](https://godoc.org/github.com/cnf/structhash) [![Build Status](https://travis-ci.org/cnf/structhash.svg?branch=master)](https://travis-ci.org/cnf/structhash) + +structhash is a Go library for generating hash strings of arbitrary data structures. + +## Features + +* fields may be ignored or renamed (like in `json.Marshal`, but using different struct tag) +* fields may be serialized +* fields may be versioned +* fields order in struct doesn't matter (unlike `json.Marshal`) +* nil values are treated equally to zero values + +## Installation + +Standard `go get`: + +``` +$ go get github.com/cnf/structhash +``` + +## Documentation + +For usage and examples see the [Godoc](http://godoc.org/github.com/cnf/structhash). + +## Quick start + +```go +package main + +import ( + "fmt" + "crypto/md5" + "crypto/sha1" + "github.com/cnf/structhash" +) + +type S struct { + Str string + Num int +} + +func main() { + s := S{"hello", 123} + + hash, err := structhash.Hash(s, 1) + if err != nil { + panic(err) + } + fmt.Println(hash) + // Prints: v1_41011bfa1a996db6d0b1075981f5aa8f + + fmt.Println(structhash.Version(hash)) + // Prints: 1 + + fmt.Printf("%x\n", structhash.Md5(s, 1)) + // Prints: 41011bfa1a996db6d0b1075981f5aa8f + + fmt.Printf("%x\n", structhash.Sha1(s, 1)) + // Prints: 5ff72df7212ce8c55838fb3ec6ad0c019881a772 + + fmt.Printf("%x\n", md5.Sum(structhash.Dump(s, 1))) + // Prints: 41011bfa1a996db6d0b1075981f5aa8f + + fmt.Printf("%x\n", sha1.Sum(structhash.Dump(s, 1))) + // Prints: 5ff72df7212ce8c55838fb3ec6ad0c019881a772 +} +``` + +## Struct tags + +structhash supports struct tags in the following forms: + +* `hash:"-"`, or +* `hash:"name:{string} version:{number} lastversion:{number} method:{string}"` + +All fields are optional and may be ommitted. Their semantics is: + +* `-` - ignore field +* `name:{string}` - rename field (may be useful when you want to rename field but keep hashes unchanged for backward compatibility) +* `version:{number}` - ignore field if version passed to structhash is smaller than given number +* `lastversion:{number}` - ignore field if version passed to structhash is greater than given number +* `method:{string}` - use the return value of a field's method instead of the field itself + +Example: + +```go +type MyStruct struct { + Ignored string `hash:"-"` + Renamed string `hash:"name:OldName version:1"` + Legacy string `hash:"version:1 lastversion:2"` + Serialized error `hash:"method:Error"` +} +``` + +## Nil values + +When hash is calculated, nil pointers, nil slices, and nil maps are treated equally to zero values of corresponding type. E.g., nil pointer to string is equivalent to empty string, and nil slice is equivalent to empty slice. diff --git a/vendor/github.com/cnf/structhash/doc.go b/vendor/github.com/cnf/structhash/doc.go new file mode 100644 index 00000000000..1f04eeed1c5 --- /dev/null +++ b/vendor/github.com/cnf/structhash/doc.go @@ -0,0 +1,4 @@ +/* +Package structhash creates hash strings from arbitrary go data structures. +*/ +package structhash diff --git a/vendor/github.com/cnf/structhash/structhash.go b/vendor/github.com/cnf/structhash/structhash.go new file mode 100644 index 00000000000..3c2d9d1f208 --- /dev/null +++ b/vendor/github.com/cnf/structhash/structhash.go @@ -0,0 +1,260 @@ +package structhash + +import ( + "bytes" + "crypto/md5" + "crypto/sha1" + "fmt" + "reflect" + "sort" + "strconv" + "strings" +) + +// Version returns the version of the supplied hash as an integer +// or -1 on failure +func Version(h string) int { + if h == "" { + return -1 + } + if h[0] != 'v' { + return -1 + } + if spos := strings.IndexRune(h[1:], '_'); spos >= 0 { + n, e := strconv.Atoi(h[1 : spos+1]) + if e != nil { + return -1 + } + return n + } + return -1 +} + +// Hash takes a data structure and returns a hash string of that data structure +// at the version asked. +// +// This function uses md5 hashing function and default formatter. See also Dump() +// function. +func Hash(c interface{}, version int) (string, error) { + return fmt.Sprintf("v%d_%x", version, Md5(c, version)), nil +} + +// Dump takes a data structure and returns its byte representation. This can be +// useful if you need to use your own hashing function or formatter. +func Dump(c interface{}, version int) []byte { + return serialize(c, version) +} + +// Md5 takes a data structure and returns its md5 hash. +// This is a shorthand for md5.Sum(Dump(c, version)). +func Md5(c interface{}, version int) []byte { + sum := md5.Sum(Dump(c, version)) + return sum[:] +} + +// Sha1 takes a data structure and returns its sha1 hash. +// This is a shorthand for sha1.Sum(Dump(c, version)). +func Sha1(c interface{}, version int) []byte { + sum := sha1.Sum(Dump(c, version)) + return sum[:] +} + +type item struct { + name string + value reflect.Value +} + +type itemSorter []item + +func (s itemSorter) Len() int { + return len(s) +} + +func (s itemSorter) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s itemSorter) Less(i, j int) bool { + return s[i].name < s[j].name +} + +type tagError string + +func (e tagError) Error() string { + return "incorrect tag " + string(e) +} + +type structFieldFilter func(reflect.StructField, *item) (bool, error) + +func writeValue(buf *bytes.Buffer, val reflect.Value, fltr structFieldFilter) { + switch val.Kind() { + case reflect.String: + buf.WriteByte('"') + buf.WriteString(val.String()) + buf.WriteByte('"') + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + buf.WriteString(strconv.FormatInt(val.Int(), 10)) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + buf.WriteString(strconv.FormatUint(val.Uint(), 10)) + case reflect.Float32, reflect.Float64: + buf.WriteString(strconv.FormatFloat(val.Float(), 'E', -1, 64)) + case reflect.Bool: + if val.Bool() { + buf.WriteByte('t') + } else { + buf.WriteByte('f') + } + case reflect.Ptr: + if !val.IsNil() || val.Type().Elem().Kind() == reflect.Struct { + writeValue(buf, reflect.Indirect(val), fltr) + } else { + writeValue(buf, reflect.Zero(val.Type().Elem()), fltr) + } + case reflect.Array, reflect.Slice: + buf.WriteByte('[') + len := val.Len() + for i := 0; i < len; i++ { + if i != 0 { + buf.WriteByte(',') + } + writeValue(buf, val.Index(i), fltr) + } + buf.WriteByte(']') + case reflect.Map: + mk := val.MapKeys() + items := make([]item, len(mk), len(mk)) + // Get all values + for i, _ := range items { + items[i].name = formatValue(mk[i], fltr) + items[i].value = val.MapIndex(mk[i]) + } + + // Sort values by key + sort.Sort(itemSorter(items)) + + buf.WriteByte('[') + for i, _ := range items { + if i != 0 { + buf.WriteByte(',') + } + buf.WriteString(items[i].name) + buf.WriteByte(':') + writeValue(buf, items[i].value, fltr) + } + buf.WriteByte(']') + case reflect.Struct: + vtype := val.Type() + flen := vtype.NumField() + items := make([]item, 0, flen) + // Get all fields + for i := 0; i < flen; i++ { + field := vtype.Field(i) + it := item{field.Name, val.Field(i)} + if fltr != nil { + ok, err := fltr(field, &it) + if err != nil && strings.Contains(err.Error(), "method:") { + panic(err) + } + if !ok { + continue + } + } + items = append(items, it) + } + // Sort fields by name + sort.Sort(itemSorter(items)) + + buf.WriteByte('{') + for i, _ := range items { + if i != 0 { + buf.WriteByte(',') + } + buf.WriteString(items[i].name) + buf.WriteByte(':') + writeValue(buf, items[i].value, fltr) + } + buf.WriteByte('}') + case reflect.Interface: + if !val.CanInterface() { + return + } + writeValue(buf, reflect.ValueOf(val.Interface()), fltr) + default: + buf.WriteString(val.String()) + } +} + +func formatValue(val reflect.Value, fltr structFieldFilter) string { + if val.Kind() == reflect.String { + return "\"" + val.String() + "\"" + } + + var buf bytes.Buffer + writeValue(&buf, val, fltr) + + return string(buf.Bytes()) +} + +func filterField(f reflect.StructField, i *item, version int) (bool, error) { + var err error + ver := 0 + lastver := -1 + if str := f.Tag.Get("hash"); str != "" { + if str == "-" { + return false, nil + } + for _, tag := range strings.Split(str, " ") { + args := strings.Split(strings.TrimSpace(tag), ":") + if len(args) != 2 { + return false, tagError(tag) + } + switch args[0] { + case "name": + i.name = args[1] + case "version": + if ver, err = strconv.Atoi(args[1]); err != nil { + return false, tagError(tag) + } + case "lastversion": + if lastver, err = strconv.Atoi(args[1]); err != nil { + return false, tagError(tag) + } + case "method": + property, found := f.Type.MethodByName(strings.TrimSpace(args[1])) + if !found || property.Type.NumOut() != 1 { + return false, tagError(tag) + } + i.value = property.Func.Call([]reflect.Value{i.value})[0] + } + } + } else { + if str := f.Tag.Get("lastversion"); str != "" { + if lastver, err = strconv.Atoi(str); err != nil { + return false, tagError(str) + } + } + if str := f.Tag.Get("version"); str != "" { + if ver, err = strconv.Atoi(str); err != nil { + return false, tagError(str) + } + } + } + if lastver != -1 && lastver < version { + return false, nil + } + if ver > version { + return false, nil + } + return true, nil +} + +func serialize(object interface{}, version int) []byte { + var buf bytes.Buffer + + writeValue(&buf, reflect.ValueOf(object), + func(f reflect.StructField, i *item) (bool, error) { + return filterField(f, i, version) + }) + + return buf.Bytes() +} diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.go b/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.go rename to vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go b/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go rename to vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto b/vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto rename to vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md b/vendor/github.com/googleapis/gnostic/openapiv2/README.md similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md rename to vendor/github.com/googleapis/gnostic/openapiv2/README.md diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/document.go b/vendor/github.com/googleapis/gnostic/openapiv2/document.go similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/document.go rename to vendor/github.com/googleapis/gnostic/openapiv2/document.go diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json b/vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json similarity index 100% rename from vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json rename to vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/LICENSE b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/register.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/register.go new file mode 100644 index 00000000000..8ea2a30281b --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/register.go @@ -0,0 +1,5 @@ +package k8scnicncfio + +const ( + GroupName = "k8s.cni.cncf.io" +) diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/doc.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/doc.go new file mode 100644 index 00000000000..2882952a048 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package,register +// +groupName=k8s.cni.cncf.io +// +groupGoName=K8sCniCncfIo + +package v1 diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/register.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/register.go new file mode 100644 index 00000000000..e40da25728e --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/register.go @@ -0,0 +1,41 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + k8scnicncfio "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: k8scnicncfio.GroupName, Version: "v1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &NetworkAttachmentDefinition{}, + &NetworkAttachmentDefinitionList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/types.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/types.go new file mode 100644 index 00000000000..0eceddc5c4e --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/types.go @@ -0,0 +1,120 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "net" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resourceName=network-attachment-definitions + +type NetworkAttachmentDefinition struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NetworkAttachmentDefinitionSpec `json:"spec"` +} + +type NetworkAttachmentDefinitionSpec struct { + Config string `json:"config"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NetworkAttachmentDefinitionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []NetworkAttachmentDefinition `json:"items"` +} + +// DNS contains values interesting for DNS resolvers +// +k8s:deepcopy-gen=false +type DNS struct { + Nameservers []string `json:"nameservers,omitempty"` + Domain string `json:"domain,omitempty"` + Search []string `json:"search,omitempty"` + Options []string `json:"options,omitempty"` +} + +// NetworkStatus is for network status annotation for pod +// +k8s:deepcopy-gen=false +type NetworkStatus struct { + Name string `json:"name"` + Interface string `json:"interface,omitempty"` + IPs []string `json:"ips,omitempty"` + Mac string `json:"mac,omitempty"` + Default bool `json:"default,omitempty"` + DNS DNS `json:"dns,omitempty"` +} + +// PortMapEntry for CNI PortMapEntry +// +k8s:deepcopy-gen=false +type PortMapEntry struct { + HostPort int `json:"hostPort"` + ContainerPort int `json:"containerPort"` + Protocol string `json:"protocol,omitempty"` + HostIP string `json:"hostIP,omitempty"` +} + +// BandwidthEntry for CNI BandwidthEntry +// +k8s:deepcopy-gen=false +type BandwidthEntry struct { + IngressRate int `json:"ingressRate"` + IngressBurst int `json:"ingressBurst"` + + EgressRate int `json:"egressRate"` + EgressBurst int `json:"egressBurst"` +} + +// NetworkSelectionElement represents one element of the JSON format +// Network Attachment Selection Annotation as described in section 4.1.2 +// of the CRD specification. +// +k8s:deepcopy-gen=false +type NetworkSelectionElement struct { + // Name contains the name of the Network object this element selects + Name string `json:"name"` + // Namespace contains the optional namespace that the network referenced + // by Name exists in + Namespace string `json:"namespace,omitempty"` + // IPRequest contains an optional requested IP addresses for this network + // attachment + IPRequest []string `json:"ips,omitempty"` + // MacRequest contains an optional requested MAC address for this + // network attachment + MacRequest string `json:"mac,omitempty"` + // InfinibandGUIDRequest contains an optional requested Infiniband GUID + // address for this network attachment + InfinibandGUIDRequest string `json:"infiniband-guid,omitempty"` + // InterfaceRequest contains an optional requested name for the + // network interface this attachment will create in the container + InterfaceRequest string `json:"interface,omitempty"` + // PortMappingsRequest contains an optional requested port mapping + // for the network + PortMappingsRequest []*PortMapEntry `json:"portMappings,omitempty"` + // BandwidthRequest contains an optional requested bandwidth for + // the network + BandwidthRequest *BandwidthEntry `json:"bandwidth,omitempty"` + // CNIArgs contains additional CNI arguments for the network interface + CNIArgs *map[string]interface{} `json:"cni-args"` + // GatewayRequest contains default route IP address for the pod + GatewayRequest []net.IP `json:"default-route,omitempty"` +} + +const ( + // Pod annotation for network-attachment-definition + NetworkAttachmentAnnot = "k8s.v1.cni.cncf.io/networks" + // Pod annotation for network status + NetworkStatusAnnot = "k8s.v1.cni.cncf.io/network-status" + // Old Pod annotation for network status (which is used before but it will be obsolated) + OldNetworkStatusAnnot = "k8s.v1.cni.cncf.io/networks-status" +) + +// NoK8sNetworkError indicates error, no network in kubernetes +// +k8s:deepcopy-gen=false +type NoK8sNetworkError struct { + Message string +} + +func (e *NoK8sNetworkError) Error() string { return string(e.Message) } diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/zz_generated.deepcopy.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..8f74abde019 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1/zz_generated.deepcopy.go @@ -0,0 +1,101 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkAttachmentDefinition) DeepCopyInto(out *NetworkAttachmentDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkAttachmentDefinition. +func (in *NetworkAttachmentDefinition) DeepCopy() *NetworkAttachmentDefinition { + if in == nil { + return nil + } + out := new(NetworkAttachmentDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkAttachmentDefinition) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkAttachmentDefinitionList) DeepCopyInto(out *NetworkAttachmentDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetworkAttachmentDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkAttachmentDefinitionList. +func (in *NetworkAttachmentDefinitionList) DeepCopy() *NetworkAttachmentDefinitionList { + if in == nil { + return nil + } + out := new(NetworkAttachmentDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkAttachmentDefinitionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkAttachmentDefinitionSpec) DeepCopyInto(out *NetworkAttachmentDefinitionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkAttachmentDefinitionSpec. +func (in *NetworkAttachmentDefinitionSpec) DeepCopy() *NetworkAttachmentDefinitionSpec { + if in == nil { + return nil + } + out := new(NetworkAttachmentDefinitionSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/clientset.go new file mode 100644 index 00000000000..2b86a7d1223 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/clientset.go @@ -0,0 +1,97 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + "fmt" + + k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + K8sCniCncfIoV1() k8scnicncfiov1.K8sCniCncfIoV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + k8sCniCncfIoV1 *k8scnicncfiov1.K8sCniCncfIoV1Client +} + +// K8sCniCncfIoV1 retrieves the K8sCniCncfIoV1Client +func (c *Clientset) K8sCniCncfIoV1() k8scnicncfiov1.K8sCniCncfIoV1Interface { + return c.k8sCniCncfIoV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.k8sCniCncfIoV1, err = k8scnicncfiov1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.k8sCniCncfIoV1 = k8scnicncfiov1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.k8sCniCncfIoV1 = k8scnicncfiov1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/doc.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/doc.go new file mode 100644 index 00000000000..10f4419bdc5 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 00000000000..25a11f92f6d --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 00000000000..466c4f32926 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + k8scnicncfiov1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/doc.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/doc.go new file mode 100644 index 00000000000..c334e6f27a8 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/generated_expansion.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/generated_expansion.go new file mode 100644 index 00000000000..03219735a1c --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type NetworkAttachmentDefinitionExpansion interface{} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/k8s.cni.cncf.io_client.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/k8s.cni.cncf.io_client.go new file mode 100644 index 00000000000..b9f5e8e224c --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/k8s.cni.cncf.io_client.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" + "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type K8sCniCncfIoV1Interface interface { + RESTClient() rest.Interface + NetworkAttachmentDefinitionsGetter +} + +// K8sCniCncfIoV1Client is used to interact with features provided by the k8s.cni.cncf.io group. +type K8sCniCncfIoV1Client struct { + restClient rest.Interface +} + +func (c *K8sCniCncfIoV1Client) NetworkAttachmentDefinitions(namespace string) NetworkAttachmentDefinitionInterface { + return newNetworkAttachmentDefinitions(c, namespace) +} + +// NewForConfig creates a new K8sCniCncfIoV1Client for the given config. +func NewForConfig(c *rest.Config) (*K8sCniCncfIoV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &K8sCniCncfIoV1Client{client}, nil +} + +// NewForConfigOrDie creates a new K8sCniCncfIoV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *K8sCniCncfIoV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new K8sCniCncfIoV1Client for the given RESTClient. +func New(c rest.Interface) *K8sCniCncfIoV1Client { + return &K8sCniCncfIoV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *K8sCniCncfIoV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go new file mode 100644 index 00000000000..cac55f71c93 --- /dev/null +++ b/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1/networkattachmentdefinition.go @@ -0,0 +1,178 @@ +/* +Copyright 2020 The Kubernetes Authors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + v1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" + scheme "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// NetworkAttachmentDefinitionsGetter has a method to return a NetworkAttachmentDefinitionInterface. +// A group's client should implement this interface. +type NetworkAttachmentDefinitionsGetter interface { + NetworkAttachmentDefinitions(namespace string) NetworkAttachmentDefinitionInterface +} + +// NetworkAttachmentDefinitionInterface has methods to work with NetworkAttachmentDefinition resources. +type NetworkAttachmentDefinitionInterface interface { + Create(ctx context.Context, networkAttachmentDefinition *v1.NetworkAttachmentDefinition, opts metav1.CreateOptions) (*v1.NetworkAttachmentDefinition, error) + Update(ctx context.Context, networkAttachmentDefinition *v1.NetworkAttachmentDefinition, opts metav1.UpdateOptions) (*v1.NetworkAttachmentDefinition, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.NetworkAttachmentDefinition, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.NetworkAttachmentDefinitionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkAttachmentDefinition, err error) + NetworkAttachmentDefinitionExpansion +} + +// networkAttachmentDefinitions implements NetworkAttachmentDefinitionInterface +type networkAttachmentDefinitions struct { + client rest.Interface + ns string +} + +// newNetworkAttachmentDefinitions returns a NetworkAttachmentDefinitions +func newNetworkAttachmentDefinitions(c *K8sCniCncfIoV1Client, namespace string) *networkAttachmentDefinitions { + return &networkAttachmentDefinitions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkAttachmentDefinition, and returns the corresponding networkAttachmentDefinition object, and an error if there is any. +func (c *networkAttachmentDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.NetworkAttachmentDefinition, err error) { + result = &v1.NetworkAttachmentDefinition{} + err = c.client.Get(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NetworkAttachmentDefinitions that match those selectors. +func (c *networkAttachmentDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NetworkAttachmentDefinitionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.NetworkAttachmentDefinitionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networkAttachmentDefinitions. +func (c *networkAttachmentDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a networkAttachmentDefinition and creates it. Returns the server's representation of the networkAttachmentDefinition, and an error, if there is any. +func (c *networkAttachmentDefinitions) Create(ctx context.Context, networkAttachmentDefinition *v1.NetworkAttachmentDefinition, opts metav1.CreateOptions) (result *v1.NetworkAttachmentDefinition, err error) { + result = &v1.NetworkAttachmentDefinition{} + err = c.client.Post(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkAttachmentDefinition). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a networkAttachmentDefinition and updates it. Returns the server's representation of the networkAttachmentDefinition, and an error, if there is any. +func (c *networkAttachmentDefinitions) Update(ctx context.Context, networkAttachmentDefinition *v1.NetworkAttachmentDefinition, opts metav1.UpdateOptions) (result *v1.NetworkAttachmentDefinition, err error) { + result = &v1.NetworkAttachmentDefinition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + Name(networkAttachmentDefinition.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkAttachmentDefinition). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the networkAttachmentDefinition and deletes it. Returns an error if one occurs. +func (c *networkAttachmentDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *networkAttachmentDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("network-attachment-definitions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched networkAttachmentDefinition. +func (c *networkAttachmentDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkAttachmentDefinition, err error) { + result = &v1.NetworkAttachmentDefinition{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("network-attachment-definitions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4c254f1eb63..ae48a7b518e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -12,6 +12,8 @@ github.com/armon/go-radix github.com/beorn7/perks/quantile # github.com/cespare/xxhash/v2 v2.1.1 github.com/cespare/xxhash/v2 +# github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 +github.com/cnf/structhash # github.com/containernetworking/cni v0.8.0 github.com/containernetworking/cni/libcni github.com/containernetworking/cni/pkg/invoke @@ -96,6 +98,12 @@ github.com/intel/multus-cni/logging github.com/intel/multus-cni/types # github.com/json-iterator/go v1.1.10 github.com/json-iterator/go +# github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.1.0 +github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io +github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1 +github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned +github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/scheme +github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1 # github.com/konsorten/go-windows-terminal-sequences v1.0.3 github.com/konsorten/go-windows-terminal-sequences # github.com/magiconair/properties v1.8.1