mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-30 13:23:28 +00:00
Regenerate files
Kubernetes-commit: 0923f860f1b9a05e9fbeeadc7345e0b0e6105040
This commit is contained in:
parent
44b2cb7282
commit
5ae2719295
@ -25,6 +25,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/informers/core:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/extensions:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/networking:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/policy:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/rbac:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/settings:go_default_library",
|
||||
@ -39,6 +40,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
core "k8s.io/client-go/informers/core"
|
||||
extensions "k8s.io/client-go/informers/extensions"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
networking "k8s.io/client-go/informers/networking"
|
||||
policy "k8s.io/client-go/informers/policy"
|
||||
rbac "k8s.io/client-go/informers/rbac"
|
||||
settings "k8s.io/client-go/informers/settings"
|
||||
@ -127,6 +128,7 @@ type SharedInformerFactory interface {
|
||||
Certificates() certificates.Interface
|
||||
Core() core.Interface
|
||||
Extensions() extensions.Interface
|
||||
Networking() networking.Interface
|
||||
Policy() policy.Interface
|
||||
Rbac() rbac.Interface
|
||||
Settings() settings.Interface
|
||||
@ -161,6 +163,10 @@ func (f *sharedInformerFactory) Extensions() extensions.Interface {
|
||||
return extensions.New(f)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Networking() networking.Interface {
|
||||
return networking.New(f)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Policy() policy.Interface {
|
||||
return policy.New(f)
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
batch_v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
|
||||
certificates_v1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
extensions_v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
networking_v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
policy_v1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
rbac_v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
|
||||
rbac_v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
|
||||
@ -147,6 +148,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
case extensions_v1beta1.SchemeGroupVersion.WithResource("thirdpartyresources"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ThirdPartyResources().Informer()}, nil
|
||||
|
||||
// Group=Networking, Version=V1
|
||||
case networking_v1.SchemeGroupVersion.WithResource("networkpolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil
|
||||
|
||||
// Group=Policy, Version=V1beta1
|
||||
case policy_v1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil
|
||||
|
18
informers/networking/BUILD
Normal file
18
informers/networking/BUILD
Normal file
@ -0,0 +1,18 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["interface.go"],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/networking/v1:go_default_library",
|
||||
],
|
||||
)
|
44
informers/networking/interface.go
Normal file
44
informers/networking/interface.go
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
v1 "k8s.io/client-go/informers/networking/v1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1 provides access to shared informers for resources in V1.
|
||||
V1() v1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &group{f}
|
||||
}
|
||||
|
||||
// V1 returns a new v1.Interface.
|
||||
func (g *group) V1() v1.Interface {
|
||||
return v1.New(g.SharedInformerFactory)
|
||||
}
|
27
informers/networking/v1/BUILD
Normal file
27
informers/networking/v1/BUILD
Normal file
@ -0,0 +1,27 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"interface.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/listers/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
|
||||
],
|
||||
)
|
43
informers/networking/v1/interface.go
Normal file
43
informers/networking/v1/interface.go
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// NetworkPolicies returns a NetworkPolicyInformer.
|
||||
NetworkPolicies() NetworkPolicyInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &version{f}
|
||||
}
|
||||
|
||||
// NetworkPolicies returns a NetworkPolicyInformer.
|
||||
func (v *version) NetworkPolicies() NetworkPolicyInformer {
|
||||
return &networkPolicyInformer{factory: v.SharedInformerFactory}
|
||||
}
|
68
informers/networking/v1/networkpolicy.go
Normal file
68
informers/networking/v1/networkpolicy.go
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by informer-gen
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
v1 "k8s.io/client-go/listers/networking/v1"
|
||||
networking_v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// NetworkPolicyInformer provides access to a shared informer and lister for
|
||||
// NetworkPolicies.
|
||||
type NetworkPolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.NetworkPolicyLister
|
||||
}
|
||||
|
||||
type networkPolicyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newNetworkPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||
return client.NetworkingV1().NetworkPolicies(meta_v1.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
return client.NetworkingV1().NetworkPolicies(meta_v1.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&networking_v1.NetworkPolicy{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&networking_v1.NetworkPolicy{}, newNetworkPolicyInformer)
|
||||
}
|
||||
|
||||
func (f *networkPolicyInformer) Lister() v1.NetworkPolicyLister {
|
||||
return v1.NewNetworkPolicyLister(f.Informer().GetIndexer())
|
||||
}
|
@ -30,6 +30,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1:go_default_library",
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
|
||||
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
|
||||
rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
|
||||
rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
|
||||
@ -75,6 +76,9 @@ type Interface interface {
|
||||
ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Extensions() extensionsv1beta1.ExtensionsV1beta1Interface
|
||||
NetworkingV1() networkingv1.NetworkingV1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Networking() networkingv1.NetworkingV1Interface
|
||||
PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Policy() policyv1beta1.PolicyV1beta1Interface
|
||||
@ -108,6 +112,7 @@ type Clientset struct {
|
||||
*batchv2alpha1.BatchV2alpha1Client
|
||||
*certificatesv1beta1.CertificatesV1beta1Client
|
||||
*extensionsv1beta1.ExtensionsV1beta1Client
|
||||
*networkingv1.NetworkingV1Client
|
||||
*policyv1beta1.PolicyV1beta1Client
|
||||
*rbacv1beta1.RbacV1beta1Client
|
||||
*rbacv1alpha1.RbacV1alpha1Client
|
||||
@ -301,6 +306,23 @@ func (c *Clientset) Extensions() extensionsv1beta1.ExtensionsV1beta1Interface {
|
||||
return c.ExtensionsV1beta1Client
|
||||
}
|
||||
|
||||
// NetworkingV1 retrieves the NetworkingV1Client
|
||||
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.NetworkingV1Client
|
||||
}
|
||||
|
||||
// Deprecated: Networking retrieves the default version of NetworkingClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Networking() networkingv1.NetworkingV1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.NetworkingV1Client
|
||||
}
|
||||
|
||||
// PolicyV1beta1 retrieves the PolicyV1beta1Client
|
||||
func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
|
||||
if c == nil {
|
||||
@ -453,6 +475,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.NetworkingV1Client, err = networkingv1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.PolicyV1beta1Client, err = policyv1beta1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -503,6 +529,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
cs.BatchV2alpha1Client = batchv2alpha1.NewForConfigOrDie(c)
|
||||
cs.CertificatesV1beta1Client = certificatesv1beta1.NewForConfigOrDie(c)
|
||||
cs.ExtensionsV1beta1Client = extensionsv1beta1.NewForConfigOrDie(c)
|
||||
cs.NetworkingV1Client = networkingv1.NewForConfigOrDie(c)
|
||||
cs.PolicyV1beta1Client = policyv1beta1.NewForConfigOrDie(c)
|
||||
cs.RbacV1beta1Client = rbacv1beta1.NewForConfigOrDie(c)
|
||||
cs.RbacV1alpha1Client = rbacv1alpha1.NewForConfigOrDie(c)
|
||||
@ -530,6 +557,7 @@ func New(c rest.Interface) *Clientset {
|
||||
cs.BatchV2alpha1Client = batchv2alpha1.New(c)
|
||||
cs.CertificatesV1beta1Client = certificatesv1beta1.New(c)
|
||||
cs.ExtensionsV1beta1Client = extensionsv1beta1.New(c)
|
||||
cs.NetworkingV1Client = networkingv1.New(c)
|
||||
cs.PolicyV1beta1Client = policyv1beta1.New(c)
|
||||
cs.RbacV1beta1Client = rbacv1beta1.New(c)
|
||||
cs.RbacV1alpha1Client = rbacv1alpha1.New(c)
|
||||
|
@ -50,6 +50,8 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1:go_default_library",
|
||||
@ -75,6 +77,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
|
||||
|
@ -48,6 +48,8 @@ import (
|
||||
fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
|
||||
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
|
||||
fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
|
||||
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake"
|
||||
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
|
||||
fakepolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake"
|
||||
rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
|
||||
@ -206,6 +208,16 @@ func (c *Clientset) Extensions() extensionsv1beta1.ExtensionsV1beta1Interface {
|
||||
return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// NetworkingV1 retrieves the NetworkingV1Client
|
||||
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
|
||||
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Networking retrieves the NetworkingV1Client
|
||||
func (c *Clientset) Networking() networkingv1.NetworkingV1Interface {
|
||||
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// PolicyV1beta1 retrieves the PolicyV1beta1Client
|
||||
func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
|
||||
return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake}
|
||||
|
@ -34,6 +34,7 @@ import (
|
||||
batchv2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
|
||||
certificatesv1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
extensionsv1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
policyv1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
rbacv1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
|
||||
rbacv1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
|
||||
@ -79,6 +80,7 @@ func AddToScheme(scheme *runtime.Scheme) {
|
||||
batchv2alpha1.AddToScheme(scheme)
|
||||
certificatesv1beta1.AddToScheme(scheme)
|
||||
extensionsv1beta1.AddToScheme(scheme)
|
||||
networkingv1.AddToScheme(scheme)
|
||||
policyv1beta1.AddToScheme(scheme)
|
||||
rbacv1beta1.AddToScheme(scheme)
|
||||
rbacv1alpha1.AddToScheme(scheme)
|
||||
|
@ -32,6 +32,7 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
|
||||
|
@ -34,6 +34,7 @@ import (
|
||||
batchv2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
|
||||
certificatesv1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
extensionsv1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
policyv1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
rbacv1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
|
||||
rbacv1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
|
||||
@ -79,6 +80,7 @@ func AddToScheme(scheme *runtime.Scheme) {
|
||||
batchv2alpha1.AddToScheme(scheme)
|
||||
certificatesv1beta1.AddToScheme(scheme)
|
||||
extensionsv1beta1.AddToScheme(scheme)
|
||||
networkingv1.AddToScheme(scheme)
|
||||
policyv1beta1.AddToScheme(scheme)
|
||||
rbacv1beta1.AddToScheme(scheme)
|
||||
rbacv1alpha1.AddToScheme(scheme)
|
||||
|
28
kubernetes/typed/networking/v1/BUILD
Normal file
28
kubernetes/typed/networking/v1/BUILD
Normal file
@ -0,0 +1,28 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"generated_expansion.go",
|
||||
"networking_client.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
],
|
||||
)
|
20
kubernetes/typed/networking/v1/doc.go
Normal file
20
kubernetes/typed/networking/v1/doc.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
29
kubernetes/typed/networking/v1/fake/BUILD
Normal file
29
kubernetes/typed/networking/v1/fake/BUILD
Normal file
@ -0,0 +1,29 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"fake_networking_client.go",
|
||||
"fake_networkpolicy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/testing:go_default_library",
|
||||
],
|
||||
)
|
20
kubernetes/typed/networking/v1/fake/doc.go
Normal file
20
kubernetes/typed/networking/v1/fake/doc.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with custom arguments.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2017 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 fake
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/kubernetes/typed/networking/v1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeNetworkingV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface {
|
||||
return &FakeNetworkPolicies{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeNetworkingV1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
120
kubernetes/typed/networking/v1/fake/fake_networkpolicy.go
Normal file
120
kubernetes/typed/networking/v1/fake/fake_networkpolicy.go
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright 2017 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 fake
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeNetworkPolicies implements NetworkPolicyInterface
|
||||
type FakeNetworkPolicies struct {
|
||||
Fake *FakeNetworkingV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var networkpoliciesResource = schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "networkpolicies"}
|
||||
|
||||
var networkpoliciesKind = schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}
|
||||
|
||||
func (c *FakeNetworkPolicies) Create(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(networkpoliciesResource, c.ns, networkPolicy), &v1.NetworkPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.NetworkPolicy), err
|
||||
}
|
||||
|
||||
func (c *FakeNetworkPolicies) Update(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(networkpoliciesResource, c.ns, networkPolicy), &v1.NetworkPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.NetworkPolicy), err
|
||||
}
|
||||
|
||||
func (c *FakeNetworkPolicies) Delete(name string, options *meta_v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(networkpoliciesResource, c.ns, name), &v1.NetworkPolicy{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeNetworkPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(networkpoliciesResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.NetworkPolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeNetworkPolicies) Get(name string, options meta_v1.GetOptions) (result *v1.NetworkPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(networkpoliciesResource, c.ns, name), &v1.NetworkPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.NetworkPolicy), err
|
||||
}
|
||||
|
||||
func (c *FakeNetworkPolicies) List(opts meta_v1.ListOptions) (result *v1.NetworkPolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(networkpoliciesResource, networkpoliciesKind, c.ns, opts), &v1.NetworkPolicyList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1.NetworkPolicyList{}
|
||||
for _, item := range obj.(*v1.NetworkPolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested networkPolicies.
|
||||
func (c *FakeNetworkPolicies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(networkpoliciesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched networkPolicy.
|
||||
func (c *FakeNetworkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetworkPolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(networkpoliciesResource, c.ns, name, data, subresources...), &v1.NetworkPolicy{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1.NetworkPolicy), err
|
||||
}
|
19
kubernetes/typed/networking/v1/generated_expansion.go
Normal file
19
kubernetes/typed/networking/v1/generated_expansion.go
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
type NetworkPolicyExpansion interface{}
|
88
kubernetes/typed/networking/v1/networking_client.go
Normal file
88
kubernetes/typed/networking/v1/networking_client.go
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type NetworkingV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
NetworkPoliciesGetter
|
||||
}
|
||||
|
||||
// NetworkingV1Client is used to interact with features provided by the networking.k8s.io group.
|
||||
type NetworkingV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInterface {
|
||||
return newNetworkPolicies(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new NetworkingV1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*NetworkingV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
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 = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
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
|
||||
}
|
155
kubernetes/typed/networking/v1/networkpolicy.go
Normal file
155
kubernetes/typed/networking/v1/networkpolicy.go
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// NetworkPoliciesGetter has a method to return a NetworkPolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type NetworkPoliciesGetter interface {
|
||||
NetworkPolicies(namespace string) NetworkPolicyInterface
|
||||
}
|
||||
|
||||
// NetworkPolicyInterface has methods to work with NetworkPolicy resources.
|
||||
type NetworkPolicyInterface interface {
|
||||
Create(*v1.NetworkPolicy) (*v1.NetworkPolicy, error)
|
||||
Update(*v1.NetworkPolicy) (*v1.NetworkPolicy, error)
|
||||
Delete(name string, options *meta_v1.DeleteOptions) error
|
||||
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.NetworkPolicy, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.NetworkPolicyList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetworkPolicy, err error)
|
||||
NetworkPolicyExpansion
|
||||
}
|
||||
|
||||
// networkPolicies implements NetworkPolicyInterface
|
||||
type networkPolicies struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newNetworkPolicies returns a NetworkPolicies
|
||||
func newNetworkPolicies(c *NetworkingV1Client, namespace string) *networkPolicies {
|
||||
return &networkPolicies{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any.
|
||||
func (c *networkPolicies) Create(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) {
|
||||
result = &v1.NetworkPolicy{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
Body(networkPolicy).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any.
|
||||
func (c *networkPolicies) Update(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) {
|
||||
result = &v1.NetworkPolicy{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
Name(networkPolicy.Name).
|
||||
Body(networkPolicy).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *networkPolicies) Delete(name string, options *meta_v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *networkPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any.
|
||||
func (c *networkPolicies) Get(name string, options meta_v1.GetOptions) (result *v1.NetworkPolicy, err error) {
|
||||
result = &v1.NetworkPolicy{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors.
|
||||
func (c *networkPolicies) List(opts meta_v1.ListOptions) (result *v1.NetworkPolicyList, err error) {
|
||||
result = &v1.NetworkPolicyList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested networkPolicies.
|
||||
func (c *networkPolicies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched networkPolicy.
|
||||
func (c *networkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetworkPolicy, err error) {
|
||||
result = &v1.NetworkPolicy{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("networkpolicies").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
23
listers/networking/v1/BUILD
Normal file
23
listers/networking/v1/BUILD
Normal file
@ -0,0 +1,23 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"expansion_generated.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
|
||||
],
|
||||
)
|
27
listers/networking/v1/expansion_generated.go
Normal file
27
listers/networking/v1/expansion_generated.go
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1
|
||||
|
||||
// NetworkPolicyListerExpansion allows custom methods to be added to
|
||||
// NetworkPolicyLister.
|
||||
type NetworkPolicyListerExpansion interface{}
|
||||
|
||||
// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to
|
||||
// NetworkPolicyNamespaceLister.
|
||||
type NetworkPolicyNamespaceListerExpansion interface{}
|
94
listers/networking/v1/networkpolicy.go
Normal file
94
listers/networking/v1/networkpolicy.go
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was automatically generated by lister-gen
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
v1 "k8s.io/client-go/pkg/apis/networking/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// NetworkPolicyLister helps list NetworkPolicies.
|
||||
type NetworkPolicyLister interface {
|
||||
// List lists all NetworkPolicies in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error)
|
||||
// NetworkPolicies returns an object that can list and get NetworkPolicies.
|
||||
NetworkPolicies(namespace string) NetworkPolicyNamespaceLister
|
||||
NetworkPolicyListerExpansion
|
||||
}
|
||||
|
||||
// networkPolicyLister implements the NetworkPolicyLister interface.
|
||||
type networkPolicyLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewNetworkPolicyLister returns a new NetworkPolicyLister.
|
||||
func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister {
|
||||
return &networkPolicyLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all NetworkPolicies in the indexer.
|
||||
func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.NetworkPolicy))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// NetworkPolicies returns an object that can list and get NetworkPolicies.
|
||||
func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister {
|
||||
return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// NetworkPolicyNamespaceLister helps list and get NetworkPolicies.
|
||||
type NetworkPolicyNamespaceLister interface {
|
||||
// List lists all NetworkPolicies in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error)
|
||||
// Get retrieves the NetworkPolicy from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1.NetworkPolicy, error)
|
||||
NetworkPolicyNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister
|
||||
// interface.
|
||||
type networkPolicyNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all NetworkPolicies in the indexer for a given namespace.
|
||||
func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.NetworkPolicy))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the NetworkPolicy from the indexer for a given namespace and name.
|
||||
func (s networkPolicyNamespaceLister) Get(name string) (*v1.NetworkPolicy, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("networkpolicy"), name)
|
||||
}
|
||||
return obj.(*v1.NetworkPolicy), nil
|
||||
}
|
@ -1042,6 +1042,7 @@ type PodSecurityPolicyList struct {
|
||||
|
||||
// +genclient=true
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
type NetworkPolicy struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
@ -1061,13 +1062,12 @@ type NetworkPolicySpec struct {
|
||||
PodSelector metav1.LabelSelector
|
||||
|
||||
// List of ingress rules to be applied to the selected pods.
|
||||
// Traffic is allowed to a pod if namespace.networkPolicy.ingress.isolation is undefined and cluster policy allows it,
|
||||
// Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod
|
||||
// OR if the traffic source is the pod's local node,
|
||||
// OR if the traffic matches at least one ingress rule across all of the NetworkPolicy
|
||||
// objects whose podSelector matches the pod.
|
||||
// If this field is empty then this NetworkPolicy does not affect ingress isolation.
|
||||
// If this field is present and contains at least one rule, this policy allows any traffic
|
||||
// which matches at least one of the ingress rules in this list.
|
||||
// If this field is empty then this NetworkPolicy does not allow any traffic
|
||||
// (and serves solely to ensure that the pods it selects are isolated by default).
|
||||
// +optional
|
||||
Ingress []NetworkPolicyIngressRule
|
||||
}
|
||||
|
@ -37,5 +37,6 @@ go_library(
|
||||
"//vendor/k8s.io/client-go/pkg/api:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/extensions:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -23,8 +23,10 @@ import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions"
|
||||
"k8s.io/client-go/pkg/apis/networking"
|
||||
)
|
||||
|
||||
func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
@ -42,6 +44,18 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
Convert_v1beta1_RollingUpdateDaemonSet_To_extensions_RollingUpdateDaemonSet,
|
||||
Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec,
|
||||
Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec,
|
||||
Convert_v1beta1_NetworkPolicy_To_networking_NetworkPolicy,
|
||||
Convert_networking_NetworkPolicy_To_v1beta1_NetworkPolicy,
|
||||
Convert_v1beta1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule,
|
||||
Convert_networking_NetworkPolicyIngressRule_To_v1beta1_NetworkPolicyIngressRule,
|
||||
Convert_v1beta1_NetworkPolicyList_To_networking_NetworkPolicyList,
|
||||
Convert_networking_NetworkPolicyList_To_v1beta1_NetworkPolicyList,
|
||||
Convert_v1beta1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer,
|
||||
Convert_networking_NetworkPolicyPeer_To_v1beta1_NetworkPolicyPeer,
|
||||
Convert_v1beta1_NetworkPolicyPort_To_networking_NetworkPolicyPort,
|
||||
Convert_networking_NetworkPolicyPort_To_v1beta1_NetworkPolicyPort,
|
||||
Convert_v1beta1_NetworkPolicySpec_To_networking_NetworkPolicySpec,
|
||||
Convert_networking_NetworkPolicySpec_To_v1beta1_NetworkPolicySpec,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -260,3 +274,155 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicy_To_networking_NetworkPolicy(in *NetworkPolicy, out *networking.NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
return Convert_v1beta1_NetworkPolicySpec_To_networking_NetworkPolicySpec(&in.Spec, &out.Spec, s)
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicy_To_v1beta1_NetworkPolicy(in *networking.NetworkPolicy, out *NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
return Convert_networking_NetworkPolicySpec_To_v1beta1_NetworkPolicySpec(&in.Spec, &out.Spec, s)
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicySpec_To_networking_NetworkPolicySpec(in *NetworkPolicySpec, out *networking.NetworkPolicySpec, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.PodSelector, &out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Ingress = make([]networking.NetworkPolicyIngressRule, len(in.Ingress))
|
||||
for i := range in.Ingress {
|
||||
if err := Convert_v1beta1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule(&in.Ingress[i], &out.Ingress[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicySpec_To_v1beta1_NetworkPolicySpec(in *networking.NetworkPolicySpec, out *NetworkPolicySpec, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.PodSelector, &out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Ingress = make([]NetworkPolicyIngressRule, len(in.Ingress))
|
||||
for i := range in.Ingress {
|
||||
if err := Convert_networking_NetworkPolicyIngressRule_To_v1beta1_NetworkPolicyIngressRule(&in.Ingress[i], &out.Ingress[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule(in *NetworkPolicyIngressRule, out *networking.NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = make([]networking.NetworkPolicyPort, len(in.Ports))
|
||||
for i := range in.Ports {
|
||||
if err := Convert_v1beta1_NetworkPolicyPort_To_networking_NetworkPolicyPort(&in.Ports[i], &out.Ports[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
out.From = make([]networking.NetworkPolicyPeer, len(in.From))
|
||||
for i := range in.From {
|
||||
if err := Convert_v1beta1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer(&in.From[i], &out.From[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicyIngressRule_To_v1beta1_NetworkPolicyIngressRule(in *networking.NetworkPolicyIngressRule, out *NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = make([]NetworkPolicyPort, len(in.Ports))
|
||||
for i := range in.Ports {
|
||||
if err := Convert_networking_NetworkPolicyPort_To_v1beta1_NetworkPolicyPort(&in.Ports[i], &out.Ports[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
out.From = make([]NetworkPolicyPeer, len(in.From))
|
||||
for i := range in.From {
|
||||
if err := Convert_networking_NetworkPolicyPeer_To_v1beta1_NetworkPolicyPeer(&in.From[i], &out.From[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer(in *NetworkPolicyPeer, out *networking.NetworkPolicyPeer, s conversion.Scope) error {
|
||||
if in.PodSelector != nil {
|
||||
out.PodSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.PodSelector, out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodSelector = nil
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
out.NamespaceSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.NamespaceSelector, out.NamespaceSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NamespaceSelector = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicyPeer_To_v1beta1_NetworkPolicyPeer(in *networking.NetworkPolicyPeer, out *NetworkPolicyPeer, s conversion.Scope) error {
|
||||
if in.PodSelector != nil {
|
||||
out.PodSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.PodSelector, out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodSelector = nil
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
out.NamespaceSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.NamespaceSelector, out.NamespaceSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NamespaceSelector = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicyPort_To_networking_NetworkPolicyPort(in *NetworkPolicyPort, out *networking.NetworkPolicyPort, s conversion.Scope) error {
|
||||
if in.Protocol != nil {
|
||||
out.Protocol = new(api.Protocol)
|
||||
*out.Protocol = api.Protocol(*in.Protocol)
|
||||
} else {
|
||||
out.Protocol = nil
|
||||
}
|
||||
out.Port = in.Port
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicyPort_To_v1beta1_NetworkPolicyPort(in *networking.NetworkPolicyPort, out *NetworkPolicyPort, s conversion.Scope) error {
|
||||
if in.Protocol != nil {
|
||||
out.Protocol = new(v1.Protocol)
|
||||
*out.Protocol = v1.Protocol(*in.Protocol)
|
||||
} else {
|
||||
out.Protocol = nil
|
||||
}
|
||||
out.Port = in.Port
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_NetworkPolicyList_To_networking_NetworkPolicyList(in *NetworkPolicyList, out *networking.NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = make([]networking.NetworkPolicy, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := Convert_v1beta1_NetworkPolicy_To_networking_NetworkPolicy(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_NetworkPolicyList_To_v1beta1_NetworkPolicyList(in *networking.NetworkPolicyList, out *NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = make([]NetworkPolicy, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := Convert_networking_NetworkPolicy_To_v1beta1_NetworkPolicy(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -532,6 +532,7 @@ message IngressTLS {
|
||||
optional string secretName = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
message NetworkPolicy {
|
||||
// Standard object's metadata.
|
||||
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
|
||||
@ -612,13 +613,12 @@ message NetworkPolicySpec {
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
|
||||
|
||||
// List of ingress rules to be applied to the selected pods.
|
||||
// Traffic is allowed to a pod if namespace.networkPolicy.ingress.isolation is undefined and cluster policy allows it,
|
||||
// Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod
|
||||
// OR if the traffic source is the pod's local node,
|
||||
// OR if the traffic matches at least one ingress rule across all of the NetworkPolicy
|
||||
// objects whose podSelector matches the pod.
|
||||
// If this field is empty then this NetworkPolicy does not affect ingress isolation.
|
||||
// If this field is present and contains at least one rule, this policy allows any traffic
|
||||
// which matches at least one of the ingress rules in this list.
|
||||
// If this field is empty then this NetworkPolicy does not allow any traffic
|
||||
// (and serves solely to ensure that the pods it selects are isolated by default).
|
||||
// +optional
|
||||
repeated NetworkPolicyIngressRule ingress = 2;
|
||||
}
|
||||
|
@ -1055,6 +1055,7 @@ type PodSecurityPolicyList struct {
|
||||
Items []PodSecurityPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
type NetworkPolicy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
@ -1076,13 +1077,12 @@ type NetworkPolicySpec struct {
|
||||
PodSelector metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"`
|
||||
|
||||
// List of ingress rules to be applied to the selected pods.
|
||||
// Traffic is allowed to a pod if namespace.networkPolicy.ingress.isolation is undefined and cluster policy allows it,
|
||||
// Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod
|
||||
// OR if the traffic source is the pod's local node,
|
||||
// OR if the traffic matches at least one ingress rule across all of the NetworkPolicy
|
||||
// objects whose podSelector matches the pod.
|
||||
// If this field is empty then this NetworkPolicy does not affect ingress isolation.
|
||||
// If this field is present and contains at least one rule, this policy allows any traffic
|
||||
// which matches at least one of the ingress rules in this list.
|
||||
// If this field is empty then this NetworkPolicy does not allow any traffic
|
||||
// (and serves solely to ensure that the pods it selects are isolated by default).
|
||||
// +optional
|
||||
Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"`
|
||||
}
|
||||
|
@ -331,6 +331,7 @@ func (IngressTLS) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_NetworkPolicy = map[string]string{
|
||||
"": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
|
||||
"metadata": "Standard object's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata",
|
||||
"spec": "Specification of the desired behavior for this NetworkPolicy.",
|
||||
}
|
||||
@ -379,7 +380,7 @@ func (NetworkPolicyPort) SwaggerDoc() map[string]string {
|
||||
|
||||
var map_NetworkPolicySpec = map[string]string{
|
||||
"podSelector": "Selects the pods to which this NetworkPolicy object applies. The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace.",
|
||||
"ingress": "List of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if namespace.networkPolicy.ingress.isolation is undefined and cluster policy allows it, OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not affect ingress isolation. If this field is present and contains at least one rule, this policy allows any traffic which matches at least one of the ingress rules in this list.",
|
||||
"ingress": "List of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default).",
|
||||
}
|
||||
|
||||
func (NetworkPolicySpec) SwaggerDoc() map[string]string {
|
||||
|
27
pkg/apis/networking/BUILD
Normal file
27
pkg/apis/networking/BUILD
Normal file
@ -0,0 +1,27 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"register.go",
|
||||
"types.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/api:go_default_library",
|
||||
],
|
||||
)
|
4
pkg/apis/networking/OWNERS
Executable file
4
pkg/apis/networking/OWNERS
Executable file
@ -0,0 +1,4 @@
|
||||
reviewers:
|
||||
- caseydavenport
|
||||
- danwinship
|
||||
- thockin
|
18
pkg/apis/networking/doc.go
Normal file
18
pkg/apis/networking/doc.go
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// +groupName=networking.k8s.io
|
||||
package networking
|
51
pkg/apis/networking/register.go
Normal file
51
pkg/apis/networking/register.go
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2017 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 networking
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "networking.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&NetworkPolicy{},
|
||||
&NetworkPolicyList{},
|
||||
)
|
||||
return nil
|
||||
}
|
115
pkg/apis/networking/types.go
Normal file
115
pkg/apis/networking/types.go
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
Copyright 2017 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 networking
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
type NetworkPolicy struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Specification of the desired behavior for this NetworkPolicy.
|
||||
// +optional
|
||||
Spec NetworkPolicySpec
|
||||
}
|
||||
|
||||
// NetworkPolicySpec provides the specification of a NetworkPolicy
|
||||
type NetworkPolicySpec struct {
|
||||
// Selects the pods to which this NetworkPolicy object applies. The array of
|
||||
// ingress rules is applied to any pods selected by this field. Multiple network
|
||||
// policies can select the same set of pods. In this case, the ingress rules for
|
||||
// each are combined additively. This field is NOT optional and follows standard
|
||||
// label selector semantics. An empty podSelector matches all pods in this
|
||||
// namespace.
|
||||
PodSelector metav1.LabelSelector
|
||||
|
||||
// List of ingress rules to be applied to the selected pods. Traffic is allowed to
|
||||
// a pod if there are no NetworkPolicies selecting the pod
|
||||
// (and cluster policy otherwise allows the traffic), OR if the traffic source is
|
||||
// the pod's local node, OR if the traffic matches at least one ingress rule
|
||||
// across all of the NetworkPolicy objects whose podSelector matches the pod. If
|
||||
// this field is empty then this NetworkPolicy does not allow any traffic (and serves
|
||||
// solely to ensure that the pods it selects are isolated by default)
|
||||
// +optional
|
||||
Ingress []NetworkPolicyIngressRule
|
||||
}
|
||||
|
||||
// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods
|
||||
// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.
|
||||
type NetworkPolicyIngressRule struct {
|
||||
// List of ports which should be made accessible on the pods selected for this
|
||||
// rule. Each item in this list is combined using a logical OR. If this field is
|
||||
// empty or missing, this rule matches all ports (traffic not restricted by port).
|
||||
// If this field is present and contains at least one item, then this rule allows
|
||||
// traffic only if the traffic matches at least one port in the list.
|
||||
// +optional
|
||||
Ports []NetworkPolicyPort
|
||||
|
||||
// List of sources which should be able to access the pods selected for this rule.
|
||||
// Items in this list are combined using a logical OR operation. If this field is
|
||||
// empty or missing, this rule matches all sources (traffic not restricted by
|
||||
// source). If this field is present and contains at least on item, this rule
|
||||
// allows traffic only if the traffic matches at least one item in the from list.
|
||||
// +optional
|
||||
From []NetworkPolicyPeer
|
||||
}
|
||||
|
||||
// NetworkPolicyPort describes a port to allow traffic on
|
||||
type NetworkPolicyPort struct {
|
||||
// The protocol (TCP or UDP) which traffic must match. If not specified, this
|
||||
// field defaults to TCP.
|
||||
// +optional
|
||||
Protocol *api.Protocol
|
||||
|
||||
// The port on the given protocol. This can either be a numerical or named port on
|
||||
// a pod. If this field is not provided, this matches all port names and numbers.
|
||||
// +optional
|
||||
Port *intstr.IntOrString
|
||||
}
|
||||
|
||||
// NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields
|
||||
// must be specified.
|
||||
type NetworkPolicyPeer struct {
|
||||
// This is a label selector which selects Pods in this namespace. This field
|
||||
// follows standard label selector semantics. If present but empty, this selector
|
||||
// selects all pods in this namespace.
|
||||
// +optional
|
||||
PodSelector *metav1.LabelSelector
|
||||
|
||||
// Selects Namespaces using cluster scoped-labels. This matches all pods in all
|
||||
// namespaces selected by this label selector. This field follows standard label
|
||||
// selector semantics. If present but empty, this selector selects all namespaces.
|
||||
// +optional
|
||||
NamespaceSelector *metav1.LabelSelector
|
||||
}
|
||||
|
||||
// NetworkPolicyList is a list of NetworkPolicy objects.
|
||||
type NetworkPolicyList struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
metav1.ListMeta
|
||||
|
||||
Items []NetworkPolicy
|
||||
}
|
40
pkg/apis/networking/v1/BUILD
Normal file
40
pkg/apis/networking/v1/BUILD
Normal file
@ -0,0 +1,40 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"conversion.go",
|
||||
"defaults.go",
|
||||
"doc.go",
|
||||
"generated.pb.go",
|
||||
"register.go",
|
||||
"types.generated.go",
|
||||
"types.go",
|
||||
"types_swagger_doc_generated.go",
|
||||
"zz_generated.conversion.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
"zz_generated.defaults.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||
"//vendor/github.com/ugorji/go/codec:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/api:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/extensions:go_default_library",
|
||||
"//vendor/k8s.io/client-go/pkg/apis/networking:go_default_library",
|
||||
],
|
||||
)
|
195
pkg/apis/networking/v1/conversion.go
Normal file
195
pkg/apis/networking/v1/conversion.go
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
return scheme.AddConversionFuncs(
|
||||
Convert_v1_NetworkPolicy_To_extensions_NetworkPolicy,
|
||||
Convert_extensions_NetworkPolicy_To_v1_NetworkPolicy,
|
||||
Convert_v1_NetworkPolicyIngressRule_To_extensions_NetworkPolicyIngressRule,
|
||||
Convert_extensions_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule,
|
||||
Convert_v1_NetworkPolicyList_To_extensions_NetworkPolicyList,
|
||||
Convert_extensions_NetworkPolicyList_To_v1_NetworkPolicyList,
|
||||
Convert_v1_NetworkPolicyPeer_To_extensions_NetworkPolicyPeer,
|
||||
Convert_extensions_NetworkPolicyPeer_To_v1_NetworkPolicyPeer,
|
||||
Convert_v1_NetworkPolicyPort_To_extensions_NetworkPolicyPort,
|
||||
Convert_extensions_NetworkPolicyPort_To_v1_NetworkPolicyPort,
|
||||
Convert_v1_NetworkPolicySpec_To_extensions_NetworkPolicySpec,
|
||||
Convert_extensions_NetworkPolicySpec_To_v1_NetworkPolicySpec,
|
||||
)
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicy_To_extensions_NetworkPolicy(in *NetworkPolicy, out *extensions.NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
return Convert_v1_NetworkPolicySpec_To_extensions_NetworkPolicySpec(&in.Spec, &out.Spec, s)
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicy_To_v1_NetworkPolicy(in *extensions.NetworkPolicy, out *NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
return Convert_extensions_NetworkPolicySpec_To_v1_NetworkPolicySpec(&in.Spec, &out.Spec, s)
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicySpec_To_extensions_NetworkPolicySpec(in *NetworkPolicySpec, out *extensions.NetworkPolicySpec, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.PodSelector, &out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Ingress = make([]extensions.NetworkPolicyIngressRule, len(in.Ingress))
|
||||
for i := range in.Ingress {
|
||||
if err := Convert_v1_NetworkPolicyIngressRule_To_extensions_NetworkPolicyIngressRule(&in.Ingress[i], &out.Ingress[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *extensions.NetworkPolicySpec, out *NetworkPolicySpec, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.PodSelector, &out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.Ingress = make([]NetworkPolicyIngressRule, len(in.Ingress))
|
||||
for i := range in.Ingress {
|
||||
if err := Convert_extensions_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule(&in.Ingress[i], &out.Ingress[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicyIngressRule_To_extensions_NetworkPolicyIngressRule(in *NetworkPolicyIngressRule, out *extensions.NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = make([]extensions.NetworkPolicyPort, len(in.Ports))
|
||||
for i := range in.Ports {
|
||||
if err := Convert_v1_NetworkPolicyPort_To_extensions_NetworkPolicyPort(&in.Ports[i], &out.Ports[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
out.From = make([]extensions.NetworkPolicyPeer, len(in.From))
|
||||
for i := range in.From {
|
||||
if err := Convert_v1_NetworkPolicyPeer_To_extensions_NetworkPolicyPeer(&in.From[i], &out.From[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule(in *extensions.NetworkPolicyIngressRule, out *NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = make([]NetworkPolicyPort, len(in.Ports))
|
||||
for i := range in.Ports {
|
||||
if err := Convert_extensions_NetworkPolicyPort_To_v1_NetworkPolicyPort(&in.Ports[i], &out.Ports[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
out.From = make([]NetworkPolicyPeer, len(in.From))
|
||||
for i := range in.From {
|
||||
if err := Convert_extensions_NetworkPolicyPeer_To_v1_NetworkPolicyPeer(&in.From[i], &out.From[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicyPeer_To_extensions_NetworkPolicyPeer(in *NetworkPolicyPeer, out *extensions.NetworkPolicyPeer, s conversion.Scope) error {
|
||||
if in.PodSelector != nil {
|
||||
out.PodSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.PodSelector, out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodSelector = nil
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
out.NamespaceSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.NamespaceSelector, out.NamespaceSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NamespaceSelector = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicyPeer_To_v1_NetworkPolicyPeer(in *extensions.NetworkPolicyPeer, out *NetworkPolicyPeer, s conversion.Scope) error {
|
||||
if in.PodSelector != nil {
|
||||
out.PodSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.PodSelector, out.PodSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodSelector = nil
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
out.NamespaceSelector = new(metav1.LabelSelector)
|
||||
if err := s.Convert(in.NamespaceSelector, out.NamespaceSelector, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NamespaceSelector = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicyPort_To_extensions_NetworkPolicyPort(in *NetworkPolicyPort, out *extensions.NetworkPolicyPort, s conversion.Scope) error {
|
||||
if in.Protocol != nil {
|
||||
out.Protocol = new(api.Protocol)
|
||||
*out.Protocol = api.Protocol(*in.Protocol)
|
||||
} else {
|
||||
out.Protocol = nil
|
||||
}
|
||||
out.Port = in.Port
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicyPort_To_v1_NetworkPolicyPort(in *extensions.NetworkPolicyPort, out *NetworkPolicyPort, s conversion.Scope) error {
|
||||
if in.Protocol != nil {
|
||||
out.Protocol = new(v1.Protocol)
|
||||
*out.Protocol = v1.Protocol(*in.Protocol)
|
||||
} else {
|
||||
out.Protocol = nil
|
||||
}
|
||||
out.Port = in.Port
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_NetworkPolicyList_To_extensions_NetworkPolicyList(in *NetworkPolicyList, out *extensions.NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = make([]extensions.NetworkPolicy, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := Convert_v1_NetworkPolicy_To_extensions_NetworkPolicy(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_NetworkPolicyList_To_v1_NetworkPolicyList(in *extensions.NetworkPolicyList, out *NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = make([]NetworkPolicy, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := Convert_extensions_NetworkPolicy_To_v1_NetworkPolicy(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
34
pkg/apis/networking/v1/defaults.go
Normal file
34
pkg/apis/networking/v1/defaults.go
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
}
|
||||
|
||||
func SetDefaults_NetworkPolicyPort(obj *NetworkPolicyPort) {
|
||||
// Default any undefined Protocol fields to TCP.
|
||||
if obj.Protocol == nil {
|
||||
proto := v1.ProtocolTCP
|
||||
obj.Protocol = &proto
|
||||
}
|
||||
}
|
18
pkg/apis/networking/v1/doc.go
Normal file
18
pkg/apis/networking/v1/doc.go
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// +groupName=networking.k8s.io
|
||||
package v1
|
1345
pkg/apis/networking/v1/generated.pb.go
Normal file
1345
pkg/apis/networking/v1/generated.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
127
pkg/apis/networking/v1/generated.proto
Normal file
127
pkg/apis/networking/v1/generated.proto
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
|
||||
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
|
||||
|
||||
syntax = 'proto2';
|
||||
|
||||
package k8s.io.client_go.pkg.apis.networking.v1;
|
||||
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
|
||||
import "k8s.io/kubernetes/pkg/apis/extensions/v1beta1/generated.proto";
|
||||
import "k8s.io/kubernetes/pkg/apis/policy/v1beta1/generated.proto";
|
||||
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1";
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
message NetworkPolicy {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Specification of the desired behavior for this NetworkPolicy.
|
||||
// +optional
|
||||
optional NetworkPolicySpec spec = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods
|
||||
// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.
|
||||
message NetworkPolicyIngressRule {
|
||||
// List of ports which should be made accessible on the pods selected for this
|
||||
// rule. Each item in this list is combined using a logical OR. If this field is
|
||||
// empty or missing, this rule matches all ports (traffic not restricted by port).
|
||||
// If this field is present and contains at least one item, then this rule allows
|
||||
// traffic only if the traffic matches at least one port in the list.
|
||||
// +optional
|
||||
repeated NetworkPolicyPort ports = 1;
|
||||
|
||||
// List of sources which should be able to access the pods selected for this rule.
|
||||
// Items in this list are combined using a logical OR operation. If this field is
|
||||
// empty or missing, this rule matches all sources (traffic not restricted by
|
||||
// source). If this field is present and contains at least on item, this rule
|
||||
// allows traffic only if the traffic matches at least one item in the from list.
|
||||
// +optional
|
||||
repeated NetworkPolicyPeer from = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicyList is a list of NetworkPolicy objects.
|
||||
message NetworkPolicyList {
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// Items is a list of schema objects.
|
||||
repeated NetworkPolicy items = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields
|
||||
// must be specified.
|
||||
message NetworkPolicyPeer {
|
||||
// This is a label selector which selects Pods in this namespace. This field
|
||||
// follows standard label selector semantics. If present but empty, this selector
|
||||
// selects all pods in this namespace.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
|
||||
|
||||
// Selects Namespaces using cluster scoped-labels. This matches all pods in all
|
||||
// namespaces selected by this label selector. This field follows standard label
|
||||
// selector semantics. If present but empty, this selector selects all namespaces.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicyPort describes a port to allow traffic on
|
||||
message NetworkPolicyPort {
|
||||
// The protocol (TCP or UDP) which traffic must match. If not specified, this
|
||||
// field defaults to TCP.
|
||||
// +optional
|
||||
optional string protocol = 1;
|
||||
|
||||
// The port on the given protocol. This can either be a numerical or named port on
|
||||
// a pod. If this field is not provided, this matches all port names and numbers.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.util.intstr.IntOrString port = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicySpec provides the specification of a NetworkPolicy
|
||||
message NetworkPolicySpec {
|
||||
// Selects the pods to which this NetworkPolicy object applies. The array of
|
||||
// ingress rules is applied to any pods selected by this field. Multiple network
|
||||
// policies can select the same set of pods. In this case, the ingress rules for
|
||||
// each are combined additively. This field is NOT optional and follows standard
|
||||
// label selector semantics. An empty podSelector matches all pods in this
|
||||
// namespace.
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
|
||||
|
||||
// List of ingress rules to be applied to the selected pods. Traffic is allowed to
|
||||
// a pod if there are no NetworkPolicies selecting the pod
|
||||
// (and cluster policy otherwise allows the traffic), OR if the traffic source is
|
||||
// the pod's local node, OR if the traffic matches at least one ingress rule
|
||||
// across all of the NetworkPolicy objects whose podSelector matches the pod. If
|
||||
// this field is empty then this NetworkPolicy does not allow any traffic (and serves
|
||||
// solely to ensure that the pods it selects are isolated by default)
|
||||
// +optional
|
||||
repeated NetworkPolicyIngressRule ingress = 2;
|
||||
}
|
||||
|
50
pkg/apis/networking/v1/register.go
Normal file
50
pkg/apis/networking/v1/register.go
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "networking.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
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 (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs, addConversionFuncs)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&NetworkPolicy{},
|
||||
&NetworkPolicyList{},
|
||||
)
|
||||
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
2322
pkg/apis/networking/v1/types.generated.go
Normal file
2322
pkg/apis/networking/v1/types.generated.go
Normal file
File diff suppressed because it is too large
Load Diff
120
pkg/apis/networking/v1/types.go
Normal file
120
pkg/apis/networking/v1/types.go
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
type NetworkPolicy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Specification of the desired behavior for this NetworkPolicy.
|
||||
// +optional
|
||||
Spec NetworkPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
||||
// NetworkPolicySpec provides the specification of a NetworkPolicy
|
||||
type NetworkPolicySpec struct {
|
||||
// Selects the pods to which this NetworkPolicy object applies. The array of
|
||||
// ingress rules is applied to any pods selected by this field. Multiple network
|
||||
// policies can select the same set of pods. In this case, the ingress rules for
|
||||
// each are combined additively. This field is NOT optional and follows standard
|
||||
// label selector semantics. An empty podSelector matches all pods in this
|
||||
// namespace.
|
||||
PodSelector metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"`
|
||||
|
||||
// List of ingress rules to be applied to the selected pods. Traffic is allowed to
|
||||
// a pod if there are no NetworkPolicies selecting the pod
|
||||
// (and cluster policy otherwise allows the traffic), OR if the traffic source is
|
||||
// the pod's local node, OR if the traffic matches at least one ingress rule
|
||||
// across all of the NetworkPolicy objects whose podSelector matches the pod. If
|
||||
// this field is empty then this NetworkPolicy does not allow any traffic (and serves
|
||||
// solely to ensure that the pods it selects are isolated by default)
|
||||
// +optional
|
||||
Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"`
|
||||
}
|
||||
|
||||
// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods
|
||||
// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.
|
||||
type NetworkPolicyIngressRule struct {
|
||||
// List of ports which should be made accessible on the pods selected for this
|
||||
// rule. Each item in this list is combined using a logical OR. If this field is
|
||||
// empty or missing, this rule matches all ports (traffic not restricted by port).
|
||||
// If this field is present and contains at least one item, then this rule allows
|
||||
// traffic only if the traffic matches at least one port in the list.
|
||||
// +optional
|
||||
Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
|
||||
|
||||
// List of sources which should be able to access the pods selected for this rule.
|
||||
// Items in this list are combined using a logical OR operation. If this field is
|
||||
// empty or missing, this rule matches all sources (traffic not restricted by
|
||||
// source). If this field is present and contains at least on item, this rule
|
||||
// allows traffic only if the traffic matches at least one item in the from list.
|
||||
// +optional
|
||||
From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"`
|
||||
}
|
||||
|
||||
// NetworkPolicyPort describes a port to allow traffic on
|
||||
type NetworkPolicyPort struct {
|
||||
// The protocol (TCP or UDP) which traffic must match. If not specified, this
|
||||
// field defaults to TCP.
|
||||
// +optional
|
||||
Protocol *v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,1,opt,name=protocol,casttype=k8s.io/kubernetes/pkg/api/v1.Protocol"`
|
||||
|
||||
// The port on the given protocol. This can either be a numerical or named port on
|
||||
// a pod. If this field is not provided, this matches all port names and numbers.
|
||||
// +optional
|
||||
Port *intstr.IntOrString `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"`
|
||||
}
|
||||
|
||||
// NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields
|
||||
// must be specified.
|
||||
type NetworkPolicyPeer struct {
|
||||
// This is a label selector which selects Pods in this namespace. This field
|
||||
// follows standard label selector semantics. If present but empty, this selector
|
||||
// selects all pods in this namespace.
|
||||
// +optional
|
||||
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"`
|
||||
|
||||
// Selects Namespaces using cluster scoped-labels. This matches all pods in all
|
||||
// namespaces selected by this label selector. This field follows standard label
|
||||
// selector semantics. If present but empty, this selector selects all namespaces.
|
||||
// +optional
|
||||
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"`
|
||||
}
|
||||
|
||||
// NetworkPolicyList is a list of NetworkPolicy objects.
|
||||
type NetworkPolicyList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is a list of schema objects.
|
||||
Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
90
pkg/apis/networking/v1/types_swagger_doc_generated.go
Normal file
90
pkg/apis/networking/v1/types_swagger_doc_generated.go
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright 2016 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
|
||||
|
||||
// This file contains a collection of methods that can be used from go-restful to
|
||||
// generate Swagger API documentation for its models. Please read this PR for more
|
||||
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
|
||||
//
|
||||
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
|
||||
// they are on one line! For multiple line or blocks that you want to ignore use ---.
|
||||
// Any context after a --- is ignored.
|
||||
//
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
var map_NetworkPolicy = map[string]string{
|
||||
"": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
|
||||
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
|
||||
"spec": "Specification of the desired behavior for this NetworkPolicy.",
|
||||
}
|
||||
|
||||
func (NetworkPolicy) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicy
|
||||
}
|
||||
|
||||
var map_NetworkPolicyIngressRule = map[string]string{
|
||||
"": "NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.",
|
||||
"ports": "List of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.",
|
||||
"from": "List of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least on item, this rule allows traffic only if the traffic matches at least one item in the from list.",
|
||||
}
|
||||
|
||||
func (NetworkPolicyIngressRule) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicyIngressRule
|
||||
}
|
||||
|
||||
var map_NetworkPolicyList = map[string]string{
|
||||
"": "NetworkPolicyList is a list of NetworkPolicy objects.",
|
||||
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
|
||||
"items": "Items is a list of schema objects.",
|
||||
}
|
||||
|
||||
func (NetworkPolicyList) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicyList
|
||||
}
|
||||
|
||||
var map_NetworkPolicyPeer = map[string]string{
|
||||
"": "NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields must be specified.",
|
||||
"podSelector": "This is a label selector which selects Pods in this namespace. This field follows standard label selector semantics. If present but empty, this selector selects all pods in this namespace.",
|
||||
"namespaceSelector": "Selects Namespaces using cluster scoped-labels. This matches all pods in all namespaces selected by this label selector. This field follows standard label selector semantics. If present but empty, this selector selects all namespaces.",
|
||||
}
|
||||
|
||||
func (NetworkPolicyPeer) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicyPeer
|
||||
}
|
||||
|
||||
var map_NetworkPolicyPort = map[string]string{
|
||||
"": "NetworkPolicyPort describes a port to allow traffic on",
|
||||
"protocol": "The protocol (TCP or UDP) which traffic must match. If not specified, this field defaults to TCP.",
|
||||
"port": "The port on the given protocol. This can either be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers.",
|
||||
}
|
||||
|
||||
func (NetworkPolicyPort) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicyPort
|
||||
}
|
||||
|
||||
var map_NetworkPolicySpec = map[string]string{
|
||||
"": "NetworkPolicySpec provides the specification of a NetworkPolicy",
|
||||
"podSelector": "Selects the pods to which this NetworkPolicy object applies. The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace.",
|
||||
"ingress": "List of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)",
|
||||
}
|
||||
|
||||
func (NetworkPolicySpec) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicySpec
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
195
pkg/apis/networking/v1/zz_generated.conversion.go
Normal file
195
pkg/apis/networking/v1/zz_generated.conversion.go
Normal file
@ -0,0 +1,195 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by conversion-gen. Do not edit it manually!
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
api_v1 "k8s.io/client-go/pkg/api/v1"
|
||||
networking "k8s.io/client-go/pkg/apis/networking"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1_NetworkPolicy_To_networking_NetworkPolicy,
|
||||
Convert_networking_NetworkPolicy_To_v1_NetworkPolicy,
|
||||
Convert_v1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule,
|
||||
Convert_networking_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule,
|
||||
Convert_v1_NetworkPolicyList_To_networking_NetworkPolicyList,
|
||||
Convert_networking_NetworkPolicyList_To_v1_NetworkPolicyList,
|
||||
Convert_v1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer,
|
||||
Convert_networking_NetworkPolicyPeer_To_v1_NetworkPolicyPeer,
|
||||
Convert_v1_NetworkPolicyPort_To_networking_NetworkPolicyPort,
|
||||
Convert_networking_NetworkPolicyPort_To_v1_NetworkPolicyPort,
|
||||
Convert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec,
|
||||
Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicy_To_networking_NetworkPolicy(in *NetworkPolicy, out *networking.NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicy_To_networking_NetworkPolicy is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicy_To_networking_NetworkPolicy(in *NetworkPolicy, out *networking.NetworkPolicy, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicy_To_networking_NetworkPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicy_To_v1_NetworkPolicy(in *networking.NetworkPolicy, out *NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicy_To_v1_NetworkPolicy is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicy_To_v1_NetworkPolicy(in *networking.NetworkPolicy, out *NetworkPolicy, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicy_To_v1_NetworkPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule(in *NetworkPolicyIngressRule, out *networking.NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = *(*[]networking.NetworkPolicyPort)(unsafe.Pointer(&in.Ports))
|
||||
out.From = *(*[]networking.NetworkPolicyPeer)(unsafe.Pointer(&in.From))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule(in *NetworkPolicyIngressRule, out *networking.NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicyIngressRule_To_networking_NetworkPolicyIngressRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule(in *networking.NetworkPolicyIngressRule, out *NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
out.Ports = *(*[]NetworkPolicyPort)(unsafe.Pointer(&in.Ports))
|
||||
out.From = *(*[]NetworkPolicyPeer)(unsafe.Pointer(&in.From))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule(in *networking.NetworkPolicyIngressRule, out *NetworkPolicyIngressRule, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicyIngressRule_To_v1_NetworkPolicyIngressRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicyList_To_networking_NetworkPolicyList(in *NetworkPolicyList, out *networking.NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networking.NetworkPolicy)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicyList_To_networking_NetworkPolicyList is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicyList_To_networking_NetworkPolicyList(in *NetworkPolicyList, out *networking.NetworkPolicyList, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicyList_To_networking_NetworkPolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicyList_To_v1_NetworkPolicyList(in *networking.NetworkPolicyList, out *NetworkPolicyList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items == nil {
|
||||
out.Items = make([]NetworkPolicy, 0)
|
||||
} else {
|
||||
out.Items = *(*[]NetworkPolicy)(unsafe.Pointer(&in.Items))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicyList_To_v1_NetworkPolicyList is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicyList_To_v1_NetworkPolicyList(in *networking.NetworkPolicyList, out *NetworkPolicyList, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicyList_To_v1_NetworkPolicyList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer(in *NetworkPolicyPeer, out *networking.NetworkPolicyPeer, s conversion.Scope) error {
|
||||
out.PodSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.PodSelector))
|
||||
out.NamespaceSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.NamespaceSelector))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer(in *NetworkPolicyPeer, out *networking.NetworkPolicyPeer, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicyPeer_To_networking_NetworkPolicyPeer(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicyPeer_To_v1_NetworkPolicyPeer(in *networking.NetworkPolicyPeer, out *NetworkPolicyPeer, s conversion.Scope) error {
|
||||
out.PodSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.PodSelector))
|
||||
out.NamespaceSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.NamespaceSelector))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicyPeer_To_v1_NetworkPolicyPeer is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicyPeer_To_v1_NetworkPolicyPeer(in *networking.NetworkPolicyPeer, out *NetworkPolicyPeer, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicyPeer_To_v1_NetworkPolicyPeer(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicyPort_To_networking_NetworkPolicyPort(in *NetworkPolicyPort, out *networking.NetworkPolicyPort, s conversion.Scope) error {
|
||||
out.Protocol = (*api.Protocol)(unsafe.Pointer(in.Protocol))
|
||||
out.Port = (*intstr.IntOrString)(unsafe.Pointer(in.Port))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicyPort_To_networking_NetworkPolicyPort is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicyPort_To_networking_NetworkPolicyPort(in *NetworkPolicyPort, out *networking.NetworkPolicyPort, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicyPort_To_networking_NetworkPolicyPort(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicyPort_To_v1_NetworkPolicyPort(in *networking.NetworkPolicyPort, out *NetworkPolicyPort, s conversion.Scope) error {
|
||||
out.Protocol = (*api_v1.Protocol)(unsafe.Pointer(in.Protocol))
|
||||
out.Port = (*intstr.IntOrString)(unsafe.Pointer(in.Port))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicyPort_To_v1_NetworkPolicyPort is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicyPort_To_v1_NetworkPolicyPort(in *networking.NetworkPolicyPort, out *NetworkPolicyPort, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicyPort_To_v1_NetworkPolicyPort(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec(in *NetworkPolicySpec, out *networking.NetworkPolicySpec, s conversion.Scope) error {
|
||||
out.PodSelector = in.PodSelector
|
||||
out.Ingress = *(*[]networking.NetworkPolicyIngressRule)(unsafe.Pointer(&in.Ingress))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec is an autogenerated conversion function.
|
||||
func Convert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec(in *NetworkPolicySpec, out *networking.NetworkPolicySpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *networking.NetworkPolicySpec, out *NetworkPolicySpec, s conversion.Scope) error {
|
||||
out.PodSelector = in.PodSelector
|
||||
out.Ingress = *(*[]NetworkPolicyIngressRule)(unsafe.Pointer(&in.Ingress))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec is an autogenerated conversion function.
|
||||
func Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *networking.NetworkPolicySpec, out *NetworkPolicySpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in, out, s)
|
||||
}
|
182
pkg/apis/networking/v1/zz_generated.deepcopy.go
Normal file
182
pkg/apis/networking/v1/zz_generated.deepcopy.go
Normal file
@ -0,0 +1,182 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
api_v1 "k8s.io/client-go/pkg/api/v1"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicy, InType: reflect.TypeOf(&NetworkPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicyIngressRule, InType: reflect.TypeOf(&NetworkPolicyIngressRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicyList, InType: reflect.TypeOf(&NetworkPolicyList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicyPeer, InType: reflect.TypeOf(&NetworkPolicyPeer{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicyPort, InType: reflect.TypeOf(&NetworkPolicyPort{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NetworkPolicySpec, InType: reflect.TypeOf(&NetworkPolicySpec{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicy)
|
||||
out := out.(*NetworkPolicy)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*meta_v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_v1_NetworkPolicySpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicyIngressRule is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicyIngressRule(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyIngressRule)
|
||||
out := out.(*NetworkPolicyIngressRule)
|
||||
*out = *in
|
||||
if in.Ports != nil {
|
||||
in, out := &in.Ports, &out.Ports
|
||||
*out = make([]NetworkPolicyPort, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1_NetworkPolicyPort(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.From != nil {
|
||||
in, out := &in.From, &out.From
|
||||
*out = make([]NetworkPolicyPeer, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1_NetworkPolicyPeer(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicyList is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicyList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyList)
|
||||
out := out.(*NetworkPolicyList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]NetworkPolicy, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1_NetworkPolicy(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicyPeer is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicyPeer(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyPeer)
|
||||
out := out.(*NetworkPolicyPeer)
|
||||
*out = *in
|
||||
if in.PodSelector != nil {
|
||||
in, out := &in.PodSelector, &out.PodSelector
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*meta_v1.LabelSelector)
|
||||
}
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
in, out := &in.NamespaceSelector, &out.NamespaceSelector
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*meta_v1.LabelSelector)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicyPort is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicyPort(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyPort)
|
||||
out := out.(*NetworkPolicyPort)
|
||||
*out = *in
|
||||
if in.Protocol != nil {
|
||||
in, out := &in.Protocol, &out.Protocol
|
||||
*out = new(api_v1.Protocol)
|
||||
**out = **in
|
||||
}
|
||||
if in.Port != nil {
|
||||
in, out := &in.Port, &out.Port
|
||||
*out = new(intstr.IntOrString)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1_NetworkPolicySpec is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1_NetworkPolicySpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicySpec)
|
||||
out := out.(*NetworkPolicySpec)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.PodSelector); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.PodSelector = *newVal.(*meta_v1.LabelSelector)
|
||||
}
|
||||
if in.Ingress != nil {
|
||||
in, out := &in.Ingress, &out.Ingress
|
||||
*out = make([]NetworkPolicyIngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_v1_NetworkPolicyIngressRule(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
51
pkg/apis/networking/v1/zz_generated.defaults.go
Normal file
51
pkg/apis/networking/v1/zz_generated.defaults.go
Normal file
@ -0,0 +1,51 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by defaulter-gen. Do not edit it manually!
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
scheme.AddTypeDefaultingFunc(&NetworkPolicy{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicy(obj.(*NetworkPolicy)) })
|
||||
scheme.AddTypeDefaultingFunc(&NetworkPolicyList{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicyList(obj.(*NetworkPolicyList)) })
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetObjectDefaults_NetworkPolicy(in *NetworkPolicy) {
|
||||
for i := range in.Spec.Ingress {
|
||||
a := &in.Spec.Ingress[i]
|
||||
for j := range a.Ports {
|
||||
b := &a.Ports[j]
|
||||
SetDefaults_NetworkPolicyPort(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SetObjectDefaults_NetworkPolicyList(in *NetworkPolicyList) {
|
||||
for i := range in.Items {
|
||||
a := &in.Items[i]
|
||||
SetObjectDefaults_NetworkPolicy(a)
|
||||
}
|
||||
}
|
182
pkg/apis/networking/zz_generated.deepcopy.go
Normal file
182
pkg/apis/networking/zz_generated.deepcopy.go
Normal file
@ -0,0 +1,182 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2017 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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(RegisterDeepCopies)
|
||||
}
|
||||
|
||||
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicy, InType: reflect.TypeOf(&NetworkPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicyIngressRule, InType: reflect.TypeOf(&NetworkPolicyIngressRule{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicyList, InType: reflect.TypeOf(&NetworkPolicyList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicyPeer, InType: reflect.TypeOf(&NetworkPolicyPeer{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicyPort, InType: reflect.TypeOf(&NetworkPolicyPort{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_networking_NetworkPolicySpec, InType: reflect.TypeOf(&NetworkPolicySpec{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicy)
|
||||
out := out.(*NetworkPolicy)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_networking_NetworkPolicySpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicyIngressRule is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicyIngressRule(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyIngressRule)
|
||||
out := out.(*NetworkPolicyIngressRule)
|
||||
*out = *in
|
||||
if in.Ports != nil {
|
||||
in, out := &in.Ports, &out.Ports
|
||||
*out = make([]NetworkPolicyPort, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_networking_NetworkPolicyPort(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.From != nil {
|
||||
in, out := &in.From, &out.From
|
||||
*out = make([]NetworkPolicyPeer, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_networking_NetworkPolicyPeer(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicyList is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicyList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyList)
|
||||
out := out.(*NetworkPolicyList)
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]NetworkPolicy, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_networking_NetworkPolicy(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicyPeer is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicyPeer(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyPeer)
|
||||
out := out.(*NetworkPolicyPeer)
|
||||
*out = *in
|
||||
if in.PodSelector != nil {
|
||||
in, out := &in.PodSelector, &out.PodSelector
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*v1.LabelSelector)
|
||||
}
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
in, out := &in.NamespaceSelector, &out.NamespaceSelector
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*v1.LabelSelector)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicyPort is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicyPort(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicyPort)
|
||||
out := out.(*NetworkPolicyPort)
|
||||
*out = *in
|
||||
if in.Protocol != nil {
|
||||
in, out := &in.Protocol, &out.Protocol
|
||||
*out = new(api.Protocol)
|
||||
**out = **in
|
||||
}
|
||||
if in.Port != nil {
|
||||
in, out := &in.Port, &out.Port
|
||||
*out = new(intstr.IntOrString)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_networking_NetworkPolicySpec is an autogenerated deepcopy function.
|
||||
func DeepCopy_networking_NetworkPolicySpec(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*NetworkPolicySpec)
|
||||
out := out.(*NetworkPolicySpec)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.PodSelector); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.PodSelector = *newVal.(*v1.LabelSelector)
|
||||
}
|
||||
if in.Ingress != nil {
|
||||
in, out := &in.Ingress, &out.Ingress
|
||||
*out = make([]NetworkPolicyIngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := DeepCopy_networking_NetworkPolicyIngressRule(&(*in)[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user