diff --git a/cmd/glbc/main.go b/cmd/glbc/main.go index 9be8f3604f..1ef6a313db 100644 --- a/cmd/glbc/main.go +++ b/cmd/glbc/main.go @@ -20,6 +20,7 @@ import ( "context" "encoding/json" "fmt" + networkclient "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" "math/rand" "os" "time" @@ -160,6 +161,14 @@ func main() { } } + var networkClient networkclient.Interface + if flags.F.EnableMultiNetworking { + networkClient, err = networkclient.NewForConfig(kubeConfig) + if err != nil { + klog.Fatalf("Failed to create Network client: %v", err) + } + } + ingClassEnabled := flags.F.EnableIngressGAFields && app.IngressClassEnabled(kubeClient) var ingParamsClient ingparamsclient.Interface if ingClassEnabled { @@ -205,7 +214,7 @@ func main() { EnableL4ILBDualStack: flags.F.EnableL4ILBDualStack, EnableL4NetLBDualStack: flags.F.EnableL4NetLBDualStack, } - ctx := ingctx.NewControllerContext(kubeConfig, kubeClient, backendConfigClient, frontendConfigClient, svcNegClient, ingParamsClient, svcAttachmentClient, cloud, namer, kubeSystemUID, ctxConfig) + ctx := ingctx.NewControllerContext(kubeConfig, kubeClient, backendConfigClient, frontendConfigClient, svcNegClient, ingParamsClient, svcAttachmentClient, networkClient, cloud, namer, kubeSystemUID, ctxConfig) go app.RunHTTPServer(ctx.HealthCheck) if !flags.F.LeaderElection.LeaderElect { diff --git a/go.mod b/go.mod index 8676447951..fc82d1511d 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( k8s.io/apimachinery v0.26.2 k8s.io/client-go v0.26.2 k8s.io/cloud-provider v0.26.2 + k8s.io/cloud-provider-gcp/crd v0.0.0-20230322202223-f7280f55e36f k8s.io/cloud-provider-gcp/providers v0.26.3-0.20230322202223-f7280f55e36f k8s.io/component-base v0.26.2 k8s.io/klog/v2 v2.80.1 diff --git a/go.sum b/go.sum index d303c13b8d..b4902271ca 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs= -github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= +github.com/onsi/ginkgo/v2 v2.6.1 h1:1xQPCjcqYw/J5LchOcp4/2q/jzJFjiAOc25chhnDw+Q= +github.com/onsi/gomega v1.24.2 h1:J/tulyYK6JwBldPViHJReihxxZ+22FHs0piGjQAvoUE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -620,6 +620,8 @@ k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI= k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU= k8s.io/cloud-provider v0.26.2 h1:VlLGDayUV5VBpvMSBFqmpz2HHTjBLUw02wuZzNeEsW0= k8s.io/cloud-provider v0.26.2/go.mod h1:/Am9R0merLIZgVqPTE4Z1JkBcCrp2uXImHCxnvVARxc= +k8s.io/cloud-provider-gcp/crd v0.0.0-20230322202223-f7280f55e36f h1:6gjbpA3IVXjIJRKRqgYQlKc9vPtxlhMABQUI0vB5f0M= +k8s.io/cloud-provider-gcp/crd v0.0.0-20230322202223-f7280f55e36f/go.mod h1:A//VRRwQBcvAI20bbCc5jmxMSegf/DqxDI7XVK9oyYo= k8s.io/cloud-provider-gcp/providers v0.26.3-0.20230322202223-f7280f55e36f h1:XPbo07vZ+h1xiGFIAN+gmlGm6G8zrZyhf/Xb6jNerTk= k8s.io/cloud-provider-gcp/providers v0.26.3-0.20230322202223-f7280f55e36f/go.mod h1:dDBqOcDqYsqo7ZM7yuX+6Xg9WiyEPYk1Q9m2oHrnePo= k8s.io/component-base v0.26.2 h1:IfWgCGUDzrD6wLLgXEstJKYZKAFS2kO+rBRi0p3LqcI= diff --git a/pkg/context/context.go b/pkg/context/context.go index 8637bd0333..9e6d5c7f85 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -30,6 +30,9 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" + networkclient "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + informernetwork "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1" + informergkenetworkparamset "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1" "k8s.io/cloud-provider-gcp/providers/gce" sav1 "k8s.io/ingress-gce/pkg/apis/serviceattachment/v1" sav1beta1 "k8s.io/ingress-gce/pkg/apis/serviceattachment/v1beta1" @@ -79,18 +82,20 @@ type ControllerContext struct { ControllerContextConfig ASMConfigController *cmconfig.ConfigMapConfigController - IngressInformer cache.SharedIndexInformer - ServiceInformer cache.SharedIndexInformer - BackendConfigInformer cache.SharedIndexInformer - FrontendConfigInformer cache.SharedIndexInformer - PodInformer cache.SharedIndexInformer - NodeInformer cache.SharedIndexInformer - EndpointSliceInformer cache.SharedIndexInformer - ConfigMapInformer cache.SharedIndexInformer - SvcNegInformer cache.SharedIndexInformer - IngClassInformer cache.SharedIndexInformer - IngParamsInformer cache.SharedIndexInformer - SAInformer cache.SharedIndexInformer + IngressInformer cache.SharedIndexInformer + ServiceInformer cache.SharedIndexInformer + BackendConfigInformer cache.SharedIndexInformer + FrontendConfigInformer cache.SharedIndexInformer + PodInformer cache.SharedIndexInformer + NodeInformer cache.SharedIndexInformer + EndpointSliceInformer cache.SharedIndexInformer + ConfigMapInformer cache.SharedIndexInformer + SvcNegInformer cache.SharedIndexInformer + IngClassInformer cache.SharedIndexInformer + IngParamsInformer cache.SharedIndexInformer + SAInformer cache.SharedIndexInformer + NetworkInformer cache.SharedIndexInformer + GKENetworkParamsInformer cache.SharedIndexInformer ControllerMetrics *metrics.ControllerMetrics @@ -136,30 +141,39 @@ func NewControllerContext( svcnegClient svcnegclient.Interface, ingParamsClient ingparamsclient.Interface, saClient serviceattachmentclient.Interface, + networkClient networkclient.Interface, cloud *gce.Cloud, clusterNamer *namer.Namer, kubeSystemUID types.UID, config ControllerContextConfig) *ControllerContext { + var networkInformer cache.SharedIndexInformer + var gkeNetworkParamSetInformer cache.SharedIndexInformer + if networkClient != nil { + networkInformer = informernetwork.NewNetworkInformer(networkClient, config.ResyncPeriod, utils.NewNamespaceIndexer()) + gkeNetworkParamSetInformer = informergkenetworkparamset.NewGKENetworkParamSetInformer(networkClient, config.ResyncPeriod, utils.NewNamespaceIndexer()) + } context := &ControllerContext{ - KubeConfig: kubeConfig, - KubeClient: kubeClient, - SvcNegClient: svcnegClient, - SAClient: saClient, - Cloud: cloud, - ClusterNamer: clusterNamer, - L4Namer: namer.NewL4Namer(string(kubeSystemUID), clusterNamer), - KubeSystemUID: kubeSystemUID, - ControllerMetrics: metrics.NewControllerMetrics(flags.F.MetricsExportInterval, flags.F.L4NetLBProvisionDeadline), - ControllerContextConfig: config, - IngressInformer: informernetworking.NewIngressInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), - ServiceInformer: informerv1.NewServiceInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), - BackendConfigInformer: informerbackendconfig.NewBackendConfigInformer(backendConfigClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), - PodInformer: informerv1.NewPodInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), - NodeInformer: informerv1.NewNodeInformer(kubeClient, config.ResyncPeriod, utils.NewNamespaceIndexer()), - SvcNegInformer: informersvcneg.NewServiceNetworkEndpointGroupInformer(svcnegClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), - recorders: map[string]record.EventRecorder{}, - healthChecks: make(map[string]func() error), + KubeConfig: kubeConfig, + KubeClient: kubeClient, + SvcNegClient: svcnegClient, + SAClient: saClient, + Cloud: cloud, + ClusterNamer: clusterNamer, + L4Namer: namer.NewL4Namer(string(kubeSystemUID), clusterNamer), + KubeSystemUID: kubeSystemUID, + ControllerMetrics: metrics.NewControllerMetrics(flags.F.MetricsExportInterval, flags.F.L4NetLBProvisionDeadline), + ControllerContextConfig: config, + IngressInformer: informernetworking.NewIngressInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), + ServiceInformer: informerv1.NewServiceInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), + BackendConfigInformer: informerbackendconfig.NewBackendConfigInformer(backendConfigClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), + PodInformer: informerv1.NewPodInformer(kubeClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), + NodeInformer: informerv1.NewNodeInformer(kubeClient, config.ResyncPeriod, utils.NewNamespaceIndexer()), + SvcNegInformer: informersvcneg.NewServiceNetworkEndpointGroupInformer(svcnegClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()), + NetworkInformer: networkInformer, + GKENetworkParamsInformer: gkeNetworkParamSetInformer, + recorders: map[string]record.EventRecorder{}, + healthChecks: make(map[string]func() error), } if config.FrontendConfigEnabled { context.FrontendConfigInformer = informerfrontendconfig.NewFrontendConfigInformer(frontendConfigClient, config.Namespace, config.ResyncPeriod, utils.NewNamespaceIndexer()) @@ -261,6 +275,12 @@ func (ctx *ControllerContext) HasSynced() bool { if ctx.SAInformer != nil { funcs = append(funcs, ctx.SAInformer.HasSynced) } + if ctx.NetworkInformer != nil { + funcs = append(funcs, ctx.NetworkInformer.HasSynced) + } + if ctx.GKENetworkParamsInformer != nil { + funcs = append(funcs, ctx.GKENetworkParamsInformer.HasSynced) + } for _, f := range funcs { if !f() { @@ -342,6 +362,12 @@ func (ctx *ControllerContext) Start(stopCh chan struct{}) { if ctx.SAInformer != nil { go ctx.SAInformer.Run(stopCh) } + if ctx.NetworkInformer != nil { + go ctx.NetworkInformer.Run(stopCh) + } + if ctx.GKENetworkParamsInformer != nil { + go ctx.GKENetworkParamsInformer.Run(stopCh) + } // Export ingress usage metrics. go ctx.ControllerMetrics.Run(stopCh) } diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index a13c137d7b..f02529c862 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -72,7 +72,7 @@ func newLoadBalancerController() *LoadBalancerController { DefaultBackendSvcPort: test.DefaultBeSvcPort, HealthCheckPath: "/", } - ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) + ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) lbc := NewLoadBalancerController(ctx, stopCh) // TODO(rramkumar): Fix this so we don't have to override with our fake lbc.instancePool = instancegroups.NewManager(&instancegroups.ManagerConfig{ diff --git a/pkg/firewalls/controller_test.go b/pkg/firewalls/controller_test.go index a4b6d5a4fd..77ccafd30f 100644 --- a/pkg/firewalls/controller_test.go +++ b/pkg/firewalls/controller_test.go @@ -49,7 +49,7 @@ func newFirewallController() *FirewallController { DefaultBackendSvcPort: test.DefaultBeSvcPort, } - ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, nil, nil, nil, fakeGCE, defaultNamer, "" /*kubeSystemUID*/, ctxConfig) + ctx := context.NewControllerContext(nil, kubeClient, backendConfigClient, nil, nil, nil, nil, nil, fakeGCE, defaultNamer, "" /*kubeSystemUID*/, ctxConfig) fwc := NewFirewallController(ctx, []string{"30000-32767"}) fwc.hasSynced = func() bool { return true } diff --git a/pkg/l4lb/l4controller_test.go b/pkg/l4lb/l4controller_test.go index 8d5dd0130b..60fdcc6afd 100644 --- a/pkg/l4lb/l4controller_test.go +++ b/pkg/l4lb/l4controller_test.go @@ -759,7 +759,7 @@ func newServiceController(t *testing.T, fakeGCE *gce.Cloud) *L4Controller { ResyncPeriod: 1 * time.Minute, NumL4Workers: 5, } - ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) + ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) // Add some nodes so that NEG linker kicks in during ILB creation. nodes, err := test.CreateAndInsertNodes(ctx.Cloud, []string{"instance-1"}, vals.ZoneName) if err != nil { diff --git a/pkg/l4lb/l4netlbcontroller_test.go b/pkg/l4lb/l4netlbcontroller_test.go index 172ee81d47..a4d2292425 100644 --- a/pkg/l4lb/l4netlbcontroller_test.go +++ b/pkg/l4lb/l4netlbcontroller_test.go @@ -232,7 +232,7 @@ func buildContext(vals gce.TestClusterValues) *ingctx.ControllerContext { NumL4NetLBWorkers: 5, MaxIGSize: 1000, } - return ingctx.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) + return ingctx.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, nil, nil, fakeGCE, namer, "" /*kubeSystemUID*/, ctxConfig) } func newL4NetLBServiceController() *L4NetLBController { diff --git a/pkg/psc/controller_test.go b/pkg/psc/controller_test.go index 9717ac6037..3227401be5 100644 --- a/pkg/psc/controller_test.go +++ b/pkg/psc/controller_test.go @@ -1094,7 +1094,7 @@ func newTestController(clusterType string) *Controller { flags.F.GKEClusterName = ClusterName flags.F.GKEClusterType = clusterType - ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, saClient, gceClient, resourceNamer, kubeSystemUID, ctxConfig) + ctx := context.NewControllerContext(nil, kubeClient, nil, nil, nil, nil, saClient, nil, gceClient, resourceNamer, kubeSystemUID, ctxConfig) return NewController(ctx) } diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/LICENSE b/vendor/k8s.io/cloud-provider-gcp/crd/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/LICENSE @@ -0,0 +1,202 @@ + + 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/k8s.io/cloud-provider-gcp/crd/apis/network/v1/annotations.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/annotations.go new file mode 100644 index 0000000000..c7bfa4f976 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/annotations.go @@ -0,0 +1,179 @@ +package v1 + +import ( + "encoding/json" + "fmt" +) + +// Annotation definitions. +const ( + // DisableSourceValidationAnnotationKey is the annotation on pod to disable source IP validation on L2 interfaces. + // Useful when you want to assign new IPs onto the interface. + DisableSourceIPValidationAnnotationKey = "networking.gke.io/disable-source-ip-validation" + // DisableSourceValidationAnnotationValTrue is the value to disable source IP validation for the pod. + DisableSourceIPValidationAnnotationValTrue = "true" + // EnableMulticastAnnotationKey is the annotation on pod to enable multicast on L2 interfaces. + // It's also used to enable IGMP protocol for L2 interfaces. + EnableMulticastAnnotationKey = "networking.gke.io/enable-multicast" + // EnableMulticastAnnotationValTrue is the value to enable multicast for the pod. + EnableMulticastAnnotationValTrue = "true" + // DefaultInterfaceAnnotationKey specifies the default route interface with interface name in pod. + // The IP of the gateway comes from network CRs. + DefaultInterfaceAnnotationKey = "networking.gke.io/default-interface" + // InterfaceAnnotationKey specifies interfaces for pod. + InterfaceAnnotationKey = "networking.gke.io/interfaces" + // NodeNetworkAnnotationKey is the key of the annotation which indicates the status of + // networks on the node. + NodeNetworkAnnotationKey = "networking.gke.io/network-status" + // PodIPsAnnotationKey is the key of the annotation which indicates additional pod IPs assigned to the pod. + PodIPsAnnotationKey = "networking.gke.io/pod-ips" + // NetworkAnnotationKey is the network annotation on NetworkPolicy object. + // Value for this key will be the network on which network policy should be enforced. + NetworkAnnotationKey = "networking.gke.io/network" + // NetworkInUseAnnotationKey is the annotation on Network object. + // It's used to indicate if the Network object is referenced by NetworkInterface/pod objects. + NetworkInUseAnnotationKey = "networking.gke.io/in-use" + // NetworkInUseAnnotationValTrue is the value to be set for NetworkInUseAnnotationKey to indicate + // the Network object is referenced by at least one NetworkInterface/pod object. + NetworkInUseAnnotationValTrue = "true" + // MultiNetworkAnnotationKey is the network annotation key used to hold network data per node, eg: PodCIDRs. + MultiNetworkAnnotationKey = "networking.gke.io/networks" + // AutoGenAnnotationKey is to indicate if the object is auto-generated. + AutoGenAnnotationKey = "networking.gke.io/auto-generated" + // AutoGenAnnotationValTrue is the value to be set for auto-generated objects. + AutoGenAnnotationValTrue = "true" + // NorthInterfacesAnnotationKey is the annotation key used to hold interfaces data per node. + NorthInterfacesAnnotationKey = "networking.gke.io/north-interfaces" +) + +// InterfaceAnnotation is the value of the interface annotation. +// +kubebuilder:object:generate:=false +type InterfaceAnnotation []InterfaceRef + +// InterfaceRef specifies the reference to network interface. +// All fields are mutual exclusive. +// Either Network or Interface field can be specified. +// +kubebuilder:object:generate:=false +type InterfaceRef struct { + // InterfaceName is the name of the interface in pod network namespace. + InterfaceName string `json:"interfaceName,omitempty"` + // Network refers to a network object within the cluster. + // When network is specified, NetworkInterface object is optionally generated with default configuration. + Network *string `json:"network,omitempty"` + // Interface reference the NetworkInterface object within the namespace. + Interface *string `json:"interface,omitempty"` +} + +// ParseInterfaceAnnotation parses the given annotation. +func ParseInterfaceAnnotation(annotation string) (InterfaceAnnotation, error) { + ret := &InterfaceAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// MarshalAnnotation marshals any object into string using json.Marshal. +func MarshalAnnotation(a interface{}) (string, error) { + ret, err := json.Marshal(a) + if err != nil { + return "", fmt.Errorf("failed to marshal (%+v): %v", a, err) + } + return string(ret), nil +} + +// NodeNetworkAnnotation is the value of the network status annotation. +// +kubebuilder:object:generate:=false +type NodeNetworkAnnotation []NodeNetworkStatus + +// PodIPsAnnotation is the value of the pod IPs annotation. +// +kubebuilder:object:generate:=false +type PodIPsAnnotation []PodIP + +// MultiNetworkAnnotation is the value of networks annotation. +// +kubebuilder:object:generate:=false +type MultiNetworkAnnotation []NodeNetwork + +// NorthInterfacesAnnotation is the value of north-interfaces annotation. +// +kubebuilder:object:generate:=false +type NorthInterfacesAnnotation []NorthInterface + +// NodeNetworkStatus specifies the status of a network. +// +kubebuilder:object:generate:=false +type NodeNetworkStatus struct { + // Name specifies the name of the network. + Name string `json:"name,omitempty"` + + // IPv4Subnet is the Node internal IPv4 subnet for the network. + IPv4Subnet string `json:"ipv4-subnet,omitempty"` + + // IPv6Subnet is the Node internal IPv6 subnet for the network. + IPv6Subnet string `json:"ipv6-subnet,omitempty"` +} + +// PodIP specifies the additional pod IPs assigned to the pod. +// This will eventually be merged into the `podIPs` field in PodStatus, so the fields must remain compatible. +// +kubebuilder:object:generate:=false +type PodIP struct { + // NetworkName refers to the network object associated with this IP. + NetworkName string `json:"networkName"` + + // IP is an IP address (IPv4 or IPv6) assigned to the pod. + IP string `json:"ip"` +} + +// NodeNetwork specifies network data on a node. +// +kubebuilder:object:generate:=false +type NodeNetwork struct { + // Name specifies the name of the network. + Name string `json:"name"` + // Cidrs denotes the IPv4/IPv6 ranges of the network. + Cidrs []string `json:"cidrs"` + // Scope specifies if the network is local to a node or global across a node pool. + Scope string `json:"scope"` +} + +// NorthInterface specifies interface data on a node. +// +kubebuilder:object:generate:=false +type NorthInterface struct { + // Name of the network an interface on node is connected to. + Network string `json:"network"` + // IP address of the interface. + IpAddress string `json:"ipAddress"` +} + +// ParseNodeNetworkAnnotation parses the given annotation to NodeNetworkAnnotation. +func ParseNodeNetworkAnnotation(annotation string) (NodeNetworkAnnotation, error) { + ret := &NodeNetworkAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// ParsePodIPsAnnotation parses the given annotation to PodIPsAnnotation. +func ParsePodIPsAnnotation(annotation string) (PodIPsAnnotation, error) { + ret := &PodIPsAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// ParseMultiNetworkAnnotation parses given annotation to MultiNetworkAnnotation. +func ParseMultiNetworkAnnotation(annotation string) (MultiNetworkAnnotation, error) { + ret := &MultiNetworkAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// ParseNorthInterfacesAnnotation parses given annotation to NorthInterfacesAnnotation. +func ParseNorthInterfacesAnnotation(annotation string) (NorthInterfacesAnnotation, error) { + ret := &NorthInterfacesAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// MarshalNodeNetworkAnnotation marshals a NodeNetworkAnnotation into string. +func MarshalNodeNetworkAnnotation(a NodeNetworkAnnotation) (string, error) { + return MarshalAnnotation(a) +} + +// MarshalNorthInterfacesAnnotation marshals a NorthInterfacesAnnotation into string. +func MarshalNorthInterfacesAnnotation(a NorthInterfacesAnnotation) (string, error) { + return MarshalAnnotation(a) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/doc.go new file mode 100644 index 0000000000..3dce63d3d0 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2022 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. +*/ + +// Package v1 is the v1 version of the API. +// +kubebuilder:object:generate=true +// +groupName=networking.gke.io +package v1 diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network.go new file mode 100644 index 0000000000..44cc420ac8 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network.go @@ -0,0 +1,19 @@ +package v1 + +// DefaultNetworkIfEmpty takes a string corresponding to a network name and makes +// sure that if it is empty then it is set to the default network. This comes +// from the idea that a network is like a namespace, where an empty network is +// the same as the default. Use before comparisons of networks. +func DefaultNetworkIfEmpty(s string) string { + if s == "" { + return DefaultPodNetworkName + } + return s +} + +// IsDefaultNetwork takes a network name and returns if it is a default network. +// Both DefaultNetworkName and DefaultPodNetworkName are considered as default network for compatibility purposes. +// DefaultNetworkName will eventually be removed. +func IsDefaultNetwork(networkName string) bool { + return networkName == DefaultNetworkName || networkName == DefaultPodNetworkName +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network_types.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network_types.go new file mode 100644 index 0000000000..2d1d9a9fa0 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/network_types.go @@ -0,0 +1,205 @@ +package v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // DefaultNetworkName is the network used by the VETH interface. + DefaultNetworkName = "pod-network" + // DefaultPodNetworkName is the network used by the VETH interface. + // This is same as DefaultNetworkName except for a different name. DefaultNetworkName will be eventually deprecated. + DefaultPodNetworkName = "default" + // NetworkResourceKeyPrefix is the prefix for extended resource + // name corresponding to the network. + // e.g. "networking.gke.io.networks/my-network.IP" + NetworkResourceKeyPrefix = "networking.gke.io.networks/" +) + +// NetworkType is the type of network. +// +kubebuilder:validation:Enum=L2;L3;Device +type NetworkType string + +const ( + // L2NetworkType enables L2 connectivity on the network. + L2NetworkType NetworkType = "L2" + // L3NetworkType enables L3 connectivity on the network. + L3NetworkType NetworkType = "L3" + // DeviceNetworkType enables direct device access on the network. + DeviceNetworkType NetworkType = "Device" +) + +// LifecycleType defines who manages the lifecycle of the network. +// +kubebuilder:validation:Enum=AnthosManaged;UserManaged +type LifecycleType string + +const ( + // AnthosManagedLifecycle indicates that the Anthos will manage the Network + // lifecycle. + AnthosManagedLifecycle LifecycleType = "AnthosManaged" + // UserManaged indicates that the user will manage the Network + // Lifeycle and Anthos will not create or delete the network. + UserManagedLifecycle LifecycleType = "UserManaged" +) + +// ProviderType defines provider of the network. +// +kubebuilder:validation:Enum=GKE +type ProviderType string + +const ( + // GKE indicates network provider is "GKE" + GKE ProviderType = "GKE" +) + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:storageversion +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Network represent a logical network on the K8s Cluster. +// This logical network depends on the host networking setup on cluster nodes. +type Network struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NetworkSpec `json:"spec,omitempty"` + Status NetworkStatus `json:"status,omitempty"` +} + +// NetworkSpec contains the specifications for network object +type NetworkSpec struct { + // Type defines type of network. + // Valid options include: L2, L3, Device. + // L2 network type enables L2 connectivity on the network. + // L3 network type enables L3 connectivity on the network. + // Device network type enables direct device access on the network. + // +required + Type NetworkType `json:"type"` + + // Provider specifies the provider implementing this network, e.g. "GKE". + Provider *ProviderType `json:"provider,omitempty"` + + // NodeInterfaceMatcher defines the matcher to discover the corresponding node interface associated with the network. + // This field is required for L2 network. + // +optional + NodeInterfaceMatcher NodeInterfaceMatcher `json:"nodeInterfaceMatcher,omitempty"` + + // L2NetworkConfig includes all the network config related to L2 type network + // +optional + L2NetworkConfig *L2NetworkConfig `json:"l2NetworkConfig,omitempty"` + + // NetworkLifecycle specifies who manages the lifecycle of the network. + // This field can only be used when L2NetworkConfig.VlanID is specified. Otherwise the value will be ignored. If + // L2NetworkConfig.VlanID is specified and this field is empty, the value is assumed to be AnthosManaged. + // +optional + NetworkLifecycle *LifecycleType `json:"networkLifecycle,omitempty"` + + // Routes contains a list of routes for the network. + // +optional + Routes []Route `json:"routes,omitempty"` + + // Gateway4 defines the gateway IPv4 address for the network. + // Required if ExternalDHCP4 is false or not set on L2 type network. + // +optional + Gateway4 *string `json:"gateway4,omitempty"` + + // Specifies the DNS configuration of the network. + // Required if ExternalDHCP4 is false or not set on L2 type network. + // +optional + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + + // ExternalDHCP4 indicates whether the IPAM is static or allocation by the external DHCP server + // +optional + ExternalDHCP4 *bool `json:"externalDHCP4,omitempty"` + + // ParametersRef is a reference to a resource that contains vendor or implementation specific + // configurations for the network. + // +optional + ParametersRef *NetworkParametersReference `json:"parametersRef,omitempty"` +} + +// NetworkParametersReference identifies an API object containing additional parameters for the network. +type NetworkParametersReference struct { + // Group is the API group of k8s resource, e.g. "networking.k8s.io". + Group string `json:"group"` + + // Kind is kind of the referent, e.g. "networkpolicy". + Kind string `json:"kind"` + + // Name is the name of the resource object. + Name string `json:"name"` + + // Namespace is the namespace of the referent. This field is required when referring to a + // Namespace-scoped resource and MUST be unset when referring to a Cluster-scoped resource. + // +optional + Namespace *string `json:"namespace,omitempty"` +} + +// DNSConfig defines the DNS configuration of a network. +// The fields follow k8s pod dnsConfig structure: +// https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L3555 +type DNSConfig struct { + // A list of nameserver IP addresses. + // Duplicated nameservers will be removed. + // +required + // +kubebuilder:validation:MinItems:=1 + Nameservers []string `json:"nameservers"` + // A list of DNS search domains for host-name lookup. + // Duplicated search paths will be removed. + // +optional + Searches []string `json:"searches,omitempty"` +} + +// Route defines a routing table entry to a specific subnetwork. +type Route struct { + // To defines a destination IPv4 block in CIDR annotation. e.g. 192.168.0.0/24. + // The CIDR 0.0.0.0/0 will be rejected. + // +required + To string `json:"to"` +} + +// NetworkStatus contains the status information related to the network. +type NetworkStatus struct{} + +// NodeInterfaceMatcher defines criteria to find the matching interface on host networking. +type NodeInterfaceMatcher struct { + // InterfaceName specifies the interface name to search on the node. + // +kubebuilder:validation:MinLength=1 + // +optional + InterfaceName *string `json:"interfaceName,omitempty"` +} + +// L2NetworkConfig contains configurations for L2 type network. +type L2NetworkConfig struct { + // VlanID is the vlan ID used for the network. + // If unspecified, vlan tagging is not enabled. + // +optional + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=1 + VlanID *int32 `json:"vlanID,omitempty"` + // PrefixLength4 denotes the IPv4 prefix length of the range + // corresponding to the network. It is used to assign IPs to the pods for + // multi-networking. This field is required when IPAM is handled internally and dynamically + // via CCC. It's disallowed for other cases. For static IP, the prefix length is set as + // part of the address in NetworkInterface object. + // +optional + // +kubebuilder:validation:Maximum=32 + // +kubebuilder:validation:Minimum=1 + PrefixLength4 *int32 `json:"prefixLength4,omitempty"` +} + +// +genclient +// +genclient:nonNamespaced +// +genclient:onlyVerbs=get +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkList contains a list of Network resources. +type NetworkList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a slice of Network resources. + Items []Network `json:"items"` +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/networkinterface_types.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/networkinterface_types.go new file mode 100644 index 0000000000..dc6edadf9a --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/networkinterface_types.go @@ -0,0 +1,80 @@ +package v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="The age of this resource" +// +kubebuilder:printcolumn:name="IP",type="string",JSONPath=".status.ipAddresses[0]",description="IP address assigned to this interface" +// +kubebuilder:printcolumn:name="MAC",type="string",JSONPath=".status.macAddress",description="MAC address assigned to this interface" +// +kubebuilder:printcolumn:name="NETWORK",type="string",JSONPath=".spec.networkName",description="The Network this interface connects to" +// +kubebuilder:storageversion +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkInterface defines the network interface for a pod to connect to a network. +type NetworkInterface struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NetworkInterfaceSpec `json:"spec,omitempty"` + Status NetworkInterfaceStatus `json:"status,omitempty"` +} + +// NetworkInterfaceSpec is the specification for the NetworkInterface resource. +type NetworkInterfaceSpec struct { + // NetworkName refers to a network object that this NetworkInterface is connected. + // +required + // +kubebuilder:validation:MinLength=1 + NetworkName string `json:"networkName"` + + // IpAddresses specifies the static IP addresses on this NetworkInterface. + // Each IPAddress may contain subnet mask. If subnet mask is not included, /32 is taken as default. + // For example, IPAddress input 1.2.3.4 will be taken as 1.2.3.4/32. Alternatively, the input can be 1.2.3.4/24 + // with subnet mask of /24. + // +optional + IpAddresses []string `json:"ipAddresses,omitempty"` + + // Macddress specifies the static MAC address on this NetworkInterface. + // +optional + MacAddress *string `json:"macAddress,omitempty"` +} + +// NetworkInterfaceStatus is the status for the NetworkInterface resource. +type NetworkInterfaceStatus struct { + // IpAddresses are the IP addresses assigned to the NetworkInterface. + IpAddresses []string `json:"ipAddresses,omitempty"` + // MacAddress is the MAC address assigned to the NetworkInterface. + MacAddress string `json:"macAddress,omitempty"` + + // Routes contains a list of routes for the network this interface connects to. + Routes []Route `json:"routes,omitempty"` + + // Gateway4 defines the gateway IPv4 address for the network this interface connects to. + Gateway4 *string `json:"gateway4,omitempty"` + + // Specifies the DNS configuration of the network this interface connects to. + // +optional + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + + // PodName specifies the current pod name this interface is connected to + // +optional + PodName *string `json:"podName,omitempty"` + + //// Conditions include the the conditions associated with this Interface + // Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +genclient +// +genclient:onlyVerbs=get +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkInterfaceList contains a list of NetworkInterface resources. +type NetworkInterfaceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a slice of NetworkInterface resources. + Items []NetworkInterface `json:"items"` +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.deepcopy.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..6311174fac --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.deepcopy.go @@ -0,0 +1,385 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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 controller-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DNSConfig) DeepCopyInto(out *DNSConfig) { + *out = *in + if in.Nameservers != nil { + in, out := &in.Nameservers, &out.Nameservers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Searches != nil { + in, out := &in.Searches, &out.Searches + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSConfig. +func (in *DNSConfig) DeepCopy() *DNSConfig { + if in == nil { + return nil + } + out := new(DNSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *L2NetworkConfig) DeepCopyInto(out *L2NetworkConfig) { + *out = *in + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.PrefixLength4 != nil { + in, out := &in.PrefixLength4, &out.PrefixLength4 + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L2NetworkConfig. +func (in *L2NetworkConfig) DeepCopy() *L2NetworkConfig { + if in == nil { + return nil + } + out := new(L2NetworkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Network) DeepCopyInto(out *Network) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network. +func (in *Network) DeepCopy() *Network { + if in == nil { + return nil + } + out := new(Network) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Network) 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 *NetworkInterface) DeepCopyInto(out *NetworkInterface) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterface. +func (in *NetworkInterface) DeepCopy() *NetworkInterface { + if in == nil { + return nil + } + out := new(NetworkInterface) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkInterface) 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 *NetworkInterfaceList) DeepCopyInto(out *NetworkInterfaceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetworkInterface, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceList. +func (in *NetworkInterfaceList) DeepCopy() *NetworkInterfaceList { + if in == nil { + return nil + } + out := new(NetworkInterfaceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkInterfaceList) 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 *NetworkInterfaceSpec) DeepCopyInto(out *NetworkInterfaceSpec) { + *out = *in + if in.IpAddresses != nil { + in, out := &in.IpAddresses, &out.IpAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.MacAddress != nil { + in, out := &in.MacAddress, &out.MacAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceSpec. +func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec { + if in == nil { + return nil + } + out := new(NetworkInterfaceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkInterfaceStatus) DeepCopyInto(out *NetworkInterfaceStatus) { + *out = *in + if in.IpAddresses != nil { + in, out := &in.IpAddresses, &out.IpAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.Gateway4 != nil { + in, out := &in.Gateway4, &out.Gateway4 + *out = new(string) + **out = **in + } + if in.DNSConfig != nil { + in, out := &in.DNSConfig, &out.DNSConfig + *out = new(DNSConfig) + (*in).DeepCopyInto(*out) + } + if in.PodName != nil { + in, out := &in.PodName, &out.PodName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceStatus. +func (in *NetworkInterfaceStatus) DeepCopy() *NetworkInterfaceStatus { + if in == nil { + return nil + } + out := new(NetworkInterfaceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkList) DeepCopyInto(out *NetworkList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Network, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkList. +func (in *NetworkList) DeepCopy() *NetworkList { + if in == nil { + return nil + } + out := new(NetworkList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkList) 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 *NetworkParametersReference) DeepCopyInto(out *NetworkParametersReference) { + *out = *in + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkParametersReference. +func (in *NetworkParametersReference) DeepCopy() *NetworkParametersReference { + if in == nil { + return nil + } + out := new(NetworkParametersReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { + *out = *in + if in.Provider != nil { + in, out := &in.Provider, &out.Provider + *out = new(ProviderType) + **out = **in + } + in.NodeInterfaceMatcher.DeepCopyInto(&out.NodeInterfaceMatcher) + if in.L2NetworkConfig != nil { + in, out := &in.L2NetworkConfig, &out.L2NetworkConfig + *out = new(L2NetworkConfig) + (*in).DeepCopyInto(*out) + } + if in.NetworkLifecycle != nil { + in, out := &in.NetworkLifecycle, &out.NetworkLifecycle + *out = new(LifecycleType) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.Gateway4 != nil { + in, out := &in.Gateway4, &out.Gateway4 + *out = new(string) + **out = **in + } + if in.DNSConfig != nil { + in, out := &in.DNSConfig, &out.DNSConfig + *out = new(DNSConfig) + (*in).DeepCopyInto(*out) + } + if in.ExternalDHCP4 != nil { + in, out := &in.ExternalDHCP4, &out.ExternalDHCP4 + *out = new(bool) + **out = **in + } + if in.ParametersRef != nil { + in, out := &in.ParametersRef, &out.ParametersRef + *out = new(NetworkParametersReference) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. +func (in *NetworkSpec) DeepCopy() *NetworkSpec { + if in == nil { + return nil + } + out := new(NetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkStatus) DeepCopyInto(out *NetworkStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkStatus. +func (in *NetworkStatus) DeepCopy() *NetworkStatus { + if in == nil { + return nil + } + out := new(NetworkStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeInterfaceMatcher) DeepCopyInto(out *NodeInterfaceMatcher) { + *out = *in + if in.InterfaceName != nil { + in, out := &in.InterfaceName, &out.InterfaceName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeInterfaceMatcher. +func (in *NodeInterfaceMatcher) DeepCopy() *NodeInterfaceMatcher { + if in == nil { + return nil + } + out := new(NodeInterfaceMatcher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.register.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.register.go new file mode 100644 index 0000000000..77b0f345c5 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1/zz_generated.register.go @@ -0,0 +1,69 @@ +/* +Copyright 2023 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 register-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "networking.gke.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: 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 + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = 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 Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Network{}, + &NetworkInterface{}, + &NetworkInterfaceList{}, + &NetworkList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/annotations.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/annotations.go new file mode 100644 index 0000000000..ea8cbe2a04 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/annotations.go @@ -0,0 +1,89 @@ +package v1alpha1 + +import ( + "encoding/json" + "fmt" +) + +// Annotations on pods. +const ( + // DisableSourceValidationAnnotationKey is the annotation on pod to disable source IP validation on L2 interfaces. + // Useful when you want to assign new IPs onto the interface. + DisableSourceIPValidationAnnotationKey = "networking.gke.io/disable-source-ip-validation" + // DisableSourceValidationAnnotationValTrue is the value to disable source IP validation for the pod. + DisableSourceIPValidationAnnotationValTrue = "true" + // DefaultInterfaceAnnotationKey specifies the default route interface with interface name in pod. + // The IP of the gateway comes from network CRs. + DefaultInterfaceAnnotationKey = "networking.gke.io/default-interface" + // InterfaceAnnotationKey specifies interfaces for pod. + InterfaceAnnotationKey = "networking.gke.io/interfaces" + // NodeNetworkAnnotationKey is the key of the annotation which indicates the status of + // networks on the node. + NodeNetworkAnnotationKey = "networking.gke.io/network-status" + // NetworkAnnotationKey is the network annotation on NetworkPolicy object. + // Value for this key will be the network on which network policy should be enforced. + NetworkAnnotationKey = "networking.gke.io/network" + // NetworkInUseAnnotationKey is the annotation on Network object. + // It's used to indicate if the Network object is referenced by NetworkInterface/pod objects. + NetworkInUseAnnotationKey = "networking.gke.io/in-use" + // NetworkInUseAnnotationValTrue is the value to be set for NetworkInUseAnnotationKey to indicate + // the Network object is referenced by at least one NetworkInterface/pod object. + NetworkInUseAnnotationValTrue = "true" +) + +// InterfaceAnnotation is the value of the interface annotation. +// +kubebuilder:object:generate:=false +type InterfaceAnnotation []InterfaceRef + +// InterfaceRef specifies the reference to network interface. +// All fields are mutual exclusive. +// Either Network or Interface field can be specified. +// +kubebuilder:object:generate:=false +type InterfaceRef struct { + // InterfaceName is the name of the interface in pod network namespace. + InterfaceName string `json:"interfaceName,omitempty"` + // Network refers to a network object within the cluster. + // When network is specified, NetworkInterface object is optionally generated with default configuration. + Network *string `json:"network,omitempty"` + // Interface reference the NetworkInterface object within the namespace. + Interface *string `json:"interface,omitempty"` +} + +// ParseInterfaceAnnotation parses the given annotation. +func ParseInterfaceAnnotation(annotation string) (InterfaceAnnotation, error) { + ret := &InterfaceAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// MarshalAnnotation marshals any object into string using json.Marshal. +func MarshalAnnotation(a interface{}) (string, error) { + ret, err := json.Marshal(a) + if err != nil { + return "", fmt.Errorf("failed to marshal (%+v): %v", a, err) + } + return string(ret), nil +} + +// NodeNetworkAnnotation is the value of the network status annotation. +// +kubebuilder:object:generate:=false +type NodeNetworkAnnotation []NodeNetworkStatus + +// NodeNetworkStatus specifies the status of a network. +// +kubebuilder:object:generate:=false +type NodeNetworkStatus struct { + // Name specifies the name of the network. + Name string `json:"name,omitempty"` +} + +// ParseNodeNetworkAnnotation parses the given annotation to NodeNetworkAnnotation. +func ParseNodeNetworkAnnotation(annotation string) (NodeNetworkAnnotation, error) { + ret := &NodeNetworkAnnotation{} + err := json.Unmarshal([]byte(annotation), ret) + return *ret, err +} + +// MarshalNodeNetworkAnnotation marshals a NodeNetworkAnnotation into string. +func MarshalNodeNetworkAnnotation(a NodeNetworkAnnotation) (string, error) { + return MarshalAnnotation(a) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/doc.go new file mode 100644 index 0000000000..4533dfb365 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2022 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. +*/ + +// Package v1alpha is the v1alpha version of the API. +// +kubebuilder:object:generate=true +// +groupName=networking.gke.io +package v1alpha1 diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/gkenetworkparamset_types.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/gkenetworkparamset_types.go new file mode 100644 index 0000000000..48a179ce05 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/gkenetworkparamset_types.go @@ -0,0 +1,87 @@ +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:storageversion +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GKENetworkParamSet represent GKE specific parameters for the network. +type GKENetworkParamSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec GKENetworkParamSetSpec `json:"spec,omitempty"` + Status GKENetworkParamSetStatus `json:"status,omitempty"` +} + +// DeviceModeType defines mode in which the devices will be used by the Pod +// +kubebuilder:validation:Enum=DPDK-VFIO;NetDevice +type DeviceModeType string + +const ( + // DPDKVFIO indicates that NICs are bound to vfio-pci driver + DPDKVFIO DeviceModeType = "DPDK-VFIO" + // NetDevice indicates that NICs are bound to kernel driver and used as net device + NetDevice DeviceModeType = "NetDevice" +) + +// SecondaryRanges represents ranges of network addresses. +type SecondaryRanges struct { + // +kubebuilder:validation:MinItems:=1 + RangeNames []string `json:"rangeNames"` +} + +// GKENetworkParamSetSpec contains the specifications for network object +type GKENetworkParamSetSpec struct { + // VPC speficies the VPC to which the network belongs. + // +required + VPC string `json:"vpc"` + + // VPCSubnet is the path of the VPC subnet + // +required + VPCSubnet string `json:"vpcSubnet"` + + // DeviceMode indicates the mode in which the devices will be used by the Pod. + // This field is required and valid only for "Device" typed network + // +optional + DeviceMode DeviceModeType `json:"deviceMode"` + + // PodIPv4Ranges specify the names of the secondary ranges of the VPC subnet + // used to allocate pod IPs for the network. + // This field is required and valid only for L3 typed network + // +optional + PodIPv4Ranges *SecondaryRanges `json:"podIPv4Ranges,omitempty"` +} + +// NetworkRanges represents ranges of network addresses. +type NetworkRanges struct { + // +kubebuilder:validation:MinItems:=1 + CIDRBlocks []string `json:"cidrBlocks"` +} + +// GKENetworkParamSetStatus contains the status information related to the network. +type GKENetworkParamSetStatus struct { + // PodCIDRs specifies the CIDRs from which IPs will be used for Pod interfaces + // +optional + PodCIDRs *NetworkRanges `json:"podCIDRs,omitempty"` +} + +// +genclient +// +genclient:nonNamespaced +// +genclient:onlyVerbs=get +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GKENetworkParamSetList contains a list of GKENetworkParamSet resources. +type GKENetworkParamSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a slice of GKENetworkParamset resources. + Items []GKENetworkParamSet `json:"items"` +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network.go new file mode 100644 index 0000000000..3f12f1b64e --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network.go @@ -0,0 +1,19 @@ +package v1alpha1 + +import "fmt" + +// InterfaceName returns the expected host interface for this Network +// If vlanID is specified, the expected tagged interface Name is returned +// otherwise the user specified interfaceName is returned +func (n *Network) InterfaceName() (string, error) { + if n.Spec.NodeInterfaceMatcher.InterfaceName == nil || *n.Spec.NodeInterfaceMatcher.InterfaceName == "" { + return "", fmt.Errorf("invalid network %s: network.spec.nodeInterfaceMatcher.InterfaceName cannot be nil or empty", n.Name) + } + hostInterface := n.Spec.NodeInterfaceMatcher.InterfaceName + + if n.Spec.L2NetworkConfig == nil || n.Spec.L2NetworkConfig.VlanID == nil { + return *hostInterface, nil + } + + return fmt.Sprintf("%s.%d", *hostInterface, *n.Spec.L2NetworkConfig.VlanID), nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network_types.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network_types.go new file mode 100644 index 0000000000..d94cd56e13 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/network_types.go @@ -0,0 +1,154 @@ +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // DefaultNetworkName is the network used by the VETH interface. + DefaultNetworkName = "pod-network" +) + +// NetworkType is the type of network. +// +kubebuilder:validation:Enum=L2;L3;Device +type NetworkType string + +const ( + // L2NetworkType enables L2 connectivity on the network. + L2NetworkType NetworkType = "L2" + // L3NetworkType enables L3 connectivity on the network. + L3NetworkType NetworkType = "L3" + // DeviceNetworkType enables direct device access on the network. + DeviceNetworkType NetworkType = "Device" +) + +// LifecycleType defines who manages the lifecycle of the network. +// +kubebuilder:validation:Enum=AnthosManaged;UserManaged +type LifecycleType string + +const ( + // AnthosManagedLifecycle indicates that the Anthos will manage the Network + // lifecycle. + AnthosManagedLifecycle LifecycleType = "AnthosManaged" + // UserManaged indicates that the user will manage the Network + // Lifeycle and Anthos will not create or delete the network. + UserManagedLifecycle LifecycleType = "UserManaged" +) + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Network represent a logical network on the K8s Cluster. +// This logical network depends on the host networking setup on cluster nodes. +type Network struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NetworkSpec `json:"spec,omitempty"` + Status NetworkStatus `json:"status,omitempty"` +} + +// NetworkSpec contains the specifications for network object +type NetworkSpec struct { + // Type defines type of network. + // Valid options include: L2, L3, Device. + // L2 network type enables L2 connectivity on the network. + // L3 network type enables L3 connectivity on the network. + // Device network type enables direct device access on the network. + // +required + Type NetworkType `json:"type"` + + // NodeInterfaceMatcher defines the matcher to discover the corresponding node interface associated with the network. + // This field is required for L2 network. + // +optional + NodeInterfaceMatcher NodeInterfaceMatcher `json:"nodeInterfaceMatcher,omitempty"` + + // L2NetworkConfig includes all the network config related to L2 type network + // +optional + L2NetworkConfig *L2NetworkConfig `json:"l2NetworkConfig,omitempty"` + + // NetworkLifecycle specifies who manages the lifecycle of the network. + // This field can only be used when L2NetworkConfig.VlanID is specified. Otherwise the value will be ignored. If + // L2NetworkConfig.VlanID is specified and this field is empty, the value is assumed to be AnthosManaged. + // +optional + NetworkLifecycle *LifecycleType `json:"networkLifecycle,omitempty"` + + // Routes contains a list of routes for the network. + // +optional + Routes []Route `json:"routes,omitempty"` + + // Gateway4 defines the gateway IPv4 address for the network. + // Required if ExternalDHCP4 is false or not set on L2 type network. + // +optional + Gateway4 *string `json:"gateway4,omitempty"` + + // Specifies the DNS configuration of the network. + // Required if ExternalDHCP4 is false or not set on L2 type network. + // +optional + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + + // ExternalDHCP4 indicates whether the IPAM is static or allocation by the external DHCP server + // +optional + ExternalDHCP4 *bool `json:"externalDHCP4,omitempty"` +} + +// DNSConfig defines the DNS configuration of a network. +// The fields follow k8s pod dnsConfig structure: +// https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L3555 +type DNSConfig struct { + // A list of nameserver IP addresses. + // Duplicated nameservers will be removed. + // +required + // +kubebuilder:validation:MinItems:=1 + Nameservers []string `json:"nameservers"` + // A list of DNS search domains for host-name lookup. + // Duplicated search paths will be removed. + // +optional + Searches []string `json:"searches,omitempty"` +} + +// Route defines a routing table entry to a specific subnetwork. +type Route struct { + // To defines a destination IPv4 block in CIDR annotation. e.g. 192.168.0.0/24. + // The CIDR 0.0.0.0/0 will be rejected. + // +required + To string `json:"to"` +} + +// NetworkStatus contains the status information related to the network. +type NetworkStatus struct{} + +// NodeInterfaceMatcher defines criteria to find the matching interface on host networking. +type NodeInterfaceMatcher struct { + // InterfaceName specifies the interface name to search on the node. + // +kubebuilder:validation:MinLength=1 + // +optional + InterfaceName *string `json:"interfaceName,omitempty"` +} + +// L2NetworkConfig contains configurations for L2 type network. +type L2NetworkConfig struct { + // VlanID is the vlan ID used for the network. + // If unspecified, vlan tagging is not enabled. + // +optional + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=1 + VlanID *int32 `json:"vlanID,omitempty"` +} + +// +genclient +// +genclient:nonNamespaced +// +genclient:onlyVerbs=get +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkList contains a list of Network resources. +type NetworkList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a slice of Network resources. + Items []Network `json:"items"` +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/networkinterface_types.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/networkinterface_types.go new file mode 100644 index 0000000000..1b0845d4a8 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/networkinterface_types.go @@ -0,0 +1,79 @@ +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="The age of this resource" +// +kubebuilder:printcolumn:name="IP",type="string",JSONPath=".status.ipAddresses[0]",description="IP address assigned to this interface" +// +kubebuilder:printcolumn:name="MAC",type="string",JSONPath=".status.macAddress",description="MAC address assigned to this interface" +// +kubebuilder:printcolumn:name="NETWORK",type="string",JSONPath=".spec.networkName",description="The Network this interface connects to" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkInterface defines the network interface for a pod to connect to a network. +type NetworkInterface struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NetworkInterfaceSpec `json:"spec,omitempty"` + Status NetworkInterfaceStatus `json:"status,omitempty"` +} + +// NetworkInterfaceSpec is the specification for the NetworkInterface resource. +type NetworkInterfaceSpec struct { + // NetworkName refers to a network object that this NetworkInterface is connected. + // +required + // +kubebuilder:validation:MinLength=1 + NetworkName string `json:"networkName"` + + // IpAddresses specifies the static IP addresses on this NetworkInterface. + // Each IPAddress may contain subnet mask. If subnet mask is not included, /32 is taken as default. + // For example, IPAddress input 1.2.3.4 will be taken as 1.2.3.4/32. Alternatively, the input can be 1.2.3.4/24 + // with subnet mask of /24. + // +optional + IpAddresses []string `json:"ipAddresses,omitempty"` + + // Macddress specifies the static MAC address on this NetworkInterface. + // +optional + MacAddress *string `json:"macAddress,omitempty"` +} + +// NetworkInterfaceStatus is the status for the NetworkInterface resource. +type NetworkInterfaceStatus struct { + // IpAddresses are the IP addresses assigned to the NetworkInterface. + IpAddresses []string `json:"ipAddresses,omitempty"` + // MacAddress is the MAC address assigned to the NetworkInterface. + MacAddress string `json:"macAddress,omitempty"` + + // Routes contains a list of routes for the network this interface connects to. + Routes []Route `json:"routes,omitempty"` + + // Gateway4 defines the gateway IPv4 address for the network this interface connects to. + Gateway4 *string `json:"gateway4,omitempty"` + + // Specifies the DNS configuration of the network this interface connects to. + // +optional + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + + // PodName specifies the current pod name this interface is connected to + // +optional + PodName *string `json:"podName,omitempty"` + + //// Conditions include the the conditions associated with this Interface + // Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +genclient +// +genclient:onlyVerbs=get +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkInterfaceList contains a list of NetworkInterface resources. +type NetworkInterfaceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a slice of NetworkInterface resources. + Items []NetworkInterface `json:"items"` +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..1a987c5915 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,489 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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 controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DNSConfig) DeepCopyInto(out *DNSConfig) { + *out = *in + if in.Nameservers != nil { + in, out := &in.Nameservers, &out.Nameservers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Searches != nil { + in, out := &in.Searches, &out.Searches + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSConfig. +func (in *DNSConfig) DeepCopy() *DNSConfig { + if in == nil { + return nil + } + out := new(DNSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GKENetworkParamSet) DeepCopyInto(out *GKENetworkParamSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKENetworkParamSet. +func (in *GKENetworkParamSet) DeepCopy() *GKENetworkParamSet { + if in == nil { + return nil + } + out := new(GKENetworkParamSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GKENetworkParamSet) 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 *GKENetworkParamSetList) DeepCopyInto(out *GKENetworkParamSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GKENetworkParamSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKENetworkParamSetList. +func (in *GKENetworkParamSetList) DeepCopy() *GKENetworkParamSetList { + if in == nil { + return nil + } + out := new(GKENetworkParamSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GKENetworkParamSetList) 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 *GKENetworkParamSetSpec) DeepCopyInto(out *GKENetworkParamSetSpec) { + *out = *in + if in.PodIPv4Ranges != nil { + in, out := &in.PodIPv4Ranges, &out.PodIPv4Ranges + *out = new(SecondaryRanges) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKENetworkParamSetSpec. +func (in *GKENetworkParamSetSpec) DeepCopy() *GKENetworkParamSetSpec { + if in == nil { + return nil + } + out := new(GKENetworkParamSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GKENetworkParamSetStatus) DeepCopyInto(out *GKENetworkParamSetStatus) { + *out = *in + if in.PodCIDRs != nil { + in, out := &in.PodCIDRs, &out.PodCIDRs + *out = new(NetworkRanges) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKENetworkParamSetStatus. +func (in *GKENetworkParamSetStatus) DeepCopy() *GKENetworkParamSetStatus { + if in == nil { + return nil + } + out := new(GKENetworkParamSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *L2NetworkConfig) DeepCopyInto(out *L2NetworkConfig) { + *out = *in + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L2NetworkConfig. +func (in *L2NetworkConfig) DeepCopy() *L2NetworkConfig { + if in == nil { + return nil + } + out := new(L2NetworkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Network) DeepCopyInto(out *Network) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network. +func (in *Network) DeepCopy() *Network { + if in == nil { + return nil + } + out := new(Network) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Network) 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 *NetworkInterface) DeepCopyInto(out *NetworkInterface) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterface. +func (in *NetworkInterface) DeepCopy() *NetworkInterface { + if in == nil { + return nil + } + out := new(NetworkInterface) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkInterface) 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 *NetworkInterfaceList) DeepCopyInto(out *NetworkInterfaceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetworkInterface, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceList. +func (in *NetworkInterfaceList) DeepCopy() *NetworkInterfaceList { + if in == nil { + return nil + } + out := new(NetworkInterfaceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkInterfaceList) 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 *NetworkInterfaceSpec) DeepCopyInto(out *NetworkInterfaceSpec) { + *out = *in + if in.IpAddresses != nil { + in, out := &in.IpAddresses, &out.IpAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.MacAddress != nil { + in, out := &in.MacAddress, &out.MacAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceSpec. +func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec { + if in == nil { + return nil + } + out := new(NetworkInterfaceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkInterfaceStatus) DeepCopyInto(out *NetworkInterfaceStatus) { + *out = *in + if in.IpAddresses != nil { + in, out := &in.IpAddresses, &out.IpAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.Gateway4 != nil { + in, out := &in.Gateway4, &out.Gateway4 + *out = new(string) + **out = **in + } + if in.DNSConfig != nil { + in, out := &in.DNSConfig, &out.DNSConfig + *out = new(DNSConfig) + (*in).DeepCopyInto(*out) + } + if in.PodName != nil { + in, out := &in.PodName, &out.PodName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceStatus. +func (in *NetworkInterfaceStatus) DeepCopy() *NetworkInterfaceStatus { + if in == nil { + return nil + } + out := new(NetworkInterfaceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkList) DeepCopyInto(out *NetworkList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Network, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkList. +func (in *NetworkList) DeepCopy() *NetworkList { + if in == nil { + return nil + } + out := new(NetworkList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkList) 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 *NetworkRanges) DeepCopyInto(out *NetworkRanges) { + *out = *in + if in.CIDRBlocks != nil { + in, out := &in.CIDRBlocks, &out.CIDRBlocks + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkRanges. +func (in *NetworkRanges) DeepCopy() *NetworkRanges { + if in == nil { + return nil + } + out := new(NetworkRanges) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { + *out = *in + in.NodeInterfaceMatcher.DeepCopyInto(&out.NodeInterfaceMatcher) + if in.L2NetworkConfig != nil { + in, out := &in.L2NetworkConfig, &out.L2NetworkConfig + *out = new(L2NetworkConfig) + (*in).DeepCopyInto(*out) + } + if in.NetworkLifecycle != nil { + in, out := &in.NetworkLifecycle, &out.NetworkLifecycle + *out = new(LifecycleType) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.Gateway4 != nil { + in, out := &in.Gateway4, &out.Gateway4 + *out = new(string) + **out = **in + } + if in.DNSConfig != nil { + in, out := &in.DNSConfig, &out.DNSConfig + *out = new(DNSConfig) + (*in).DeepCopyInto(*out) + } + if in.ExternalDHCP4 != nil { + in, out := &in.ExternalDHCP4, &out.ExternalDHCP4 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. +func (in *NetworkSpec) DeepCopy() *NetworkSpec { + if in == nil { + return nil + } + out := new(NetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkStatus) DeepCopyInto(out *NetworkStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkStatus. +func (in *NetworkStatus) DeepCopy() *NetworkStatus { + if in == nil { + return nil + } + out := new(NetworkStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeInterfaceMatcher) DeepCopyInto(out *NodeInterfaceMatcher) { + *out = *in + if in.InterfaceName != nil { + in, out := &in.InterfaceName, &out.InterfaceName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeInterfaceMatcher. +func (in *NodeInterfaceMatcher) DeepCopy() *NodeInterfaceMatcher { + if in == nil { + return nil + } + out := new(NodeInterfaceMatcher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecondaryRanges) DeepCopyInto(out *SecondaryRanges) { + *out = *in + if in.RangeNames != nil { + in, out := &in.RangeNames, &out.RangeNames + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecondaryRanges. +func (in *SecondaryRanges) DeepCopy() *SecondaryRanges { + if in == nil { + return nil + } + out := new(SecondaryRanges) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.register.go b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.register.go new file mode 100644 index 0000000000..40445f9bfd --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1/zz_generated.register.go @@ -0,0 +1,71 @@ +/* +Copyright 2023 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 register-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "networking.gke.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// 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 + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = 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 Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &GKENetworkParamSet{}, + &GKENetworkParamSetList{}, + &Network{}, + &NetworkInterface{}, + &NetworkInterfaceList{}, + &NetworkList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/clientset.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/clientset.go new file mode 100644 index 0000000000..23aadb7362 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/clientset.go @@ -0,0 +1,133 @@ +/* +Copyright 2023 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" + "net/http" + + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + networkingv1 "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1" + networkingv1alpha1 "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface + NetworkingV1() networkingv1.NetworkingV1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client + networkingV1 *networkingv1.NetworkingV1Client +} + +// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client +func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface { + return c.networkingV1alpha1 +} + +// NetworkingV1 retrieves the NetworkingV1Client +func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { + return c.networkingV1 +} + +// 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. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*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.networkingV1alpha1, err = networkingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.networkingV1, err = networkingv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + 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 { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.networkingV1alpha1 = networkingv1alpha1.New(c) + cs.networkingV1 = networkingv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/doc.go new file mode 100644 index 0000000000..d1411fc84b --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2023 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/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..6aa6c1e434 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2023 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/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/register.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..fa012b2967 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme/register.go @@ -0,0 +1,58 @@ +/* +Copyright 2023 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 ( + 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" + networkingv1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + networkingv1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + networkingv1alpha1.AddToScheme, + networkingv1.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/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/doc.go new file mode 100644 index 0000000000..3f195da749 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2023 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/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/generated_expansion.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/generated_expansion.go new file mode 100644 index 0000000000..7c96bc2f28 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/generated_expansion.go @@ -0,0 +1,27 @@ +/* +Copyright 2023 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 NetworkExpansion interface{} + +type NetworkInterfaceExpansion interface{} + +type NetworkInterfaceListExpansion interface{} + +type NetworkListExpansion interface{} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network.go new file mode 100644 index 0000000000..f8f4941ee7 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network.go @@ -0,0 +1,184 @@ +/* +Copyright 2023 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" + + 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" + v1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworksGetter has a method to return a NetworkInterface. +// A group's client should implement this interface. +type NetworksGetter interface { + Networks() NetworkInterface +} + +// NetworkInterface has methods to work with Network resources. +type NetworkInterface interface { + Create(ctx context.Context, network *v1.Network, opts metav1.CreateOptions) (*v1.Network, error) + Update(ctx context.Context, network *v1.Network, opts metav1.UpdateOptions) (*v1.Network, error) + UpdateStatus(ctx context.Context, network *v1.Network, opts metav1.UpdateOptions) (*v1.Network, 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.Network, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.NetworkList, 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.Network, err error) + NetworkExpansion +} + +// networks implements NetworkInterface +type networks struct { + client rest.Interface +} + +// newNetworks returns a Networks +func newNetworks(c *NetworkingV1Client) *networks { + return &networks{ + client: c.RESTClient(), + } +} + +// Get takes name of the network, and returns the corresponding network object, and an error if there is any. +func (c *networks) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Network, err error) { + result = &v1.Network{} + err = c.client.Get(). + Resource("networks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Networks that match those selectors. +func (c *networks) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NetworkList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.NetworkList{} + err = c.client.Get(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networks. +func (c *networks) 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(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a network and creates it. Returns the server's representation of the network, and an error, if there is any. +func (c *networks) Create(ctx context.Context, network *v1.Network, opts metav1.CreateOptions) (result *v1.Network, err error) { + result = &v1.Network{} + err = c.client.Post(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a network and updates it. Returns the server's representation of the network, and an error, if there is any. +func (c *networks) Update(ctx context.Context, network *v1.Network, opts metav1.UpdateOptions) (result *v1.Network, err error) { + result = &v1.Network{} + err = c.client.Put(). + Resource("networks"). + Name(network.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *networks) UpdateStatus(ctx context.Context, network *v1.Network, opts metav1.UpdateOptions) (result *v1.Network, err error) { + result = &v1.Network{} + err = c.client.Put(). + Resource("networks"). + Name(network.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the network and deletes it. Returns an error if one occurs. +func (c *networks) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("networks"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *networks) 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(). + Resource("networks"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched network. +func (c *networks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Network, err error) { + result = &v1.Network{} + err = c.client.Patch(pt). + Resource("networks"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network_client.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network_client.go new file mode 100644 index 0000000000..138cc9fc83 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/network_client.go @@ -0,0 +1,122 @@ +/* +Copyright 2023 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 ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +type NetworkingV1Interface interface { + RESTClient() rest.Interface + NetworksGetter + NetworkInterfacesGetter + NetworkInterfaceListsGetter + NetworkListsGetter +} + +// NetworkingV1Client is used to interact with features provided by the networking.gke.io group. +type NetworkingV1Client struct { + restClient rest.Interface +} + +func (c *NetworkingV1Client) Networks() NetworkInterface { + return newNetworks(c) +} + +func (c *NetworkingV1Client) NetworkInterfaces(namespace string) NetworkInterfaceInterface { + return newNetworkInterfaces(c, namespace) +} + +func (c *NetworkingV1Client) NetworkInterfaceLists(namespace string) NetworkInterfaceListInterface { + return newNetworkInterfaceLists(c, namespace) +} + +func (c *NetworkingV1Client) NetworkLists() NetworkListInterface { + return newNetworkLists(c) +} + +// NewForConfig creates a new NetworkingV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*NetworkingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new NetworkingV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &NetworkingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new NetworkingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NetworkingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NetworkingV1Client for the given RESTClient. +func New(c rest.Interface) *NetworkingV1Client { + return &NetworkingV1Client{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 *NetworkingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterface.go new file mode 100644 index 0000000000..ce9e5daeca --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterface.go @@ -0,0 +1,195 @@ +/* +Copyright 2023 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" + + 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" + v1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkInterfacesGetter has a method to return a NetworkInterfaceInterface. +// A group's client should implement this interface. +type NetworkInterfacesGetter interface { + NetworkInterfaces(namespace string) NetworkInterfaceInterface +} + +// NetworkInterfaceInterface has methods to work with NetworkInterface resources. +type NetworkInterfaceInterface interface { + Create(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.CreateOptions) (*v1.NetworkInterface, error) + Update(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.UpdateOptions) (*v1.NetworkInterface, error) + UpdateStatus(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.UpdateOptions) (*v1.NetworkInterface, 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.NetworkInterface, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.NetworkInterfaceList, 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.NetworkInterface, err error) + NetworkInterfaceExpansion +} + +// networkInterfaces implements NetworkInterfaceInterface +type networkInterfaces struct { + client rest.Interface + ns string +} + +// newNetworkInterfaces returns a NetworkInterfaces +func newNetworkInterfaces(c *NetworkingV1Client, namespace string) *networkInterfaces { + return &networkInterfaces{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkInterface, and returns the corresponding networkInterface object, and an error if there is any. +func (c *networkInterfaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.NetworkInterface, err error) { + result = &v1.NetworkInterface{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NetworkInterfaces that match those selectors. +func (c *networkInterfaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NetworkInterfaceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.NetworkInterfaceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networkInterfaces. +func (c *networkInterfaces) 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("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a networkInterface and creates it. Returns the server's representation of the networkInterface, and an error, if there is any. +func (c *networkInterfaces) Create(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.CreateOptions) (result *v1.NetworkInterface, err error) { + result = &v1.NetworkInterface{} + err = c.client.Post(). + Namespace(c.ns). + Resource("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a networkInterface and updates it. Returns the server's representation of the networkInterface, and an error, if there is any. +func (c *networkInterfaces) Update(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.UpdateOptions) (result *v1.NetworkInterface, err error) { + result = &v1.NetworkInterface{} + err = c.client.Put(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(networkInterface.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *networkInterfaces) UpdateStatus(ctx context.Context, networkInterface *v1.NetworkInterface, opts metav1.UpdateOptions) (result *v1.NetworkInterface, err error) { + result = &v1.NetworkInterface{} + err = c.client.Put(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(networkInterface.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the networkInterface and deletes it. Returns an error if one occurs. +func (c *networkInterfaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *networkInterfaces) 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("networkinterfaces"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched networkInterface. +func (c *networkInterfaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkInterface, err error) { + result = &v1.NetworkInterface{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterfacelist.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterfacelist.go new file mode 100644 index 0000000000..3b4b2818a4 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networkinterfacelist.go @@ -0,0 +1,67 @@ +/* +Copyright 2023 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" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + networkv1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkInterfaceListsGetter has a method to return a NetworkInterfaceListInterface. +// A group's client should implement this interface. +type NetworkInterfaceListsGetter interface { + NetworkInterfaceLists(namespace string) NetworkInterfaceListInterface +} + +// NetworkInterfaceListInterface has methods to work with NetworkInterfaceList resources. +type NetworkInterfaceListInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*networkv1.NetworkInterfaceList, error) + NetworkInterfaceListExpansion +} + +// networkInterfaceLists implements NetworkInterfaceListInterface +type networkInterfaceLists struct { + client rest.Interface + ns string +} + +// newNetworkInterfaceLists returns a NetworkInterfaceLists +func newNetworkInterfaceLists(c *NetworkingV1Client, namespace string) *networkInterfaceLists { + return &networkInterfaceLists{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkInterfaceList, and returns the corresponding networkInterfaceList object, and an error if there is any. +func (c *networkInterfaceLists) Get(ctx context.Context, name string, options v1.GetOptions) (result *networkv1.NetworkInterfaceList, err error) { + result = &networkv1.NetworkInterfaceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfacelists"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networklist.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networklist.go new file mode 100644 index 0000000000..1ee30fe619 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1/networklist.go @@ -0,0 +1,64 @@ +/* +Copyright 2023 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" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + networkv1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkListsGetter has a method to return a NetworkListInterface. +// A group's client should implement this interface. +type NetworkListsGetter interface { + NetworkLists() NetworkListInterface +} + +// NetworkListInterface has methods to work with NetworkList resources. +type NetworkListInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*networkv1.NetworkList, error) + NetworkListExpansion +} + +// networkLists implements NetworkListInterface +type networkLists struct { + client rest.Interface +} + +// newNetworkLists returns a NetworkLists +func newNetworkLists(c *NetworkingV1Client) *networkLists { + return &networkLists{ + client: c.RESTClient(), + } +} + +// Get takes name of the networkList, and returns the corresponding networkList object, and an error if there is any. +func (c *networkLists) Get(ctx context.Context, name string, options v1.GetOptions) (result *networkv1.NetworkList, err error) { + result = &networkv1.NetworkList{} + err = c.client.Get(). + Resource("networklists"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/doc.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/doc.go new file mode 100644 index 0000000000..a022e3e2c6 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2023 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 v1alpha1 diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/generated_expansion.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/generated_expansion.go new file mode 100644 index 0000000000..9f02d5b5c2 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/generated_expansion.go @@ -0,0 +1,31 @@ +/* +Copyright 2023 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 v1alpha1 + +type GKENetworkParamSetExpansion interface{} + +type GKENetworkParamSetListExpansion interface{} + +type NetworkExpansion interface{} + +type NetworkInterfaceExpansion interface{} + +type NetworkInterfaceListExpansion interface{} + +type NetworkListExpansion interface{} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamset.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamset.go new file mode 100644 index 0000000000..082f54c8aa --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamset.go @@ -0,0 +1,184 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + "time" + + v1 "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" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// GKENetworkParamSetsGetter has a method to return a GKENetworkParamSetInterface. +// A group's client should implement this interface. +type GKENetworkParamSetsGetter interface { + GKENetworkParamSets() GKENetworkParamSetInterface +} + +// GKENetworkParamSetInterface has methods to work with GKENetworkParamSet resources. +type GKENetworkParamSetInterface interface { + Create(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.CreateOptions) (*v1alpha1.GKENetworkParamSet, error) + Update(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.UpdateOptions) (*v1alpha1.GKENetworkParamSet, error) + UpdateStatus(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.UpdateOptions) (*v1alpha1.GKENetworkParamSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GKENetworkParamSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GKENetworkParamSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GKENetworkParamSet, err error) + GKENetworkParamSetExpansion +} + +// gKENetworkParamSets implements GKENetworkParamSetInterface +type gKENetworkParamSets struct { + client rest.Interface +} + +// newGKENetworkParamSets returns a GKENetworkParamSets +func newGKENetworkParamSets(c *NetworkingV1alpha1Client) *gKENetworkParamSets { + return &gKENetworkParamSets{ + client: c.RESTClient(), + } +} + +// Get takes name of the gKENetworkParamSet, and returns the corresponding gKENetworkParamSet object, and an error if there is any. +func (c *gKENetworkParamSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GKENetworkParamSet, err error) { + result = &v1alpha1.GKENetworkParamSet{} + err = c.client.Get(). + Resource("gkenetworkparamsets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GKENetworkParamSets that match those selectors. +func (c *gKENetworkParamSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GKENetworkParamSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.GKENetworkParamSetList{} + err = c.client.Get(). + Resource("gkenetworkparamsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gKENetworkParamSets. +func (c *gKENetworkParamSets) Watch(ctx context.Context, opts v1.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(). + Resource("gkenetworkparamsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a gKENetworkParamSet and creates it. Returns the server's representation of the gKENetworkParamSet, and an error, if there is any. +func (c *gKENetworkParamSets) Create(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.CreateOptions) (result *v1alpha1.GKENetworkParamSet, err error) { + result = &v1alpha1.GKENetworkParamSet{} + err = c.client.Post(). + Resource("gkenetworkparamsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gKENetworkParamSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a gKENetworkParamSet and updates it. Returns the server's representation of the gKENetworkParamSet, and an error, if there is any. +func (c *gKENetworkParamSets) Update(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.UpdateOptions) (result *v1alpha1.GKENetworkParamSet, err error) { + result = &v1alpha1.GKENetworkParamSet{} + err = c.client.Put(). + Resource("gkenetworkparamsets"). + Name(gKENetworkParamSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gKENetworkParamSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *gKENetworkParamSets) UpdateStatus(ctx context.Context, gKENetworkParamSet *v1alpha1.GKENetworkParamSet, opts v1.UpdateOptions) (result *v1alpha1.GKENetworkParamSet, err error) { + result = &v1alpha1.GKENetworkParamSet{} + err = c.client.Put(). + Resource("gkenetworkparamsets"). + Name(gKENetworkParamSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gKENetworkParamSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the gKENetworkParamSet and deletes it. Returns an error if one occurs. +func (c *gKENetworkParamSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("gkenetworkparamsets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gKENetworkParamSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("gkenetworkparamsets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched gKENetworkParamSet. +func (c *gKENetworkParamSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GKENetworkParamSet, err error) { + result = &v1alpha1.GKENetworkParamSet{} + err = c.client.Patch(pt). + Resource("gkenetworkparamsets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamsetlist.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamsetlist.go new file mode 100644 index 0000000000..abd1de024f --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/gkenetworkparamsetlist.go @@ -0,0 +1,64 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// GKENetworkParamSetListsGetter has a method to return a GKENetworkParamSetListInterface. +// A group's client should implement this interface. +type GKENetworkParamSetListsGetter interface { + GKENetworkParamSetLists() GKENetworkParamSetListInterface +} + +// GKENetworkParamSetListInterface has methods to work with GKENetworkParamSetList resources. +type GKENetworkParamSetListInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GKENetworkParamSetList, error) + GKENetworkParamSetListExpansion +} + +// gKENetworkParamSetLists implements GKENetworkParamSetListInterface +type gKENetworkParamSetLists struct { + client rest.Interface +} + +// newGKENetworkParamSetLists returns a GKENetworkParamSetLists +func newGKENetworkParamSetLists(c *NetworkingV1alpha1Client) *gKENetworkParamSetLists { + return &gKENetworkParamSetLists{ + client: c.RESTClient(), + } +} + +// Get takes name of the gKENetworkParamSetList, and returns the corresponding gKENetworkParamSetList object, and an error if there is any. +func (c *gKENetworkParamSetLists) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GKENetworkParamSetList, err error) { + result = &v1alpha1.GKENetworkParamSetList{} + err = c.client.Get(). + Resource("gkenetworkparamsetlists"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network.go new file mode 100644 index 0000000000..12640c8063 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network.go @@ -0,0 +1,184 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + "time" + + v1 "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" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworksGetter has a method to return a NetworkInterface. +// A group's client should implement this interface. +type NetworksGetter interface { + Networks() NetworkInterface +} + +// NetworkInterface has methods to work with Network resources. +type NetworkInterface interface { + Create(ctx context.Context, network *v1alpha1.Network, opts v1.CreateOptions) (*v1alpha1.Network, error) + Update(ctx context.Context, network *v1alpha1.Network, opts v1.UpdateOptions) (*v1alpha1.Network, error) + UpdateStatus(ctx context.Context, network *v1alpha1.Network, opts v1.UpdateOptions) (*v1alpha1.Network, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Network, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NetworkList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Network, err error) + NetworkExpansion +} + +// networks implements NetworkInterface +type networks struct { + client rest.Interface +} + +// newNetworks returns a Networks +func newNetworks(c *NetworkingV1alpha1Client) *networks { + return &networks{ + client: c.RESTClient(), + } +} + +// Get takes name of the network, and returns the corresponding network object, and an error if there is any. +func (c *networks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Network, err error) { + result = &v1alpha1.Network{} + err = c.client.Get(). + Resource("networks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Networks that match those selectors. +func (c *networks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.NetworkList{} + err = c.client.Get(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networks. +func (c *networks) Watch(ctx context.Context, opts v1.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(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a network and creates it. Returns the server's representation of the network, and an error, if there is any. +func (c *networks) Create(ctx context.Context, network *v1alpha1.Network, opts v1.CreateOptions) (result *v1alpha1.Network, err error) { + result = &v1alpha1.Network{} + err = c.client.Post(). + Resource("networks"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a network and updates it. Returns the server's representation of the network, and an error, if there is any. +func (c *networks) Update(ctx context.Context, network *v1alpha1.Network, opts v1.UpdateOptions) (result *v1alpha1.Network, err error) { + result = &v1alpha1.Network{} + err = c.client.Put(). + Resource("networks"). + Name(network.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *networks) UpdateStatus(ctx context.Context, network *v1alpha1.Network, opts v1.UpdateOptions) (result *v1alpha1.Network, err error) { + result = &v1alpha1.Network{} + err = c.client.Put(). + Resource("networks"). + Name(network.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(network). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the network and deletes it. Returns an error if one occurs. +func (c *networks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("networks"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *networks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("networks"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched network. +func (c *networks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Network, err error) { + result = &v1alpha1.Network{} + err = c.client.Patch(pt). + Resource("networks"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network_client.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network_client.go new file mode 100644 index 0000000000..c1ce4656d8 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/network_client.go @@ -0,0 +1,132 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +type NetworkingV1alpha1Interface interface { + RESTClient() rest.Interface + GKENetworkParamSetsGetter + GKENetworkParamSetListsGetter + NetworksGetter + NetworkInterfacesGetter + NetworkInterfaceListsGetter + NetworkListsGetter +} + +// NetworkingV1alpha1Client is used to interact with features provided by the networking.gke.io group. +type NetworkingV1alpha1Client struct { + restClient rest.Interface +} + +func (c *NetworkingV1alpha1Client) GKENetworkParamSets() GKENetworkParamSetInterface { + return newGKENetworkParamSets(c) +} + +func (c *NetworkingV1alpha1Client) GKENetworkParamSetLists() GKENetworkParamSetListInterface { + return newGKENetworkParamSetLists(c) +} + +func (c *NetworkingV1alpha1Client) Networks() NetworkInterface { + return newNetworks(c) +} + +func (c *NetworkingV1alpha1Client) NetworkInterfaces(namespace string) NetworkInterfaceInterface { + return newNetworkInterfaces(c, namespace) +} + +func (c *NetworkingV1alpha1Client) NetworkInterfaceLists(namespace string) NetworkInterfaceListInterface { + return newNetworkInterfaceLists(c, namespace) +} + +func (c *NetworkingV1alpha1Client) NetworkLists() NetworkListInterface { + return newNetworkLists(c) +} + +// NewForConfig creates a new NetworkingV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*NetworkingV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new NetworkingV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &NetworkingV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new NetworkingV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NetworkingV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *NetworkingV1alpha1Client { + return &NetworkingV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *NetworkingV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterface.go new file mode 100644 index 0000000000..6cdf084f73 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterface.go @@ -0,0 +1,195 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + "time" + + v1 "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" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkInterfacesGetter has a method to return a NetworkInterfaceInterface. +// A group's client should implement this interface. +type NetworkInterfacesGetter interface { + NetworkInterfaces(namespace string) NetworkInterfaceInterface +} + +// NetworkInterfaceInterface has methods to work with NetworkInterface resources. +type NetworkInterfaceInterface interface { + Create(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.CreateOptions) (*v1alpha1.NetworkInterface, error) + Update(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.UpdateOptions) (*v1alpha1.NetworkInterface, error) + UpdateStatus(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.UpdateOptions) (*v1alpha1.NetworkInterface, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NetworkInterface, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NetworkInterfaceList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NetworkInterface, err error) + NetworkInterfaceExpansion +} + +// networkInterfaces implements NetworkInterfaceInterface +type networkInterfaces struct { + client rest.Interface + ns string +} + +// newNetworkInterfaces returns a NetworkInterfaces +func newNetworkInterfaces(c *NetworkingV1alpha1Client, namespace string) *networkInterfaces { + return &networkInterfaces{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkInterface, and returns the corresponding networkInterface object, and an error if there is any. +func (c *networkInterfaces) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkInterface, err error) { + result = &v1alpha1.NetworkInterface{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NetworkInterfaces that match those selectors. +func (c *networkInterfaces) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkInterfaceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.NetworkInterfaceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networkInterfaces. +func (c *networkInterfaces) Watch(ctx context.Context, opts v1.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("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a networkInterface and creates it. Returns the server's representation of the networkInterface, and an error, if there is any. +func (c *networkInterfaces) Create(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.CreateOptions) (result *v1alpha1.NetworkInterface, err error) { + result = &v1alpha1.NetworkInterface{} + err = c.client.Post(). + Namespace(c.ns). + Resource("networkinterfaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a networkInterface and updates it. Returns the server's representation of the networkInterface, and an error, if there is any. +func (c *networkInterfaces) Update(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.UpdateOptions) (result *v1alpha1.NetworkInterface, err error) { + result = &v1alpha1.NetworkInterface{} + err = c.client.Put(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(networkInterface.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *networkInterfaces) UpdateStatus(ctx context.Context, networkInterface *v1alpha1.NetworkInterface, opts v1.UpdateOptions) (result *v1alpha1.NetworkInterface, err error) { + result = &v1alpha1.NetworkInterface{} + err = c.client.Put(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(networkInterface.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(networkInterface). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the networkInterface and deletes it. Returns an error if one occurs. +func (c *networkInterfaces) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *networkInterfaces) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("networkinterfaces"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched networkInterface. +func (c *networkInterfaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NetworkInterface, err error) { + result = &v1alpha1.NetworkInterface{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterfacelist.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterfacelist.go new file mode 100644 index 0000000000..cbc3f45c93 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networkinterfacelist.go @@ -0,0 +1,67 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkInterfaceListsGetter has a method to return a NetworkInterfaceListInterface. +// A group's client should implement this interface. +type NetworkInterfaceListsGetter interface { + NetworkInterfaceLists(namespace string) NetworkInterfaceListInterface +} + +// NetworkInterfaceListInterface has methods to work with NetworkInterfaceList resources. +type NetworkInterfaceListInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NetworkInterfaceList, error) + NetworkInterfaceListExpansion +} + +// networkInterfaceLists implements NetworkInterfaceListInterface +type networkInterfaceLists struct { + client rest.Interface + ns string +} + +// newNetworkInterfaceLists returns a NetworkInterfaceLists +func newNetworkInterfaceLists(c *NetworkingV1alpha1Client, namespace string) *networkInterfaceLists { + return &networkInterfaceLists{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkInterfaceList, and returns the corresponding networkInterfaceList object, and an error if there is any. +func (c *networkInterfaceLists) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkInterfaceList, err error) { + result = &v1alpha1.NetworkInterfaceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkinterfacelists"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networklist.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networklist.go new file mode 100644 index 0000000000..ef3dd49ab3 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1/networklist.go @@ -0,0 +1,64 @@ +/* +Copyright 2023 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 v1alpha1 + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + scheme "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme" +) + +// NetworkListsGetter has a method to return a NetworkListInterface. +// A group's client should implement this interface. +type NetworkListsGetter interface { + NetworkLists() NetworkListInterface +} + +// NetworkListInterface has methods to work with NetworkList resources. +type NetworkListInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NetworkList, error) + NetworkListExpansion +} + +// networkLists implements NetworkListInterface +type networkLists struct { + client rest.Interface +} + +// newNetworkLists returns a NetworkLists +func newNetworkLists(c *NetworkingV1alpha1Client) *networkLists { + return &networkLists{ + client: c.RESTClient(), + } +} + +// Get takes name of the networkList, and returns the corresponding networkList object, and an error if there is any. +func (c *networkLists) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkList, err error) { + result = &v1alpha1.NetworkList{} + err = c.client.Get(). + Resource("networklists"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..fda54bcc5d --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/interface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/interface.go new file mode 100644 index 0000000000..351c046fe1 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Networks returns a NetworkInformer. + Networks() NetworkInformer + // NetworkInterfaces returns a NetworkInterfaceInformer. + NetworkInterfaces() NetworkInterfaceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Networks returns a NetworkInformer. +func (v *version) Networks() NetworkInformer { + return &networkInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// NetworkInterfaces returns a NetworkInterfaceInformer. +func (v *version) NetworkInterfaces() NetworkInterfaceInformer { + return &networkInterfaceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/network.go new file mode 100644 index 0000000000..80dfccc4f1 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/network.go @@ -0,0 +1,89 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + networkv1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" + v1 "k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1" +) + +// NetworkInformer provides access to a shared informer and lister for +// Networks. +type NetworkInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NetworkLister +} + +type networkInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNetworkInformer constructs a new informer for Network type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkInformer constructs a new informer for Network type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Networks().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Networks().Watch(context.TODO(), options) + }, + }, + &networkv1.Network{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkv1.Network{}, f.defaultInformer) +} + +func (f *networkInformer) Lister() v1.NetworkLister { + return v1.NewNetworkLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/networkinterface.go new file mode 100644 index 0000000000..09e7875d04 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1/networkinterface.go @@ -0,0 +1,90 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + networkv1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" + v1 "k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1" +) + +// NetworkInterfaceInformer provides access to a shared informer and lister for +// NetworkInterfaces. +type NetworkInterfaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NetworkInterfaceLister +} + +type networkInterfaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkInterfaceInformer constructs a new informer for NetworkInterface type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkInterfaceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkInterfaceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkInterfaceInformer constructs a new informer for NetworkInterface type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkInterfaceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkInterfaces(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkInterfaces(namespace).Watch(context.TODO(), options) + }, + }, + &networkv1.NetworkInterface{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkInterfaceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkInterfaceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkInterfaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkv1.NetworkInterface{}, f.defaultInformer) +} + +func (f *networkInterfaceInformer) Lister() v1.NetworkInterfaceLister { + return v1.NewNetworkInterfaceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/gkenetworkparamset.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/gkenetworkparamset.go new file mode 100644 index 0000000000..d6e70ff6cf --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/gkenetworkparamset.go @@ -0,0 +1,89 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + networkv1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1" +) + +// GKENetworkParamSetInformer provides access to a shared informer and lister for +// GKENetworkParamSets. +type GKENetworkParamSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.GKENetworkParamSetLister +} + +type gKENetworkParamSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewGKENetworkParamSetInformer constructs a new informer for GKENetworkParamSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewGKENetworkParamSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGKENetworkParamSetInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredGKENetworkParamSetInformer constructs a new informer for GKENetworkParamSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredGKENetworkParamSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().GKENetworkParamSets().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().GKENetworkParamSets().Watch(context.TODO(), options) + }, + }, + &networkv1alpha1.GKENetworkParamSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *gKENetworkParamSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGKENetworkParamSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gKENetworkParamSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkv1alpha1.GKENetworkParamSet{}, f.defaultInformer) +} + +func (f *gKENetworkParamSetInformer) Lister() v1alpha1.GKENetworkParamSetLister { + return v1alpha1.NewGKENetworkParamSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/interface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/interface.go new file mode 100644 index 0000000000..680a41b27d --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // GKENetworkParamSets returns a GKENetworkParamSetInformer. + GKENetworkParamSets() GKENetworkParamSetInformer + // Networks returns a NetworkInformer. + Networks() NetworkInformer + // NetworkInterfaces returns a NetworkInterfaceInformer. + NetworkInterfaces() NetworkInterfaceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// GKENetworkParamSets returns a GKENetworkParamSetInformer. +func (v *version) GKENetworkParamSets() GKENetworkParamSetInformer { + return &gKENetworkParamSetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Networks returns a NetworkInformer. +func (v *version) Networks() NetworkInformer { + return &networkInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// NetworkInterfaces returns a NetworkInterfaceInformer. +func (v *version) NetworkInterfaces() NetworkInterfaceInformer { + return &networkInterfaceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/network.go new file mode 100644 index 0000000000..384b3842bc --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/network.go @@ -0,0 +1,89 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + networkv1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1" +) + +// NetworkInformer provides access to a shared informer and lister for +// Networks. +type NetworkInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NetworkLister +} + +type networkInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNetworkInformer constructs a new informer for Network type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkInformer constructs a new informer for Network type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().Networks().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().Networks().Watch(context.TODO(), options) + }, + }, + &networkv1alpha1.Network{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkv1alpha1.Network{}, f.defaultInformer) +} + +func (f *networkInformer) Lister() v1alpha1.NetworkLister { + return v1alpha1.NewNetworkLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/networkinterface.go new file mode 100644 index 0000000000..2a796bfc73 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1/networkinterface.go @@ -0,0 +1,90 @@ +/* +Copyright 2023 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 informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + networkv1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" + versioned "k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned" + internalinterfaces "k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1" +) + +// NetworkInterfaceInformer provides access to a shared informer and lister for +// NetworkInterfaces. +type NetworkInterfaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NetworkInterfaceLister +} + +type networkInterfaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkInterfaceInformer constructs a new informer for NetworkInterface type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkInterfaceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkInterfaceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkInterfaceInformer constructs a new informer for NetworkInterface type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkInterfaceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().NetworkInterfaces(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1alpha1().NetworkInterfaces(namespace).Watch(context.TODO(), options) + }, + }, + &networkv1alpha1.NetworkInterface{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkInterfaceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkInterfaceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkInterfaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkv1alpha1.NetworkInterface{}, f.defaultInformer) +} + +func (f *networkInterfaceInformer) Lister() v1alpha1.NetworkInterfaceLister { + return v1alpha1.NewNetworkInterfaceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/expansion_generated.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/expansion_generated.go new file mode 100644 index 0000000000..d0292ecd33 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1 + +// NetworkListerExpansion allows custom methods to be added to +// NetworkLister. +type NetworkListerExpansion interface{} + +// NetworkInterfaceListerExpansion allows custom methods to be added to +// NetworkInterfaceLister. +type NetworkInterfaceListerExpansion interface{} + +// NetworkInterfaceNamespaceListerExpansion allows custom methods to be added to +// NetworkInterfaceNamespaceLister. +type NetworkInterfaceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/network.go new file mode 100644 index 0000000000..259d3b8db9 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/network.go @@ -0,0 +1,68 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" +) + +// NetworkLister helps list Networks. +// All objects returned here must be treated as read-only. +type NetworkLister interface { + // List lists all Networks in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Network, err error) + // Get retrieves the Network from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Network, error) + NetworkListerExpansion +} + +// networkLister implements the NetworkLister interface. +type networkLister struct { + indexer cache.Indexer +} + +// NewNetworkLister returns a new NetworkLister. +func NewNetworkLister(indexer cache.Indexer) NetworkLister { + return &networkLister{indexer: indexer} +} + +// List lists all Networks in the indexer. +func (s *networkLister) List(selector labels.Selector) (ret []*v1.Network, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Network)) + }) + return ret, err +} + +// Get retrieves the Network from the index for a given name. +func (s *networkLister) Get(name string) (*v1.Network, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("network"), name) + } + return obj.(*v1.Network), nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/networkinterface.go new file mode 100644 index 0000000000..2d1ece23c2 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1/networkinterface.go @@ -0,0 +1,99 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1" +) + +// NetworkInterfaceLister helps list NetworkInterfaces. +// All objects returned here must be treated as read-only. +type NetworkInterfaceLister interface { + // List lists all NetworkInterfaces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkInterface, err error) + // NetworkInterfaces returns an object that can list and get NetworkInterfaces. + NetworkInterfaces(namespace string) NetworkInterfaceNamespaceLister + NetworkInterfaceListerExpansion +} + +// networkInterfaceLister implements the NetworkInterfaceLister interface. +type networkInterfaceLister struct { + indexer cache.Indexer +} + +// NewNetworkInterfaceLister returns a new NetworkInterfaceLister. +func NewNetworkInterfaceLister(indexer cache.Indexer) NetworkInterfaceLister { + return &networkInterfaceLister{indexer: indexer} +} + +// List lists all NetworkInterfaces in the indexer. +func (s *networkInterfaceLister) List(selector labels.Selector) (ret []*v1.NetworkInterface, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkInterface)) + }) + return ret, err +} + +// NetworkInterfaces returns an object that can list and get NetworkInterfaces. +func (s *networkInterfaceLister) NetworkInterfaces(namespace string) NetworkInterfaceNamespaceLister { + return networkInterfaceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkInterfaceNamespaceLister helps list and get NetworkInterfaces. +// All objects returned here must be treated as read-only. +type NetworkInterfaceNamespaceLister interface { + // List lists all NetworkInterfaces in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkInterface, err error) + // Get retrieves the NetworkInterface from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.NetworkInterface, error) + NetworkInterfaceNamespaceListerExpansion +} + +// networkInterfaceNamespaceLister implements the NetworkInterfaceNamespaceLister +// interface. +type networkInterfaceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkInterfaces in the indexer for a given namespace. +func (s networkInterfaceNamespaceLister) List(selector labels.Selector) (ret []*v1.NetworkInterface, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkInterface)) + }) + return ret, err +} + +// Get retrieves the NetworkInterface from the indexer for a given namespace and name. +func (s networkInterfaceNamespaceLister) Get(name string) (*v1.NetworkInterface, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("networkinterface"), name) + } + return obj.(*v1.NetworkInterface), nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/expansion_generated.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/expansion_generated.go new file mode 100644 index 0000000000..b322f82fad --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +// GKENetworkParamSetListerExpansion allows custom methods to be added to +// GKENetworkParamSetLister. +type GKENetworkParamSetListerExpansion interface{} + +// NetworkListerExpansion allows custom methods to be added to +// NetworkLister. +type NetworkListerExpansion interface{} + +// NetworkInterfaceListerExpansion allows custom methods to be added to +// NetworkInterfaceLister. +type NetworkInterfaceListerExpansion interface{} + +// NetworkInterfaceNamespaceListerExpansion allows custom methods to be added to +// NetworkInterfaceNamespaceLister. +type NetworkInterfaceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/gkenetworkparamset.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/gkenetworkparamset.go new file mode 100644 index 0000000000..a581bf5cc4 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/gkenetworkparamset.go @@ -0,0 +1,68 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" +) + +// GKENetworkParamSetLister helps list GKENetworkParamSets. +// All objects returned here must be treated as read-only. +type GKENetworkParamSetLister interface { + // List lists all GKENetworkParamSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.GKENetworkParamSet, err error) + // Get retrieves the GKENetworkParamSet from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.GKENetworkParamSet, error) + GKENetworkParamSetListerExpansion +} + +// gKENetworkParamSetLister implements the GKENetworkParamSetLister interface. +type gKENetworkParamSetLister struct { + indexer cache.Indexer +} + +// NewGKENetworkParamSetLister returns a new GKENetworkParamSetLister. +func NewGKENetworkParamSetLister(indexer cache.Indexer) GKENetworkParamSetLister { + return &gKENetworkParamSetLister{indexer: indexer} +} + +// List lists all GKENetworkParamSets in the indexer. +func (s *gKENetworkParamSetLister) List(selector labels.Selector) (ret []*v1alpha1.GKENetworkParamSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.GKENetworkParamSet)) + }) + return ret, err +} + +// Get retrieves the GKENetworkParamSet from the index for a given name. +func (s *gKENetworkParamSetLister) Get(name string) (*v1alpha1.GKENetworkParamSet, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("gkenetworkparamset"), name) + } + return obj.(*v1alpha1.GKENetworkParamSet), nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/network.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/network.go new file mode 100644 index 0000000000..6cf238fb0c --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/network.go @@ -0,0 +1,68 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" +) + +// NetworkLister helps list Networks. +// All objects returned here must be treated as read-only. +type NetworkLister interface { + // List lists all Networks in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Network, err error) + // Get retrieves the Network from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Network, error) + NetworkListerExpansion +} + +// networkLister implements the NetworkLister interface. +type networkLister struct { + indexer cache.Indexer +} + +// NewNetworkLister returns a new NetworkLister. +func NewNetworkLister(indexer cache.Indexer) NetworkLister { + return &networkLister{indexer: indexer} +} + +// List lists all Networks in the indexer. +func (s *networkLister) List(selector labels.Selector) (ret []*v1alpha1.Network, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Network)) + }) + return ret, err +} + +// Get retrieves the Network from the index for a given name. +func (s *networkLister) Get(name string) (*v1alpha1.Network, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("network"), name) + } + return obj.(*v1alpha1.Network), nil +} diff --git a/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/networkinterface.go b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/networkinterface.go new file mode 100644 index 0000000000..17d6a4e3d9 --- /dev/null +++ b/vendor/k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1/networkinterface.go @@ -0,0 +1,99 @@ +/* +Copyright 2023 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 lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1" +) + +// NetworkInterfaceLister helps list NetworkInterfaces. +// All objects returned here must be treated as read-only. +type NetworkInterfaceLister interface { + // List lists all NetworkInterfaces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NetworkInterface, err error) + // NetworkInterfaces returns an object that can list and get NetworkInterfaces. + NetworkInterfaces(namespace string) NetworkInterfaceNamespaceLister + NetworkInterfaceListerExpansion +} + +// networkInterfaceLister implements the NetworkInterfaceLister interface. +type networkInterfaceLister struct { + indexer cache.Indexer +} + +// NewNetworkInterfaceLister returns a new NetworkInterfaceLister. +func NewNetworkInterfaceLister(indexer cache.Indexer) NetworkInterfaceLister { + return &networkInterfaceLister{indexer: indexer} +} + +// List lists all NetworkInterfaces in the indexer. +func (s *networkInterfaceLister) List(selector labels.Selector) (ret []*v1alpha1.NetworkInterface, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.NetworkInterface)) + }) + return ret, err +} + +// NetworkInterfaces returns an object that can list and get NetworkInterfaces. +func (s *networkInterfaceLister) NetworkInterfaces(namespace string) NetworkInterfaceNamespaceLister { + return networkInterfaceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkInterfaceNamespaceLister helps list and get NetworkInterfaces. +// All objects returned here must be treated as read-only. +type NetworkInterfaceNamespaceLister interface { + // List lists all NetworkInterfaces in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NetworkInterface, err error) + // Get retrieves the NetworkInterface from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.NetworkInterface, error) + NetworkInterfaceNamespaceListerExpansion +} + +// networkInterfaceNamespaceLister implements the NetworkInterfaceNamespaceLister +// interface. +type networkInterfaceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkInterfaces in the indexer for a given namespace. +func (s networkInterfaceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NetworkInterface, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.NetworkInterface)) + }) + return ret, err +} + +// Get retrieves the NetworkInterface from the indexer for a given namespace and name. +func (s networkInterfaceNamespaceLister) Get(name string) (*v1alpha1.NetworkInterface, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("networkinterface"), name) + } + return obj.(*v1alpha1.NetworkInterface), nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 8c30c7faa2..718f355362 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -791,6 +791,19 @@ k8s.io/cloud-provider/service/helpers k8s.io/cloud-provider/volume k8s.io/cloud-provider/volume/errors k8s.io/cloud-provider/volume/helpers +# k8s.io/cloud-provider-gcp/crd v0.0.0-20230322202223-f7280f55e36f +## explicit; go 1.19 +k8s.io/cloud-provider-gcp/crd/apis/network/v1 +k8s.io/cloud-provider-gcp/crd/apis/network/v1alpha1 +k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned +k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/scheme +k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1 +k8s.io/cloud-provider-gcp/crd/client/network/clientset/versioned/typed/network/v1alpha1 +k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/internalinterfaces +k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1 +k8s.io/cloud-provider-gcp/crd/client/network/informers/externalversions/network/v1alpha1 +k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1 +k8s.io/cloud-provider-gcp/crd/client/network/listers/network/v1alpha1 # k8s.io/cloud-provider-gcp/providers v0.26.3-0.20230322202223-f7280f55e36f ## explicit; go 1.19 k8s.io/cloud-provider-gcp/providers/gce