From 0683e55fc1b889df32f483cda5a3741d697a1746 Mon Sep 17 00:00:00 2001
From: Dan Winship
Date: Mon, 13 Mar 2017 10:31:16 -0400
Subject: [PATCH 1/2] Add networking.k8s.io v1 API, with NetworkPolicy
---
cmd/kube-apiserver/app/server.go | 4 +-
cmd/libs/go2idl/client-gen/main.go | 1 +
.../go2idl/go-to-protobuf/protobuf/cmd.go | 1 +
hack/.linted_packages | 2 +
hack/lib/init.sh | 1 +
pkg/api/defaulting_test.go | 2 +
pkg/api/testapi/testapi.go | 14 +
pkg/apis/extensions/types.go | 8 +-
pkg/apis/extensions/v1beta1/conversion.go | 166 +++++++++
pkg/apis/extensions/v1beta1/doc.go | 1 +
pkg/apis/extensions/v1beta1/types.go | 8 +-
pkg/apis/networking/OWNERS | 4 +
pkg/apis/networking/doc.go | 19 +
pkg/apis/networking/install/install.go | 49 +++
pkg/apis/networking/register.go | 51 +++
pkg/apis/networking/types.go | 115 ++++++
pkg/apis/networking/v1/conversion.go | 195 ++++++++++
pkg/apis/networking/v1/defaults.go | 34 ++
pkg/apis/networking/v1/doc.go | 22 ++
pkg/apis/networking/v1/register.go | 50 +++
pkg/apis/networking/v1/types.generated.go | 1 +
pkg/apis/networking/v1/types.go | 120 ++++++
pkg/apis/networking/validation/validation.go | 99 +++++
.../networking/validation/validation_test.go | 346 ++++++++++++++++++
pkg/master/import_known_versions.go | 1 +
pkg/master/master.go | 4 +
pkg/printers/internalversion/describe.go | 38 +-
pkg/printers/internalversion/printers.go | 36 +-
pkg/registry/networking/networkpolicy/doc.go | 17 +
.../networking/networkpolicy/registry.go | 84 +++++
.../networkpolicy/storage/storage.go | 54 +++
.../networking/networkpolicy/strategy.go | 117 ++++++
.../networking/rest/storage_settings.go | 56 +++
.../etcd/etcd_storage_path_test.go | 8 +
34 files changed, 1713 insertions(+), 15 deletions(-)
mode change 100644 => 100755 hack/lib/init.sh
create mode 100755 pkg/apis/networking/OWNERS
create mode 100644 pkg/apis/networking/doc.go
create mode 100644 pkg/apis/networking/install/install.go
create mode 100644 pkg/apis/networking/register.go
create mode 100644 pkg/apis/networking/types.go
create mode 100644 pkg/apis/networking/v1/conversion.go
create mode 100644 pkg/apis/networking/v1/defaults.go
create mode 100644 pkg/apis/networking/v1/doc.go
create mode 100644 pkg/apis/networking/v1/register.go
create mode 100644 pkg/apis/networking/v1/types.generated.go
create mode 100644 pkg/apis/networking/v1/types.go
create mode 100644 pkg/apis/networking/validation/validation.go
create mode 100644 pkg/apis/networking/validation/validation_test.go
create mode 100644 pkg/registry/networking/networkpolicy/doc.go
create mode 100644 pkg/registry/networking/networkpolicy/registry.go
create mode 100644 pkg/registry/networking/networkpolicy/storage/storage.go
create mode 100644 pkg/registry/networking/networkpolicy/strategy.go
create mode 100644 pkg/registry/networking/rest/storage_settings.go
diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go
index 1a087b736cc..dc287771fcc 100644
--- a/cmd/kube-apiserver/app/server.go
+++ b/cmd/kube-apiserver/app/server.go
@@ -57,6 +57,7 @@ import (
"k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions"
+ "k8s.io/kubernetes/pkg/apis/networking"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
informers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion"
@@ -471,8 +472,9 @@ func BuildStorageFactory(s *options.ServerRunOptions) (*serverstorage.DefaultSto
return nil, fmt.Errorf("error in initializing storage factory: %s", err)
}
- // keep Deployments in extensions for backwards compatibility, we'll have to migrate at some point, eventually
+ // keep Deployments and NetworkPolicies in extensions for backwards compatibility, we'll have to migrate at some point, eventually
storageFactory.AddCohabitatingResources(extensions.Resource("deployments"), apps.Resource("deployments"))
+ storageFactory.AddCohabitatingResources(extensions.Resource("networkpolicies"), networking.Resource("networkpolicies"))
for _, override := range s.Etcd.EtcdServersOverrides {
tokens := strings.Split(override, "#")
if len(tokens) != 2 {
diff --git a/cmd/libs/go2idl/client-gen/main.go b/cmd/libs/go2idl/client-gen/main.go
index 4bb4c160a24..77ac1cf7872 100644
--- a/cmd/libs/go2idl/client-gen/main.go
+++ b/cmd/libs/go2idl/client-gen/main.go
@@ -48,6 +48,7 @@ var (
"apps/",
"policy/",
"settings/",
+ "networking/",
}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\".")
includedTypesOverrides = flag.StringSlice("included-types-overrides", []string{}, "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient=true in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient=true will be used for other group versions.")
basePath = flag.String("input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group.")
diff --git a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
index a9c1e390d9f..b33641bbb45 100644
--- a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
+++ b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
@@ -95,6 +95,7 @@ func New() *Generator {
`-k8s.io/client-go/pkg/api/v1`,
`k8s.io/metrics/pkg/apis/metrics/v1alpha1`,
`k8s.io/metrics/pkg/apis/custom_metrics/v1alpha1`,
+ `k8s.io/kubernetes/pkg/apis/networking/v1`,
}, ","),
DropEmbeddedFields: "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta",
}
diff --git a/hack/.linted_packages b/hack/.linted_packages
index 24c0e0ebda1..2fde0efd57d 100644
--- a/hack/.linted_packages
+++ b/hack/.linted_packages
@@ -81,6 +81,8 @@ pkg/apis/componentconfig/install
pkg/apis/extensions/install
pkg/apis/extensions/v1beta1
pkg/apis/imagepolicy/install
+pkg/apis/networking/install
+pkg/apis/networking/validation
pkg/apis/policy/install
pkg/apis/rbac/install
pkg/apis/rbac/v1alpha1
diff --git a/hack/lib/init.sh b/hack/lib/init.sh
old mode 100644
new mode 100755
index 2f6a59201c4..41967e1c8ea
--- a/hack/lib/init.sh
+++ b/hack/lib/init.sh
@@ -65,6 +65,7 @@ batch/v2alpha1 \
certificates.k8s.io/v1beta1 \
extensions/v1beta1 \
imagepolicy.k8s.io/v1alpha1 \
+networking.k8s.io/v1 \
policy/v1beta1 \
rbac.authorization.k8s.io/v1beta1 \
rbac.authorization.k8s.io/v1alpha1 \
diff --git a/pkg/api/defaulting_test.go b/pkg/api/defaulting_test.go
index f850fd8b160..6a11771d2c3 100644
--- a/pkg/api/defaulting_test.go
+++ b/pkg/api/defaulting_test.go
@@ -125,6 +125,8 @@ func TestDefaulting(t *testing.T) {
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "InitializerConfigurationList"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfiguration"}: {},
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfigurationList"}: {},
+ {Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}: {},
+ {Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicyList"}: {},
}
f := fuzz.New().NilChance(.5).NumElements(1, 1).RandSource(rand.NewSource(1))
diff --git a/pkg/api/testapi/testapi.go b/pkg/api/testapi/testapi.go
index c7e7dbc9366..d36efa95670 100644
--- a/pkg/api/testapi/testapi.go
+++ b/pkg/api/testapi/testapi.go
@@ -44,6 +44,7 @@ import (
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/imagepolicy"
+ "k8s.io/kubernetes/pkg/apis/networking"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/settings"
@@ -61,6 +62,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/componentconfig/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/imagepolicy/install"
+ _ "k8s.io/kubernetes/pkg/apis/networking/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/settings/install"
@@ -82,6 +84,7 @@ var (
Settings TestGroup
Storage TestGroup
ImagePolicy TestGroup
+ Networking TestGroup
serializer runtime.SerializerInfo
storageSerializer runtime.SerializerInfo
@@ -289,6 +292,16 @@ func init() {
externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
}
}
+ if _, ok := Groups[networking.GroupName]; !ok {
+ externalGroupVersion := schema.GroupVersion{Group: networking.GroupName, Version: api.Registry.GroupOrDie(networking.GroupName).GroupVersion.Version}
+ Groups[networking.GroupName] = TestGroup{
+ externalGroupVersion: externalGroupVersion,
+ internalGroupVersion: networking.SchemeGroupVersion,
+ internalTypes: api.Scheme.KnownTypes(networking.SchemeGroupVersion),
+ externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
+ }
+ }
+
Default = Groups[api.GroupName]
Autoscaling = Groups[autoscaling.GroupName]
Batch = Groups[batch.GroupName]
@@ -302,6 +315,7 @@ func init() {
Storage = Groups[storage.GroupName]
ImagePolicy = Groups[imagepolicy.GroupName]
Authorization = Groups[authorization.GroupName]
+ Networking = Groups[networking.GroupName]
}
func (g TestGroup) ContentConfig() (string, *schema.GroupVersion, runtime.Codec) {
diff --git a/pkg/apis/extensions/types.go b/pkg/apis/extensions/types.go
index 7c2c1c2856e..b0b32c28b8c 100644
--- a/pkg/apis/extensions/types.go
+++ b/pkg/apis/extensions/types.go
@@ -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
}
diff --git a/pkg/apis/extensions/v1beta1/conversion.go b/pkg/apis/extensions/v1beta1/conversion.go
index 38b8c2ac8f8..afbe42f67b0 100644
--- a/pkg/apis/extensions/v1beta1/conversion.go
+++ b/pkg/apis/extensions/v1beta1/conversion.go
@@ -23,8 +23,10 @@ import (
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
+ "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/extensions"
+ "k8s.io/kubernetes/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
+}
diff --git a/pkg/apis/extensions/v1beta1/doc.go b/pkg/apis/extensions/v1beta1/doc.go
index f4e544e67d4..0b074d04693 100644
--- a/pkg/apis/extensions/v1beta1/doc.go
+++ b/pkg/apis/extensions/v1beta1/doc.go
@@ -18,6 +18,7 @@ limitations under the License.
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/extensions
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/autoscaling
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/batch
+// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/networking
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
diff --git a/pkg/apis/extensions/v1beta1/types.go b/pkg/apis/extensions/v1beta1/types.go
index 196f3137538..47156eec52c 100644
--- a/pkg/apis/extensions/v1beta1/types.go
+++ b/pkg/apis/extensions/v1beta1/types.go
@@ -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"`
}
diff --git a/pkg/apis/networking/OWNERS b/pkg/apis/networking/OWNERS
new file mode 100755
index 00000000000..97bde97282c
--- /dev/null
+++ b/pkg/apis/networking/OWNERS
@@ -0,0 +1,4 @@
+reviewers:
+- caseydavenport
+- danwinship
+- thockin
diff --git a/pkg/apis/networking/doc.go b/pkg/apis/networking/doc.go
new file mode 100644
index 00000000000..b583051ca4c
--- /dev/null
+++ b/pkg/apis/networking/doc.go
@@ -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.
+*/
+
+// +k8s:deepcopy-gen=package,register
+// +groupName=networking.k8s.io
+package networking // import "k8s.io/kubernetes/pkg/apis/networking"
diff --git a/pkg/apis/networking/install/install.go b/pkg/apis/networking/install/install.go
new file mode 100644
index 00000000000..1d118c76804
--- /dev/null
+++ b/pkg/apis/networking/install/install.go
@@ -0,0 +1,49 @@
+/*
+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 install installs the experimental API group, making it available as
+// an option to all of the API encoding/decoding machinery.
+package install
+
+import (
+ "k8s.io/apimachinery/pkg/apimachinery/announced"
+ "k8s.io/apimachinery/pkg/apimachinery/registered"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/networking"
+ "k8s.io/kubernetes/pkg/apis/networking/v1"
+)
+
+func init() {
+ Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
+}
+
+// Install registers the API group and adds types to a scheme
+func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
+ if err := announced.NewGroupMetaFactory(
+ &announced.GroupMetaFactoryArgs{
+ GroupName: networking.GroupName,
+ VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
+ ImportPrefix: "k8s.io/kubernetes/pkg/apis/networking",
+ AddInternalObjectsToScheme: networking.AddToScheme,
+ },
+ announced.VersionToSchemeFunc{
+ v1.SchemeGroupVersion.Version: v1.AddToScheme,
+ },
+ ).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
+ panic(err)
+ }
+}
diff --git a/pkg/apis/networking/register.go b/pkg/apis/networking/register.go
new file mode 100644
index 00000000000..4d58a210da2
--- /dev/null
+++ b/pkg/apis/networking/register.go
@@ -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
+}
diff --git a/pkg/apis/networking/types.go b/pkg/apis/networking/types.go
new file mode 100644
index 00000000000..f889543ed75
--- /dev/null
+++ b/pkg/apis/networking/types.go
@@ -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/kubernetes/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
+}
diff --git a/pkg/apis/networking/v1/conversion.go b/pkg/apis/networking/v1/conversion.go
new file mode 100644
index 00000000000..b6d1a36df72
--- /dev/null
+++ b/pkg/apis/networking/v1/conversion.go
@@ -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/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/api/v1"
+ "k8s.io/kubernetes/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
+}
diff --git a/pkg/apis/networking/v1/defaults.go b/pkg/apis/networking/v1/defaults.go
new file mode 100644
index 00000000000..e4aeaaa68b0
--- /dev/null
+++ b/pkg/apis/networking/v1/defaults.go
@@ -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/kubernetes/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
+ }
+}
diff --git a/pkg/apis/networking/v1/doc.go b/pkg/apis/networking/v1/doc.go
new file mode 100644
index 00000000000..e4000f86c97
--- /dev/null
+++ b/pkg/apis/networking/v1/doc.go
@@ -0,0 +1,22 @@
+/*
+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.
+*/
+
+// +k8s:deepcopy-gen=package,register
+// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/networking
+// +k8s:openapi-gen=true
+// +k8s:defaulter-gen=TypeMeta
+// +groupName=networking.k8s.io
+package v1 // import "k8s.io/kubernetes/pkg/apis/networking/v1"
diff --git a/pkg/apis/networking/v1/register.go b/pkg/apis/networking/v1/register.go
new file mode 100644
index 00000000000..c8d3c83bcc9
--- /dev/null
+++ b/pkg/apis/networking/v1/register.go
@@ -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
+}
diff --git a/pkg/apis/networking/v1/types.generated.go b/pkg/apis/networking/v1/types.generated.go
new file mode 100644
index 00000000000..b7b1f993d55
--- /dev/null
+++ b/pkg/apis/networking/v1/types.generated.go
@@ -0,0 +1 @@
+package v1
diff --git a/pkg/apis/networking/v1/types.go b/pkg/apis/networking/v1/types.go
new file mode 100644
index 00000000000..b5b57d34c9a
--- /dev/null
+++ b/pkg/apis/networking/v1/types.go
@@ -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/kubernetes/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"`
+}
diff --git a/pkg/apis/networking/validation/validation.go b/pkg/apis/networking/validation/validation.go
new file mode 100644
index 00000000000..e2db31430fe
--- /dev/null
+++ b/pkg/apis/networking/validation/validation.go
@@ -0,0 +1,99 @@
+/*
+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 validation
+
+import (
+ "reflect"
+
+ unversionedvalidation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
+ "k8s.io/apimachinery/pkg/util/intstr"
+ "k8s.io/apimachinery/pkg/util/validation"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+ "k8s.io/kubernetes/pkg/api"
+ apivalidation "k8s.io/kubernetes/pkg/api/validation"
+ "k8s.io/kubernetes/pkg/apis/networking"
+)
+
+// ValidateNetworkPolicyName can be used to check whether the given networkpolicy
+// name is valid.
+func ValidateNetworkPolicyName(name string, prefix bool) []string {
+ return apivalidation.NameIsDNSSubdomain(name, prefix)
+}
+
+// ValidateNetworkPolicySpec tests if required fields in the networkpolicy spec are set.
+func ValidateNetworkPolicySpec(spec *networking.NetworkPolicySpec, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(&spec.PodSelector, fldPath.Child("podSelector"))...)
+
+ // Validate ingress rules.
+ for i, ingress := range spec.Ingress {
+ ingressPath := fldPath.Child("ingress").Index(i)
+ for i, port := range ingress.Ports {
+ portPath := ingressPath.Child("ports").Index(i)
+ if port.Protocol != nil && *port.Protocol != api.ProtocolTCP && *port.Protocol != api.ProtocolUDP {
+ allErrs = append(allErrs, field.NotSupported(portPath.Child("protocol"), *port.Protocol, []string{string(api.ProtocolTCP), string(api.ProtocolUDP)}))
+ }
+ if port.Port != nil {
+ if port.Port.Type == intstr.Int {
+ for _, msg := range validation.IsValidPortNum(int(port.Port.IntVal)) {
+ allErrs = append(allErrs, field.Invalid(portPath.Child("port"), port.Port.IntVal, msg))
+ }
+ } else {
+ for _, msg := range validation.IsValidPortName(port.Port.StrVal) {
+ allErrs = append(allErrs, field.Invalid(portPath.Child("port"), port.Port.StrVal, msg))
+ }
+ }
+ }
+ }
+ for i, from := range ingress.From {
+ fromPath := ingressPath.Child("from").Index(i)
+ numFroms := 0
+ if from.PodSelector != nil {
+ numFroms++
+ allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(from.PodSelector, fromPath.Child("podSelector"))...)
+ }
+ if from.NamespaceSelector != nil {
+ numFroms++
+ allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(from.NamespaceSelector, fromPath.Child("namespaceSelector"))...)
+ }
+
+ if numFroms == 0 {
+ allErrs = append(allErrs, field.Required(fromPath, "must specify a from type"))
+ } else if numFroms > 1 {
+ allErrs = append(allErrs, field.Forbidden(fromPath, "may not specify more than 1 from type"))
+ }
+ }
+ }
+ return allErrs
+}
+
+// ValidateNetworkPolicy validates a networkpolicy.
+func ValidateNetworkPolicy(np *networking.NetworkPolicy) field.ErrorList {
+ allErrs := apivalidation.ValidateObjectMeta(&np.ObjectMeta, true, ValidateNetworkPolicyName, field.NewPath("metadata"))
+ allErrs = append(allErrs, ValidateNetworkPolicySpec(&np.Spec, field.NewPath("spec"))...)
+ return allErrs
+}
+
+// ValidateNetworkPolicyUpdate tests if an update to a NetworkPolicy is valid.
+func ValidateNetworkPolicyUpdate(update, old *networking.NetworkPolicy) field.ErrorList {
+ allErrs := field.ErrorList{}
+ allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata"))...)
+ if !reflect.DeepEqual(update.Spec, old.Spec) {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("spec"), "updates to networkpolicy spec are forbidden."))
+ }
+ return allErrs
+}
diff --git a/pkg/apis/networking/validation/validation_test.go b/pkg/apis/networking/validation/validation_test.go
new file mode 100644
index 00000000000..6001d5bc4e6
--- /dev/null
+++ b/pkg/apis/networking/validation/validation_test.go
@@ -0,0 +1,346 @@
+/*
+Copyright 2014 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 validation
+
+import (
+ "testing"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/util/intstr"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/networking"
+)
+
+func TestValidateNetworkPolicy(t *testing.T) {
+ protocolTCP := api.ProtocolTCP
+ protocolUDP := api.ProtocolUDP
+ protocolICMP := api.Protocol("ICMP")
+
+ successCases := []networking.NetworkPolicy{
+ {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{},
+ Ports: []networking.NetworkPolicyPort{},
+ },
+ },
+ },
+ },
+ {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ Ports: []networking.NetworkPolicyPort{
+ {
+ Protocol: nil,
+ Port: &intstr.IntOrString{Type: intstr.Int, IntVal: 80},
+ },
+ {
+ Protocol: &protocolTCP,
+ Port: nil,
+ },
+ {
+ Protocol: &protocolTCP,
+ Port: &intstr.IntOrString{Type: intstr.Int, IntVal: 443},
+ },
+ {
+ Protocol: &protocolUDP,
+ Port: &intstr.IntOrString{Type: intstr.String, StrVal: "dns"},
+ },
+ },
+ },
+ },
+ },
+ },
+ {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ PodSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{"c": "d"},
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ NamespaceSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{"c": "d"},
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+
+ // Success cases are expected to pass validation.
+ for k, v := range successCases {
+ if errs := ValidateNetworkPolicy(&v); len(errs) != 0 {
+ t.Errorf("Expected success for %d, got %v", k, errs)
+ }
+ }
+
+ invalidSelector := map[string]string{"NoUppercaseOrSpecialCharsLike=Equals": "b"}
+ errorCases := map[string]networking.NetworkPolicy{
+ "namespaceSelector and podSelector": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ PodSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{"c": "d"},
+ },
+ NamespaceSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{"c": "d"},
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid spec.podSelector": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: invalidSelector,
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ NamespaceSelector: &metav1.LabelSelector{
+ MatchLabels: map[string]string{"c": "d"},
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid ingress.ports.protocol": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ Ports: []networking.NetworkPolicyPort{
+ {
+ Protocol: &protocolICMP,
+ Port: &intstr.IntOrString{Type: intstr.Int, IntVal: 80},
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid ingress.ports.port (int)": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ Ports: []networking.NetworkPolicyPort{
+ {
+ Protocol: &protocolTCP,
+ Port: &intstr.IntOrString{Type: intstr.Int, IntVal: 123456789},
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid ingress.ports.port (str)": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ Ports: []networking.NetworkPolicyPort{
+ {
+ Protocol: &protocolTCP,
+ Port: &intstr.IntOrString{Type: intstr.String, StrVal: "!@#$"},
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid ingress.from.podSelector": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ PodSelector: &metav1.LabelSelector{
+ MatchLabels: invalidSelector,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ "invalid ingress.from.namespaceSelector": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{
+ {
+ From: []networking.NetworkPolicyPeer{
+ {
+ NamespaceSelector: &metav1.LabelSelector{
+ MatchLabels: invalidSelector,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+
+ // Error cases are not expected to pass validation.
+ for testName, networkPolicy := range errorCases {
+ if errs := ValidateNetworkPolicy(&networkPolicy); len(errs) == 0 {
+ t.Errorf("Expected failure for test: %s", testName)
+ }
+ }
+}
+
+func TestValidateNetworkPolicyUpdate(t *testing.T) {
+ type npUpdateTest struct {
+ old networking.NetworkPolicy
+ update networking.NetworkPolicy
+ }
+ successCases := []npUpdateTest{
+ {
+ old: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ update: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ },
+ }
+
+ for _, successCase := range successCases {
+ successCase.old.ObjectMeta.ResourceVersion = "1"
+ successCase.update.ObjectMeta.ResourceVersion = "1"
+ if errs := ValidateNetworkPolicyUpdate(&successCase.update, &successCase.old); len(errs) != 0 {
+ t.Errorf("expected success: %v", errs)
+ }
+ }
+ errorCases := map[string]npUpdateTest{
+ "change name": {
+ old: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ update: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "baz", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ },
+ "change spec": {
+ old: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{},
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ update: networking.NetworkPolicy{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Spec: networking.NetworkPolicySpec{
+ PodSelector: metav1.LabelSelector{
+ MatchLabels: map[string]string{"a": "b"},
+ },
+ Ingress: []networking.NetworkPolicyIngressRule{},
+ },
+ },
+ },
+ }
+
+ for testName, errorCase := range errorCases {
+ if errs := ValidateNetworkPolicyUpdate(&errorCase.update, &errorCase.old); len(errs) == 0 {
+ t.Errorf("expected failure: %s", testName)
+ }
+ }
+}
diff --git a/pkg/master/import_known_versions.go b/pkg/master/import_known_versions.go
index 355b0f0beba..076b9889372 100644
--- a/pkg/master/import_known_versions.go
+++ b/pkg/master/import_known_versions.go
@@ -32,6 +32,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/componentconfig/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/imagepolicy/install"
+ _ "k8s.io/kubernetes/pkg/apis/networking/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/settings/install"
diff --git a/pkg/master/master.go b/pkg/master/master.go
index 33fbf4b0560..1c42ae1c79a 100644
--- a/pkg/master/master.go
+++ b/pkg/master/master.go
@@ -44,6 +44,7 @@ import (
batchapiv1 "k8s.io/kubernetes/pkg/apis/batch/v1"
certificatesapiv1beta1 "k8s.io/kubernetes/pkg/apis/certificates/v1beta1"
extensionsapiv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
+ networkingapiv1 "k8s.io/kubernetes/pkg/apis/networking/v1"
policyapiv1beta1 "k8s.io/kubernetes/pkg/apis/policy/v1beta1"
rbacv1alpha1 "k8s.io/kubernetes/pkg/apis/rbac/v1alpha1"
rbacv1beta1 "k8s.io/kubernetes/pkg/apis/rbac/v1beta1"
@@ -71,6 +72,7 @@ import (
certificatesrest "k8s.io/kubernetes/pkg/registry/certificates/rest"
corerest "k8s.io/kubernetes/pkg/registry/core/rest"
extensionsrest "k8s.io/kubernetes/pkg/registry/extensions/rest"
+ networkingrest "k8s.io/kubernetes/pkg/registry/networking/rest"
policyrest "k8s.io/kubernetes/pkg/registry/policy/rest"
rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest"
settingsrest "k8s.io/kubernetes/pkg/registry/settings/rest"
@@ -253,6 +255,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
batchrest.RESTStorageProvider{},
certificatesrest.RESTStorageProvider{},
extensionsrest.RESTStorageProvider{ResourceInterface: thirdparty.NewThirdPartyResourceServer(s, s.DiscoveryGroupManager, c.StorageFactory)},
+ networkingrest.RESTStorageProvider{},
policyrest.RESTStorageProvider{},
rbacrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorizer},
settingsrest.RESTStorageProvider{},
@@ -390,6 +393,7 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig {
certificatesapiv1beta1.SchemeGroupVersion,
authorizationapiv1.SchemeGroupVersion,
authorizationapiv1beta1.SchemeGroupVersion,
+ networkingapiv1.SchemeGroupVersion,
)
// all extensions resources except these are disabled by default
diff --git a/pkg/printers/internalversion/describe.go b/pkg/printers/internalversion/describe.go
index 16e8215d3e8..5fad424f90e 100644
--- a/pkg/printers/internalversion/describe.go
+++ b/pkg/printers/internalversion/describe.go
@@ -58,6 +58,7 @@ import (
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
versionedextension "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
+ "k8s.io/kubernetes/pkg/apis/networking"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
@@ -132,7 +133,7 @@ func describerMap(c clientset.Interface) map[schema.GroupKind]printers.Describer
api.Kind("ConfigMap"): &ConfigMapDescriber{c},
extensions.Kind("ReplicaSet"): &ReplicaSetDescriber{c},
- extensions.Kind("NetworkPolicy"): &NetworkPolicyDescriber{c},
+ extensions.Kind("NetworkPolicy"): &ExtensionsNetworkPolicyDescriber{c},
autoscaling.Kind("HorizontalPodAutoscaler"): &HorizontalPodAutoscalerDescriber{c},
extensions.Kind("DaemonSet"): &DaemonSetDescriber{c},
extensions.Kind("Deployment"): &DeploymentDescriber{c, versionedClientsetForDeployment(c)},
@@ -146,6 +147,7 @@ func describerMap(c clientset.Interface) map[schema.GroupKind]printers.Describer
policy.Kind("PodDisruptionBudget"): &PodDisruptionBudgetDescriber{c},
rbac.Kind("RoleBinding"): &RoleBindingDescriber{c},
rbac.Kind("ClusterRoleBinding"): &ClusterRoleBindingDescriber{c},
+ networking.Kind("NetworkPolicy"): &NetworkPolicyDescriber{c},
}
return m
@@ -2812,13 +2814,41 @@ func describeCluster(cluster *federation.Cluster) (string, error) {
})
}
-// NetworkPolicyDescriber generates information about a NetworkPolicy
+// ExtensionsNetworkPolicyDescriber generates information about an extensions.NetworkPolicy
+type ExtensionsNetworkPolicyDescriber struct {
+ clientset.Interface
+}
+
+func (d *ExtensionsNetworkPolicyDescriber) Describe(namespace, name string, describerSettings printers.DescriberSettings) (string, error) {
+ c := d.Extensions().NetworkPolicies(namespace)
+
+ networkPolicy, err := c.Get(name, metav1.GetOptions{})
+ if err != nil {
+ return "", err
+ }
+
+ return describeExtensionsNetworkPolicy(networkPolicy)
+}
+
+func describeExtensionsNetworkPolicy(networkPolicy *extensions.NetworkPolicy) (string, error) {
+ return tabbedString(func(out io.Writer) error {
+ w := NewPrefixWriter(out)
+ w.Write(LEVEL_0, "Name:\t%s\n", networkPolicy.Name)
+ w.Write(LEVEL_0, "Namespace:\t%s\n", networkPolicy.Namespace)
+ printLabelsMultiline(w, "Labels", networkPolicy.Labels)
+ printAnnotationsMultiline(w, "Annotations", networkPolicy.Annotations)
+
+ return nil
+ })
+}
+
+// NetworkPolicyDescriber generates information about a networking.NetworkPolicy
type NetworkPolicyDescriber struct {
clientset.Interface
}
func (d *NetworkPolicyDescriber) Describe(namespace, name string, describerSettings printers.DescriberSettings) (string, error) {
- c := d.Extensions().NetworkPolicies(namespace)
+ c := d.Networking().NetworkPolicies(namespace)
networkPolicy, err := c.Get(name, metav1.GetOptions{})
if err != nil {
@@ -2828,7 +2858,7 @@ func (d *NetworkPolicyDescriber) Describe(namespace, name string, describerSetti
return describeNetworkPolicy(networkPolicy)
}
-func describeNetworkPolicy(networkPolicy *extensions.NetworkPolicy) (string, error) {
+func describeNetworkPolicy(networkPolicy *networking.NetworkPolicy) (string, error) {
return tabbedString(func(out io.Writer) error {
w := NewPrefixWriter(out)
w.Write(LEVEL_0, "Name:\t%s\n", networkPolicy.Name)
diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go
index 2f5228bda30..fdc141cdb6f 100644
--- a/pkg/printers/internalversion/printers.go
+++ b/pkg/printers/internalversion/printers.go
@@ -38,6 +38,7 @@ import (
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
+ "k8s.io/kubernetes/pkg/apis/networking"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/settings"
@@ -181,6 +182,8 @@ func AddHandlers(h *printers.HumanReadablePrinter) {
h.Handler(thirdPartyResourceDataColumns, nil, printThirdPartyResourceDataList)
h.Handler(clusterColumns, nil, printCluster)
h.Handler(clusterColumns, nil, printClusterList)
+ h.Handler(networkPolicyColumns, nil, printExtensionsNetworkPolicy)
+ h.Handler(networkPolicyColumns, nil, printExtensionsNetworkPolicyList)
h.Handler(networkPolicyColumns, nil, printNetworkPolicy)
h.Handler(networkPolicyColumns, nil, printNetworkPolicyList)
h.Handler(roleColumns, nil, printRole)
@@ -1856,7 +1859,7 @@ func printPodSecurityPolicyList(list *extensions.PodSecurityPolicyList, w io.Wri
return nil
}
-func printNetworkPolicy(networkPolicy *extensions.NetworkPolicy, w io.Writer, options printers.PrintOptions) error {
+func printExtensionsNetworkPolicy(networkPolicy *extensions.NetworkPolicy, w io.Writer, options printers.PrintOptions) error {
name := printers.FormatResourceName(options.Kind, networkPolicy.Name, options.WithKind)
namespace := networkPolicy.Namespace
@@ -1876,7 +1879,36 @@ func printNetworkPolicy(networkPolicy *extensions.NetworkPolicy, w io.Writer, op
return err
}
-func printNetworkPolicyList(list *extensions.NetworkPolicyList, w io.Writer, options printers.PrintOptions) error {
+func printExtensionsNetworkPolicyList(list *extensions.NetworkPolicyList, w io.Writer, options printers.PrintOptions) error {
+ for i := range list.Items {
+ if err := printExtensionsNetworkPolicy(&list.Items[i], w, options); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func printNetworkPolicy(networkPolicy *networking.NetworkPolicy, w io.Writer, options printers.PrintOptions) error {
+ name := printers.FormatResourceName(options.Kind, networkPolicy.Name, options.WithKind)
+
+ namespace := networkPolicy.Namespace
+
+ if options.WithNamespace {
+ if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
+ return err
+ }
+ }
+ if _, err := fmt.Fprintf(w, "%s\t%v\t%s", name, metav1.FormatLabelSelector(&networkPolicy.Spec.PodSelector), translateTimestamp(networkPolicy.CreationTimestamp)); err != nil {
+ return err
+ }
+ if _, err := fmt.Fprint(w, printers.AppendLabels(networkPolicy.Labels, options.ColumnLabels)); err != nil {
+ return err
+ }
+ _, err := fmt.Fprint(w, printers.AppendAllLabels(options.ShowLabels, networkPolicy.Labels))
+ return err
+}
+
+func printNetworkPolicyList(list *networking.NetworkPolicyList, w io.Writer, options printers.PrintOptions) error {
for i := range list.Items {
if err := printNetworkPolicy(&list.Items[i], w, options); err != nil {
return err
diff --git a/pkg/registry/networking/networkpolicy/doc.go b/pkg/registry/networking/networkpolicy/doc.go
new file mode 100644
index 00000000000..7b338bc5e89
--- /dev/null
+++ b/pkg/registry/networking/networkpolicy/doc.go
@@ -0,0 +1,17 @@
+/*
+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 networkpolicy // import "k8s.io/kubernetes/pkg/registry/networking/networkpolicy"
diff --git a/pkg/registry/networking/networkpolicy/registry.go b/pkg/registry/networking/networkpolicy/registry.go
new file mode 100644
index 00000000000..36f1d3d5dbe
--- /dev/null
+++ b/pkg/registry/networking/networkpolicy/registry.go
@@ -0,0 +1,84 @@
+/*
+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 networkpolicy
+
+import (
+ metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/watch"
+ genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
+ "k8s.io/apiserver/pkg/registry/rest"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/networking"
+)
+
+// Registry is an interface for things that know how to store NetworkPolicies.
+type Registry interface {
+ ListNetworkPolicies(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*networking.NetworkPolicyList, error)
+ CreateNetworkPolicy(ctx genericapirequest.Context, np *networking.NetworkPolicy) error
+ UpdateNetworkPolicy(ctx genericapirequest.Context, np *networking.NetworkPolicy) error
+ GetNetworkPolicy(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*networking.NetworkPolicy, error)
+ DeleteNetworkPolicy(ctx genericapirequest.Context, name string) error
+ WatchNetworkPolicies(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
+}
+
+// storage puts strong typing around storage calls
+type storage struct {
+ rest.StandardStorage
+}
+
+// NewRegistry returns a new Registry interface for the given Storage. Any mismatched
+// types will panic.
+func NewRegistry(s rest.StandardStorage) Registry {
+ return &storage{s}
+}
+
+func (s *storage) ListNetworkPolicies(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*networking.NetworkPolicyList, error) {
+ obj, err := s.List(ctx, options)
+ if err != nil {
+ return nil, err
+ }
+
+ return obj.(*networking.NetworkPolicyList), nil
+}
+
+func (s *storage) CreateNetworkPolicy(ctx genericapirequest.Context, np *networking.NetworkPolicy) error {
+ _, err := s.Create(ctx, np)
+ return err
+}
+
+func (s *storage) UpdateNetworkPolicy(ctx genericapirequest.Context, np *networking.NetworkPolicy) error {
+ _, _, err := s.Update(ctx, np.Name, rest.DefaultUpdatedObjectInfo(np, api.Scheme))
+ return err
+}
+
+func (s *storage) WatchNetworkPolicies(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
+ return s.Watch(ctx, options)
+}
+
+func (s *storage) GetNetworkPolicy(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*networking.NetworkPolicy, error) {
+ obj, err := s.Get(ctx, name, options)
+ if err != nil {
+ return nil, err
+ }
+ return obj.(*networking.NetworkPolicy), nil
+}
+
+func (s *storage) DeleteNetworkPolicy(ctx genericapirequest.Context, name string) error {
+ _, _, err := s.Delete(ctx, name, nil)
+ return err
+}
diff --git a/pkg/registry/networking/networkpolicy/storage/storage.go b/pkg/registry/networking/networkpolicy/storage/storage.go
new file mode 100644
index 00000000000..e3693660348
--- /dev/null
+++ b/pkg/registry/networking/networkpolicy/storage/storage.go
@@ -0,0 +1,54 @@
+/*
+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 storage
+
+import (
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apiserver/pkg/registry/generic"
+ genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
+ "k8s.io/kubernetes/pkg/api"
+ networkingapi "k8s.io/kubernetes/pkg/apis/networking"
+ "k8s.io/kubernetes/pkg/registry/cachesize"
+ "k8s.io/kubernetes/pkg/registry/networking/networkpolicy"
+)
+
+// rest implements a RESTStorage for NetworkPolicies against etcd
+type REST struct {
+ *genericregistry.Store
+}
+
+// NewREST returns a RESTStorage object that will work against NetworkPolicies
+func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
+ store := &genericregistry.Store{
+ Copier: api.Scheme,
+ NewFunc: func() runtime.Object { return &networkingapi.NetworkPolicy{} },
+ NewListFunc: func() runtime.Object { return &networkingapi.NetworkPolicyList{} },
+ PredicateFunc: networkpolicy.Matcher,
+ QualifiedResource: networkingapi.Resource("networkpolicies"),
+ WatchCacheSize: cachesize.GetWatchCacheSizeByResource("networkpolicies"),
+
+ CreateStrategy: networkpolicy.Strategy,
+ UpdateStrategy: networkpolicy.Strategy,
+ DeleteStrategy: networkpolicy.Strategy,
+ }
+ options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: networkpolicy.GetAttrs}
+ if err := store.CompleteWithOptions(options); err != nil {
+ panic(err) // TODO: Propagate error up
+ }
+
+ return &REST{store}
+}
diff --git a/pkg/registry/networking/networkpolicy/strategy.go b/pkg/registry/networking/networkpolicy/strategy.go
new file mode 100644
index 00000000000..b6b027fb5ed
--- /dev/null
+++ b/pkg/registry/networking/networkpolicy/strategy.go
@@ -0,0 +1,117 @@
+/*
+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 networkpolicy
+
+import (
+ "fmt"
+ "reflect"
+
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+ genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
+ "k8s.io/apiserver/pkg/registry/generic"
+ apistorage "k8s.io/apiserver/pkg/storage"
+ "k8s.io/apiserver/pkg/storage/names"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/networking"
+ "k8s.io/kubernetes/pkg/apis/networking/validation"
+)
+
+// networkPolicyStrategy implements verification logic for NetworkPolicies
+type networkPolicyStrategy struct {
+ runtime.ObjectTyper
+ names.NameGenerator
+}
+
+// Strategy is the default logic that applies when creating and updating NetworkPolicy objects.
+var Strategy = networkPolicyStrategy{api.Scheme, names.SimpleNameGenerator}
+
+// NamespaceScoped returns true because all NetworkPolicies need to be within a namespace.
+func (networkPolicyStrategy) NamespaceScoped() bool {
+ return true
+}
+
+// PrepareForCreate clears the status of a NetworkPolicy before creation.
+func (networkPolicyStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
+ networkPolicy := obj.(*networking.NetworkPolicy)
+ networkPolicy.Generation = 1
+}
+
+// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
+func (networkPolicyStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
+ newNetworkPolicy := obj.(*networking.NetworkPolicy)
+ oldNetworkPolicy := old.(*networking.NetworkPolicy)
+
+ // Any changes to the spec increment the generation number, any changes to the
+ // status should reflect the generation number of the corresponding object.
+ // See metav1.ObjectMeta description for more information on Generation.
+ if !reflect.DeepEqual(oldNetworkPolicy.Spec, newNetworkPolicy.Spec) {
+ newNetworkPolicy.Generation = oldNetworkPolicy.Generation + 1
+ }
+}
+
+// Validate validates a new NetworkPolicy.
+func (networkPolicyStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
+ networkPolicy := obj.(*networking.NetworkPolicy)
+ return validation.ValidateNetworkPolicy(networkPolicy)
+}
+
+// Canonicalize normalizes the object after validation.
+func (networkPolicyStrategy) Canonicalize(obj runtime.Object) {}
+
+// AllowCreateOnUpdate is false for NetworkPolicy; this means POST is needed to create one.
+func (networkPolicyStrategy) AllowCreateOnUpdate() bool {
+ return false
+}
+
+// ValidateUpdate is the default update validation for an end user.
+func (networkPolicyStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
+ validationErrorList := validation.ValidateNetworkPolicy(obj.(*networking.NetworkPolicy))
+ updateErrorList := validation.ValidateNetworkPolicyUpdate(obj.(*networking.NetworkPolicy), old.(*networking.NetworkPolicy))
+ return append(validationErrorList, updateErrorList...)
+}
+
+// AllowUnconditionalUpdate is the default update policy for NetworkPolicy objects.
+func (networkPolicyStrategy) AllowUnconditionalUpdate() bool {
+ return true
+}
+
+// SelectableFields returns a field set that represents the object.
+func SelectableFields(networkPolicy *networking.NetworkPolicy) fields.Set {
+ return generic.ObjectMetaFieldsSet(&networkPolicy.ObjectMeta, true)
+}
+
+// GetAttrs returns labels and fields of a given object for filtering purposes.
+func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
+ networkPolicy, ok := obj.(*networking.NetworkPolicy)
+ if !ok {
+ return nil, nil, fmt.Errorf("given object is not a NetworkPolicy.")
+ }
+ return labels.Set(networkPolicy.ObjectMeta.Labels), SelectableFields(networkPolicy), nil
+}
+
+// Matcher is the filter used by the generic etcd backend to watch events
+// from etcd to clients of the apiserver only interested in specific labels/fields.
+func Matcher(label labels.Selector, field fields.Selector) apistorage.SelectionPredicate {
+ return apistorage.SelectionPredicate{
+ Label: label,
+ Field: field,
+ GetAttrs: GetAttrs,
+ }
+}
diff --git a/pkg/registry/networking/rest/storage_settings.go b/pkg/registry/networking/rest/storage_settings.go
new file mode 100644
index 00000000000..c662025dd22
--- /dev/null
+++ b/pkg/registry/networking/rest/storage_settings.go
@@ -0,0 +1,56 @@
+/*
+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 rest
+
+import (
+ "k8s.io/apiserver/pkg/registry/generic"
+ "k8s.io/apiserver/pkg/registry/rest"
+ genericapiserver "k8s.io/apiserver/pkg/server"
+ serverstorage "k8s.io/apiserver/pkg/server/storage"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/networking"
+ networkingapiv1 "k8s.io/kubernetes/pkg/apis/networking/v1"
+ networkpolicystore "k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage"
+)
+
+type RESTStorageProvider struct{}
+
+func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool) {
+ apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(networking.GroupName, api.Registry, api.Scheme, api.ParameterCodec, api.Codecs)
+
+ if apiResourceConfigSource.AnyResourcesForVersionEnabled(networkingapiv1.SchemeGroupVersion) {
+ apiGroupInfo.VersionedResourcesStorageMap[networkingapiv1.SchemeGroupVersion.Version] = p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter)
+ apiGroupInfo.GroupMeta.GroupVersion = networkingapiv1.SchemeGroupVersion
+ }
+
+ return apiGroupInfo, true
+}
+
+func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) map[string]rest.Storage {
+ version := networkingapiv1.SchemeGroupVersion
+
+ storage := map[string]rest.Storage{}
+ if apiResourceConfigSource.ResourceEnabled(version.WithResource("networkpolicies")) {
+ networkPolicyStorage := networkpolicystore.NewREST(restOptionsGetter)
+ storage["networkpolicies"] = networkPolicyStorage
+ }
+ return storage
+}
+
+func (p RESTStorageProvider) GroupName() string {
+ return networking.GroupName
+}
diff --git a/test/integration/etcd/etcd_storage_path_test.go b/test/integration/etcd/etcd_storage_path_test.go
index 5ab5b3355cd..e2712ab98bb 100644
--- a/test/integration/etcd/etcd_storage_path_test.go
+++ b/test/integration/etcd/etcd_storage_path_test.go
@@ -219,6 +219,14 @@ var etcdStorageData = map[schema.GroupVersionResource]struct {
},
// --
+ // k8s.io/kubernetes/pkg/apis/networking/v1
+ gvr("networking.k8s.io", "v1", "networkpolicies"): {
+ stub: `{"metadata": {"name": "np2"}, "spec": {"podSelector": {"matchLabels": {"e": "f"}}}}`,
+ expectedEtcdPath: "/registry/networkpolicies/etcdstoragepathtestnamespace/np2",
+ expectedGVK: gvkP("extensions", "v1beta1", "NetworkPolicy"),
+ },
+ // --
+
// k8s.io/kubernetes/pkg/apis/policy/v1beta1
gvr("policy", "v1beta1", "poddisruptionbudgets"): {
stub: `{"metadata": {"name": "pdb1"}, "spec": {"selector": {"matchLabels": {"anokkey": "anokvalue"}}}}`,
From 0923f860f1b9a05e9fbeeadc7345e0b0e6105040 Mon Sep 17 00:00:00 2001
From: Dan Winship
Date: Sat, 27 May 2017 15:26:33 -0400
Subject: [PATCH 2/2] Regenerate files
---
api/openapi-spec/swagger.json | 1039 +++++++-
api/swagger-spec/extensions_v1beta1.json | 3 +-
api/swagger-spec/networking.k8s.io.json | 114 +
api/swagger-spec/networking.k8s.io_v1.json | 1455 +++++++++++
api/swagger-spec/resourceListing.json | 8 +
cmd/kube-apiserver/app/BUILD | 1 +
.../extensions/v1beta1/definitions.html | 7 +-
.../networking.k8s.io/v1/definitions.html | 1590 +++++++++++
.../networking.k8s.io/v1/operations.html | 2095 +++++++++++++++
hack/.linted_packages | 9 +
pkg/BUILD | 3 +
pkg/api/testapi/BUILD | 2 +
pkg/apis/extensions/v1beta1/BUILD | 1 +
pkg/apis/extensions/v1beta1/generated.proto | 8 +-
.../v1beta1/types_swagger_doc_generated.go | 3 +-
pkg/apis/networking/BUILD | 45 +
pkg/apis/networking/install/BUILD | 35 +
pkg/apis/networking/v1/BUILD | 53 +
pkg/apis/networking/v1/generated.pb.go | 1345 ++++++++++
pkg/apis/networking/v1/generated.proto | 127 +
pkg/apis/networking/v1/types.generated.go | 2321 ++++++++++++++++
.../v1/types_swagger_doc_generated.go | 90 +
.../networking/v1/zz_generated.conversion.go | 195 ++
.../networking/v1/zz_generated.deepcopy.go | 182 ++
.../networking/v1/zz_generated.defaults.go | 51 +
pkg/apis/networking/validation/BUILD | 50 +
pkg/apis/networking/zz_generated.deepcopy.go | 182 ++
.../clientset_generated/clientset/BUILD | 2 +
.../clientset/clientset.go | 28 +
.../clientset_generated/clientset/fake/BUILD | 3 +
.../clientset/fake/clientset_generated.go | 12 +
.../clientset/fake/register.go | 2 +
.../clientset/scheme/BUILD | 1 +
.../clientset/scheme/register.go | 2 +
.../clientset/typed/networking/v1/BUILD | 44 +
.../clientset/typed/networking/v1/doc.go | 20 +
.../clientset/typed/networking/v1/fake/BUILD | 42 +
.../clientset/typed/networking/v1/fake/doc.go | 20 +
.../v1/fake/fake_networking_client.go | 38 +
.../networking/v1/fake/fake_networkpolicy.go | 120 +
.../networking/v1/generated_expansion.go | 19 +
.../typed/networking/v1/networking_client.go | 88 +
.../typed/networking/v1/networkpolicy.go | 155 ++
.../internalclientset/BUILD | 2 +
.../internalclientset/clientset.go | 17 +
.../internalclientset/fake/BUILD | 3 +
.../fake/clientset_generated.go | 7 +
.../internalclientset/fake/register.go | 2 +
.../internalclientset/scheme/BUILD | 1 +
.../internalclientset/scheme/register.go | 2 +
.../typed/networking/internalversion/BUILD | 43 +
.../typed/networking/internalversion/doc.go | 20 +
.../networking/internalversion/fake/BUILD | 42 +
.../networking/internalversion/fake/doc.go | 20 +
.../fake/fake_networking_client.go | 38 +
.../fake/fake_networkpolicy.go | 120 +
.../internalversion/generated_expansion.go | 19 +
.../internalversion/networking_client.go | 99 +
.../internalversion/networkpolicy.go | 155 ++
.../externalversions/BUILD | 3 +
.../externalversions/factory.go | 6 +
.../externalversions/generic.go | 5 +
.../externalversions/networking/BUILD | 34 +
.../externalversions/networking/interface.go | 44 +
.../externalversions/networking/v1/BUILD | 40 +
.../networking/v1/interface.go | 43 +
.../networking/v1/networkpolicy.go | 68 +
.../informers_generated/internalversion/BUILD | 3 +
.../internalversion/factory.go | 6 +
.../internalversion/generic.go | 5 +
.../internalversion/networking/BUILD | 34 +
.../internalversion/networking/interface.go | 44 +
.../networking/internalversion/BUILD | 40 +
.../networking/internalversion/interface.go | 43 +
.../internalversion/networkpolicy.go | 68 +
.../listers/networking/internalversion/BUILD | 36 +
.../internalversion/expansion_generated.go | 27 +
.../internalversion/networkpolicy.go | 94 +
pkg/client/listers/networking/v1/BUILD | 36 +
.../networking/v1/expansion_generated.go | 27 +
.../listers/networking/v1/networkpolicy.go | 94 +
pkg/generated/openapi/BUILD | 1 +
pkg/master/BUILD | 3 +
pkg/printers/internalversion/BUILD | 1 +
pkg/registry/BUILD | 2 +
pkg/registry/networking/networkpolicy/BUILD | 51 +
.../networking/networkpolicy/storage/BUILD | 36 +
pkg/registry/networking/rest/BUILD | 37 +
staging/src/k8s.io/client-go/informers/BUILD | 2 +
.../src/k8s.io/client-go/informers/factory.go | 6 +
.../src/k8s.io/client-go/informers/generic.go | 5 +
.../client-go/informers/networking/BUILD | 18 +
.../informers/networking/interface.go | 44 +
.../client-go/informers/networking/v1/BUILD | 27 +
.../informers/networking/v1/interface.go | 43 +
.../informers/networking/v1/networkpolicy.go | 68 +
staging/src/k8s.io/client-go/kubernetes/BUILD | 1 +
.../k8s.io/client-go/kubernetes/clientset.go | 28 +
.../k8s.io/client-go/kubernetes/fake/BUILD | 3 +
.../kubernetes/fake/clientset_generated.go | 12 +
.../client-go/kubernetes/fake/register.go | 2 +
.../k8s.io/client-go/kubernetes/scheme/BUILD | 1 +
.../client-go/kubernetes/scheme/register.go | 2 +
.../kubernetes/typed/networking/v1/BUILD | 28 +
.../kubernetes/typed/networking/v1/doc.go | 20 +
.../kubernetes/typed/networking/v1/fake/BUILD | 29 +
.../typed/networking/v1/fake/doc.go | 20 +
.../v1/fake/fake_networking_client.go | 38 +
.../networking/v1/fake/fake_networkpolicy.go | 120 +
.../networking/v1/generated_expansion.go | 19 +
.../typed/networking/v1/networking_client.go | 88 +
.../typed/networking/v1/networkpolicy.go | 155 ++
.../client-go/listers/networking/v1/BUILD | 23 +
.../networking/v1/expansion_generated.go | 27 +
.../listers/networking/v1/networkpolicy.go | 94 +
.../client-go/pkg/apis/extensions/types.go | 8 +-
.../pkg/apis/extensions/v1beta1/BUILD | 1 +
.../pkg/apis/extensions/v1beta1/conversion.go | 166 ++
.../apis/extensions/v1beta1/generated.proto | 8 +-
.../pkg/apis/extensions/v1beta1/types.go | 8 +-
.../v1beta1/types_swagger_doc_generated.go | 3 +-
.../client-go/pkg/apis/networking/BUILD | 27 +
.../client-go/pkg/apis/networking/OWNERS | 4 +
.../client-go/pkg/apis/networking/doc.go | 18 +
.../client-go/pkg/apis/networking/register.go | 51 +
.../client-go/pkg/apis/networking/types.go | 115 +
.../client-go/pkg/apis/networking/v1/BUILD | 40 +
.../pkg/apis/networking/v1/conversion.go | 195 ++
.../pkg/apis/networking/v1/defaults.go | 34 +
.../client-go/pkg/apis/networking/v1/doc.go | 18 +
.../pkg/apis/networking/v1/generated.pb.go | 1345 ++++++++++
.../pkg/apis/networking/v1/generated.proto | 127 +
.../pkg/apis/networking/v1/register.go | 50 +
.../pkg/apis/networking/v1/types.generated.go | 2322 +++++++++++++++++
.../client-go/pkg/apis/networking/v1/types.go | 120 +
.../v1/types_swagger_doc_generated.go | 90 +
.../networking/v1/zz_generated.conversion.go | 195 ++
.../networking/v1/zz_generated.deepcopy.go | 182 ++
.../networking/v1/zz_generated.defaults.go | 51 +
.../apis/networking/zz_generated.deepcopy.go | 182 ++
140 files changed, 19392 insertions(+), 22 deletions(-)
create mode 100644 api/swagger-spec/networking.k8s.io.json
create mode 100644 api/swagger-spec/networking.k8s.io_v1.json
create mode 100755 docs/api-reference/networking.k8s.io/v1/definitions.html
create mode 100755 docs/api-reference/networking.k8s.io/v1/operations.html
create mode 100644 pkg/apis/networking/BUILD
create mode 100644 pkg/apis/networking/install/BUILD
create mode 100644 pkg/apis/networking/v1/BUILD
create mode 100644 pkg/apis/networking/v1/generated.pb.go
create mode 100644 pkg/apis/networking/v1/generated.proto
create mode 100644 pkg/apis/networking/v1/types_swagger_doc_generated.go
create mode 100644 pkg/apis/networking/v1/zz_generated.conversion.go
create mode 100644 pkg/apis/networking/v1/zz_generated.deepcopy.go
create mode 100644 pkg/apis/networking/v1/zz_generated.defaults.go
create mode 100644 pkg/apis/networking/validation/BUILD
create mode 100644 pkg/apis/networking/zz_generated.deepcopy.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/BUILD
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/doc.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/fake/BUILD
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/fake/doc.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/fake/fake_networking_client.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/fake/fake_networkpolicy.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/generated_expansion.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/networking_client.go
create mode 100644 pkg/client/clientset_generated/clientset/typed/networking/v1/networkpolicy.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/BUILD
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/doc.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake/BUILD
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake/doc.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake/fake_networking_client.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake/fake_networkpolicy.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/generated_expansion.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/networking_client.go
create mode 100644 pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/networkpolicy.go
create mode 100644 pkg/client/informers/informers_generated/externalversions/networking/BUILD
create mode 100644 pkg/client/informers/informers_generated/externalversions/networking/interface.go
create mode 100644 pkg/client/informers/informers_generated/externalversions/networking/v1/BUILD
create mode 100644 pkg/client/informers/informers_generated/externalversions/networking/v1/interface.go
create mode 100644 pkg/client/informers/informers_generated/externalversions/networking/v1/networkpolicy.go
create mode 100644 pkg/client/informers/informers_generated/internalversion/networking/BUILD
create mode 100644 pkg/client/informers/informers_generated/internalversion/networking/interface.go
create mode 100644 pkg/client/informers/informers_generated/internalversion/networking/internalversion/BUILD
create mode 100644 pkg/client/informers/informers_generated/internalversion/networking/internalversion/interface.go
create mode 100644 pkg/client/informers/informers_generated/internalversion/networking/internalversion/networkpolicy.go
create mode 100644 pkg/client/listers/networking/internalversion/BUILD
create mode 100644 pkg/client/listers/networking/internalversion/expansion_generated.go
create mode 100644 pkg/client/listers/networking/internalversion/networkpolicy.go
create mode 100644 pkg/client/listers/networking/v1/BUILD
create mode 100644 pkg/client/listers/networking/v1/expansion_generated.go
create mode 100644 pkg/client/listers/networking/v1/networkpolicy.go
create mode 100644 pkg/registry/networking/networkpolicy/BUILD
create mode 100644 pkg/registry/networking/networkpolicy/storage/BUILD
create mode 100644 pkg/registry/networking/rest/BUILD
create mode 100644 staging/src/k8s.io/client-go/informers/networking/BUILD
create mode 100644 staging/src/k8s.io/client-go/informers/networking/interface.go
create mode 100644 staging/src/k8s.io/client-go/informers/networking/v1/BUILD
create mode 100644 staging/src/k8s.io/client-go/informers/networking/v1/interface.go
create mode 100644 staging/src/k8s.io/client-go/informers/networking/v1/networkpolicy.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/BUILD
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/doc.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake/BUILD
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake/doc.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networking_client.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake/fake_networkpolicy.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/generated_expansion.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/networking_client.go
create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/networkpolicy.go
create mode 100644 staging/src/k8s.io/client-go/listers/networking/v1/BUILD
create mode 100644 staging/src/k8s.io/client-go/listers/networking/v1/expansion_generated.go
create mode 100644 staging/src/k8s.io/client-go/listers/networking/v1/networkpolicy.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/BUILD
create mode 100755 staging/src/k8s.io/client-go/pkg/apis/networking/OWNERS
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/doc.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/register.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/types.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/BUILD
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/conversion.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/defaults.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/doc.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/generated.pb.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/generated.proto
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/register.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/types.generated.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/types.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/types_swagger_doc_generated.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/zz_generated.conversion.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/zz_generated.deepcopy.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/v1/zz_generated.defaults.go
create mode 100644 staging/src/k8s.io/client-go/pkg/apis/networking/zz_generated.deepcopy.go
diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json
index c9ff98d6f94..74076fe26a4 100644
--- a/api/openapi-spec/swagger.json
+++ b/api/openapi-spec/swagger.json
@@ -35158,6 +35158,916 @@
}
]
},
+ "/apis/networking.k8s.io/": {
+ "get": {
+ "description": "get information of a group",
+ "consumes": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking"
+ ],
+ "operationId": "getNetworkingAPIGroup",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/apis/networking.k8s.io/v1/": {
+ "get": {
+ "description": "get available resources",
+ "consumes": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "getNetworkingV1APIResources",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies": {
+ "get": {
+ "description": "list or watch objects of kind NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "listNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyList"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "LIST",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "post": {
+ "description": "create a NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "createNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "POST",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "delete": {
+ "description": "delete collection of NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "deleteNetworkingV1CollectionNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "DELETECOLLECTION",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "object name and auth scope, such as for teams and projects",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ }
+ ]
+ },
+ "/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}": {
+ "get": {
+ "description": "read the specified NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "readNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.",
+ "name": "exact",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Should this value be exported. Export strips fields that a user can not specify.",
+ "name": "export",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "GET",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "put": {
+ "description": "replace the specified NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "replaceNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "PUT",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "delete": {
+ "description": "delete a NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "deleteNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions"
+ }
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.",
+ "name": "gracePeriodSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.",
+ "name": "orphanDependents",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.",
+ "name": "propagationPolicy",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "DELETE",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "patch": {
+ "description": "partially update the specified NetworkPolicy",
+ "consumes": [
+ "application/json-patch+json",
+ "application/merge-patch+json",
+ "application/strategic-merge-patch+json"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "patchNetworkingV1NamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "PATCH",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "name of the NetworkPolicy",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "object name and auth scope, such as for teams and projects",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ }
+ ]
+ },
+ "/apis/networking.k8s.io/v1/networkpolicies": {
+ "get": {
+ "description": "list or watch objects of kind NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "listNetworkingV1NetworkPolicyForAllNamespaces",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyList"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "LIST",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ]
+ },
+ "/apis/networking.k8s.io/v1/watch/namespaces/{namespace}/networkpolicies": {
+ "get": {
+ "description": "watch individual changes to a list of NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "watchNetworkingV1NamespacedNetworkPolicyList",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "WATCHLIST",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "object name and auth scope, such as for teams and projects",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ]
+ },
+ "/apis/networking.k8s.io/v1/watch/namespaces/{namespace}/networkpolicies/{name}": {
+ "get": {
+ "description": "watch changes to an object of kind NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "watchNetworkingV1NamespacedNetworkPolicy",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "WATCH",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "name of the NetworkPolicy",
+ "name": "name",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "object name and auth scope, such as for teams and projects",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ]
+ },
+ "/apis/networking.k8s.io/v1/watch/networkpolicies": {
+ "get": {
+ "description": "watch individual changes to a list of NetworkPolicy",
+ "consumes": [
+ "*/*"
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "schemes": [
+ "https"
+ ],
+ "tags": [
+ "networking_v1"
+ ],
+ "operationId": "watchNetworkingV1NetworkPolicyListForAllNamespaces",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ }
+ },
+ "x-kubernetes-action": "WATCHLIST",
+ "x-kubernetes-group-version-kind": {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ },
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "name": "fieldSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "If true, partially initialized resources are included in the response.",
+ "name": "includeUninitialized",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "name": "labelSelector",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "If 'true', then the output is pretty printed.",
+ "name": "pretty",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "string",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "name": "resourceVersion",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "integer",
+ "description": "Timeout for the list/watch call.",
+ "name": "timeoutSeconds",
+ "in": "query"
+ },
+ {
+ "uniqueItems": true,
+ "type": "boolean",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "name": "watch",
+ "in": "query"
+ }
+ ]
+ },
"/apis/policy/": {
"get": {
"description": "get information of a group",
@@ -52288,6 +53198,7 @@
}
},
"io.k8s.kubernetes.pkg.apis.extensions.v1beta1.NetworkPolicy": {
+ "description": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
@@ -52397,7 +53308,7 @@
],
"properties": {
"ingress": {
- "description": "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.",
+ "description": "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).",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.extensions.v1beta1.NetworkPolicyIngressRule"
@@ -52930,6 +53841,132 @@
}
]
},
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy": {
+ "description": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
+ "properties": {
+ "apiVersion": {
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
+ "type": "string"
+ },
+ "kind": {
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
+ },
+ "spec": {
+ "description": "Specification of the desired behavior for this NetworkPolicy.",
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicySpec"
+ }
+ },
+ "x-kubernetes-group-version-kind": [
+ {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicy"
+ }
+ ]
+ },
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyIngressRule": {
+ "description": "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.",
+ "properties": {
+ "from": {
+ "description": "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.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyPeer"
+ }
+ },
+ "ports": {
+ "description": "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.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyPort"
+ }
+ }
+ }
+ },
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyList": {
+ "description": "NetworkPolicyList is a list of NetworkPolicy objects.",
+ "required": [
+ "items"
+ ],
+ "properties": {
+ "apiVersion": {
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
+ "type": "string"
+ },
+ "items": {
+ "description": "Items is a list of schema objects.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicy"
+ }
+ },
+ "kind": {
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta"
+ }
+ },
+ "x-kubernetes-group-version-kind": [
+ {
+ "Group": "networking.k8s.io",
+ "Version": "v1",
+ "Kind": "NetworkPolicyList"
+ }
+ ]
+ },
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyPeer": {
+ "description": "NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields must be specified.",
+ "properties": {
+ "namespaceSelector": {
+ "description": "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.",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
+ },
+ "podSelector": {
+ "description": "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.",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
+ }
+ }
+ },
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyPort": {
+ "description": "NetworkPolicyPort describes a port to allow traffic on",
+ "properties": {
+ "port": {
+ "description": "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.",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
+ },
+ "protocol": {
+ "description": "The protocol (TCP or UDP) which traffic must match. If not specified, this field defaults to TCP.",
+ "type": "string"
+ }
+ }
+ },
+ "io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicySpec": {
+ "description": "NetworkPolicySpec provides the specification of a NetworkPolicy",
+ "required": [
+ "podSelector"
+ ],
+ "properties": {
+ "ingress": {
+ "description": "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)",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.networking.v1.NetworkPolicyIngressRule"
+ }
+ },
+ "podSelector": {
+ "description": "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.",
+ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
+ }
+ }
+ },
"io.k8s.kubernetes.pkg.apis.policy.v1beta1.Eviction": {
"description": "Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods/\u003cpod name\u003e/evictions.",
"properties": {
diff --git a/api/swagger-spec/extensions_v1beta1.json b/api/swagger-spec/extensions_v1beta1.json
index 22473d5265e..d779f674e54 100644
--- a/api/swagger-spec/extensions_v1beta1.json
+++ b/api/swagger-spec/extensions_v1beta1.json
@@ -9765,6 +9765,7 @@
},
"v1beta1.NetworkPolicy": {
"id": "v1beta1.NetworkPolicy",
+ "description": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
"properties": {
"kind": {
"type": "string",
@@ -9799,7 +9800,7 @@
"items": {
"$ref": "v1beta1.NetworkPolicyIngressRule"
},
- "description": "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."
+ "description": "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)."
}
}
},
diff --git a/api/swagger-spec/networking.k8s.io.json b/api/swagger-spec/networking.k8s.io.json
new file mode 100644
index 00000000000..a1a0e3383aa
--- /dev/null
+++ b/api/swagger-spec/networking.k8s.io.json
@@ -0,0 +1,114 @@
+{
+ "swaggerVersion": "1.2",
+ "apiVersion": "",
+ "basePath": "https://10.10.10.10:6443",
+ "resourcePath": "/apis/networking.k8s.io",
+ "info": {
+ "title": "",
+ "description": ""
+ },
+ "apis": [
+ {
+ "path": "/apis/networking.k8s.io",
+ "description": "get information of a group",
+ "operations": [
+ {
+ "type": "v1.APIGroup",
+ "method": "GET",
+ "summary": "get information of a group",
+ "nickname": "getAPIGroup",
+ "parameters": [],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ]
+ }
+ ]
+ }
+ ],
+ "models": {
+ "v1.APIGroup": {
+ "id": "v1.APIGroup",
+ "description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
+ "required": [
+ "name",
+ "versions",
+ "serverAddressByClientCIDRs"
+ ],
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "name": {
+ "type": "string",
+ "description": "name is the name of the group."
+ },
+ "versions": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.GroupVersionForDiscovery"
+ },
+ "description": "versions are the versions supported in this group."
+ },
+ "preferredVersion": {
+ "$ref": "v1.GroupVersionForDiscovery",
+ "description": "preferredVersion is the version preferred by the API server, which probably is the storage version."
+ },
+ "serverAddressByClientCIDRs": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.ServerAddressByClientCIDR"
+ },
+ "description": "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP."
+ }
+ }
+ },
+ "v1.GroupVersionForDiscovery": {
+ "id": "v1.GroupVersionForDiscovery",
+ "description": "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.",
+ "required": [
+ "groupVersion",
+ "version"
+ ],
+ "properties": {
+ "groupVersion": {
+ "type": "string",
+ "description": "groupVersion specifies the API group and version in the form \"group/version\""
+ },
+ "version": {
+ "type": "string",
+ "description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion."
+ }
+ }
+ },
+ "v1.ServerAddressByClientCIDR": {
+ "id": "v1.ServerAddressByClientCIDR",
+ "description": "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.",
+ "required": [
+ "clientCIDR",
+ "serverAddress"
+ ],
+ "properties": {
+ "clientCIDR": {
+ "type": "string",
+ "description": "The CIDR with which clients can match their IP to figure out the server address that they should use."
+ },
+ "serverAddress": {
+ "type": "string",
+ "description": "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port."
+ }
+ }
+ }
+ }
+ }
diff --git a/api/swagger-spec/networking.k8s.io_v1.json b/api/swagger-spec/networking.k8s.io_v1.json
new file mode 100644
index 00000000000..55ed0f3c84d
--- /dev/null
+++ b/api/swagger-spec/networking.k8s.io_v1.json
@@ -0,0 +1,1455 @@
+{
+ "swaggerVersion": "1.2",
+ "apiVersion": "networking.k8s.io/v1",
+ "basePath": "https://10.10.10.10:6443",
+ "resourcePath": "/apis/networking.k8s.io/v1",
+ "info": {
+ "title": "",
+ "description": ""
+ },
+ "apis": [
+ {
+ "path": "/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.NetworkPolicyList",
+ "method": "GET",
+ "summary": "list or watch objects of kind NetworkPolicy",
+ "nickname": "listNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicyList"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ },
+ {
+ "type": "v1.NetworkPolicy",
+ "method": "POST",
+ "summary": "create a NetworkPolicy",
+ "nickname": "createNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "v1.NetworkPolicy",
+ "paramType": "body",
+ "name": "body",
+ "description": "",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicy"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ },
+ {
+ "type": "v1.Status",
+ "method": "DELETE",
+ "summary": "delete collection of NetworkPolicy",
+ "nickname": "deletecollectionNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.Status"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1/watch/namespaces/{namespace}/networkpolicies",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.WatchEvent",
+ "method": "GET",
+ "summary": "watch individual changes to a list of NetworkPolicy",
+ "nickname": "watchNamespacedNetworkPolicyList",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.WatchEvent"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies/{name}",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.NetworkPolicy",
+ "method": "GET",
+ "summary": "read the specified NetworkPolicy",
+ "nickname": "readNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "export",
+ "description": "Should this value be exported. Export strips fields that a user can not specify.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "exact",
+ "description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "name",
+ "description": "name of the NetworkPolicy",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicy"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ },
+ {
+ "type": "v1.NetworkPolicy",
+ "method": "PUT",
+ "summary": "replace the specified NetworkPolicy",
+ "nickname": "replaceNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "v1.NetworkPolicy",
+ "paramType": "body",
+ "name": "body",
+ "description": "",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "name",
+ "description": "name of the NetworkPolicy",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicy"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ },
+ {
+ "type": "v1.NetworkPolicy",
+ "method": "PATCH",
+ "summary": "partially update the specified NetworkPolicy",
+ "nickname": "patchNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "v1.Patch",
+ "paramType": "body",
+ "name": "body",
+ "description": "",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "name",
+ "description": "name of the NetworkPolicy",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicy"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "application/json-patch+json",
+ "application/merge-patch+json",
+ "application/strategic-merge-patch+json"
+ ]
+ },
+ {
+ "type": "v1.Status",
+ "method": "DELETE",
+ "summary": "delete a NetworkPolicy",
+ "nickname": "deleteNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "v1.DeleteOptions",
+ "paramType": "body",
+ "name": "body",
+ "description": "",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "gracePeriodSeconds",
+ "description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "orphanDependents",
+ "description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "propagationPolicy",
+ "description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "name",
+ "description": "name of the NetworkPolicy",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.Status"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1/watch/namespaces/{namespace}/networkpolicies/{name}",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.WatchEvent",
+ "method": "GET",
+ "summary": "watch changes to an object of kind NetworkPolicy",
+ "nickname": "watchNamespacedNetworkPolicy",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "namespace",
+ "description": "object name and auth scope, such as for teams and projects",
+ "required": true,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "path",
+ "name": "name",
+ "description": "name of the NetworkPolicy",
+ "required": true,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.WatchEvent"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1/networkpolicies",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.NetworkPolicyList",
+ "method": "GET",
+ "summary": "list or watch objects of kind NetworkPolicy",
+ "nickname": "listNetworkPolicyForAllNamespaces",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.NetworkPolicyList"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1/watch/networkpolicies",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.WatchEvent",
+ "method": "GET",
+ "summary": "watch individual changes to a list of NetworkPolicy",
+ "nickname": "watchNetworkPolicyListForAllNamespaces",
+ "parameters": [
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "pretty",
+ "description": "If 'true', then the output is pretty printed.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "labelSelector",
+ "description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "fieldSelector",
+ "description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "includeUninitialized",
+ "description": "If true, partially initialized resources are included in the response.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "boolean",
+ "paramType": "query",
+ "name": "watch",
+ "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "string",
+ "paramType": "query",
+ "name": "resourceVersion",
+ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
+ "required": false,
+ "allowMultiple": false
+ },
+ {
+ "type": "integer",
+ "paramType": "query",
+ "name": "timeoutSeconds",
+ "description": "Timeout for the list/watch call.",
+ "required": false,
+ "allowMultiple": false
+ }
+ ],
+ "responseMessages": [
+ {
+ "code": 200,
+ "message": "OK",
+ "responseModel": "v1.WatchEvent"
+ }
+ ],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf",
+ "application/json;stream=watch",
+ "application/vnd.kubernetes.protobuf;stream=watch"
+ ],
+ "consumes": [
+ "*/*"
+ ]
+ }
+ ]
+ },
+ {
+ "path": "/apis/networking.k8s.io/v1",
+ "description": "API at /apis/networking.k8s.io/v1",
+ "operations": [
+ {
+ "type": "v1.APIResourceList",
+ "method": "GET",
+ "summary": "get available resources",
+ "nickname": "getAPIResources",
+ "parameters": [],
+ "produces": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ],
+ "consumes": [
+ "application/json",
+ "application/yaml",
+ "application/vnd.kubernetes.protobuf"
+ ]
+ }
+ ]
+ }
+ ],
+ "models": {
+ "v1.NetworkPolicyList": {
+ "id": "v1.NetworkPolicyList",
+ "description": "NetworkPolicyList is a list of NetworkPolicy objects.",
+ "required": [
+ "items"
+ ],
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "metadata": {
+ "$ref": "v1.ListMeta",
+ "description": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.NetworkPolicy"
+ },
+ "description": "Items is a list of schema objects."
+ }
+ }
+ },
+ "v1.ListMeta": {
+ "id": "v1.ListMeta",
+ "description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
+ "properties": {
+ "selfLink": {
+ "type": "string",
+ "description": "SelfLink is a URL representing this object. Populated by the system. Read-only."
+ },
+ "resourceVersion": {
+ "type": "string",
+ "description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency"
+ }
+ }
+ },
+ "v1.NetworkPolicy": {
+ "id": "v1.NetworkPolicy",
+ "description": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "metadata": {
+ "$ref": "v1.ObjectMeta",
+ "description": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
+ },
+ "spec": {
+ "$ref": "v1.NetworkPolicySpec",
+ "description": "Specification of the desired behavior for this NetworkPolicy."
+ }
+ }
+ },
+ "v1.ObjectMeta": {
+ "id": "v1.ObjectMeta",
+ "description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names"
+ },
+ "generateName": {
+ "type": "string",
+ "description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#idempotency"
+ },
+ "namespace": {
+ "type": "string",
+ "description": "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces"
+ },
+ "selfLink": {
+ "type": "string",
+ "description": "SelfLink is a URL representing this object. Populated by the system. Read-only."
+ },
+ "uid": {
+ "type": "string",
+ "description": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids"
+ },
+ "resourceVersion": {
+ "type": "string",
+ "description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency"
+ },
+ "generation": {
+ "type": "integer",
+ "format": "int64",
+ "description": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only."
+ },
+ "creationTimestamp": {
+ "type": "string",
+ "description": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
+ },
+ "deletionTimestamp": {
+ "type": "string",
+ "description": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
+ },
+ "deletionGracePeriodSeconds": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only."
+ },
+ "labels": {
+ "type": "object",
+ "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels"
+ },
+ "annotations": {
+ "type": "object",
+ "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations"
+ },
+ "ownerReferences": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.OwnerReference"
+ },
+ "description": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller."
+ },
+ "initializers": {
+ "$ref": "v1.Initializers",
+ "description": "An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.\n\nWhen an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user."
+ },
+ "finalizers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
+ },
+ "clusterName": {
+ "type": "string",
+ "description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
+ }
+ }
+ },
+ "v1.OwnerReference": {
+ "id": "v1.OwnerReference",
+ "description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.",
+ "required": [
+ "apiVersion",
+ "kind",
+ "name",
+ "uid"
+ ],
+ "properties": {
+ "apiVersion": {
+ "type": "string",
+ "description": "API version of the referent."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Kind of the referent. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "name": {
+ "type": "string",
+ "description": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names"
+ },
+ "uid": {
+ "type": "string",
+ "description": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids"
+ },
+ "controller": {
+ "type": "boolean",
+ "description": "If true, this reference points to the managing controller."
+ },
+ "blockOwnerDeletion": {
+ "type": "boolean",
+ "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned."
+ }
+ }
+ },
+ "v1.Initializers": {
+ "id": "v1.Initializers",
+ "description": "Initializers tracks the progress of initialization.",
+ "required": [
+ "pending"
+ ],
+ "properties": {
+ "pending": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.Initializer"
+ },
+ "description": "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients."
+ },
+ "result": {
+ "$ref": "v1.Status",
+ "description": "If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion."
+ }
+ }
+ },
+ "v1.Initializer": {
+ "id": "v1.Initializer",
+ "description": "Initializer is information about an initializer that has not yet completed.",
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "name of the process that is responsible for initializing this object."
+ }
+ }
+ },
+ "v1.Status": {
+ "id": "v1.Status",
+ "description": "Status is a return value for calls that don't return other objects.",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "metadata": {
+ "$ref": "v1.ListMeta",
+ "description": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "status": {
+ "type": "string",
+ "description": "Status of the operation. One of: \"Success\" or \"Failure\". More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status"
+ },
+ "message": {
+ "type": "string",
+ "description": "A human-readable description of the status of this operation."
+ },
+ "reason": {
+ "type": "string",
+ "description": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it."
+ },
+ "details": {
+ "$ref": "v1.StatusDetails",
+ "description": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type."
+ },
+ "code": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Suggested HTTP return code for this status, 0 if not set."
+ }
+ }
+ },
+ "v1.StatusDetails": {
+ "id": "v1.StatusDetails",
+ "description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described)."
+ },
+ "group": {
+ "type": "string",
+ "description": "The group attribute of the resource associated with the status StatusReason."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "uid": {
+ "type": "string",
+ "description": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids"
+ },
+ "causes": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.StatusCause"
+ },
+ "description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes."
+ },
+ "retryAfterSeconds": {
+ "type": "integer",
+ "format": "int32",
+ "description": "If specified, the time in seconds before the operation should be retried."
+ }
+ }
+ },
+ "v1.StatusCause": {
+ "id": "v1.StatusCause",
+ "description": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.",
+ "properties": {
+ "reason": {
+ "type": "string",
+ "description": "A machine-readable description of the cause of the error. If this value is empty there is no information available."
+ },
+ "message": {
+ "type": "string",
+ "description": "A human-readable description of the cause of the error. This field may be presented as-is to a reader."
+ },
+ "field": {
+ "type": "string",
+ "description": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\""
+ }
+ }
+ },
+ "v1.NetworkPolicySpec": {
+ "id": "v1.NetworkPolicySpec",
+ "description": "NetworkPolicySpec provides the specification of a NetworkPolicy",
+ "required": [
+ "podSelector"
+ ],
+ "properties": {
+ "podSelector": {
+ "$ref": "v1.LabelSelector",
+ "description": "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": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.NetworkPolicyIngressRule"
+ },
+ "description": "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)"
+ }
+ }
+ },
+ "v1.LabelSelector": {
+ "id": "v1.LabelSelector",
+ "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
+ "properties": {
+ "matchLabels": {
+ "type": "object",
+ "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed."
+ },
+ "matchExpressions": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.LabelSelectorRequirement"
+ },
+ "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed."
+ }
+ }
+ },
+ "v1.LabelSelectorRequirement": {
+ "id": "v1.LabelSelectorRequirement",
+ "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
+ "required": [
+ "key",
+ "operator"
+ ],
+ "properties": {
+ "key": {
+ "type": "string",
+ "description": "key is the label key that the selector applies to."
+ },
+ "operator": {
+ "type": "string",
+ "description": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist."
+ },
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch."
+ }
+ }
+ },
+ "v1.NetworkPolicyIngressRule": {
+ "id": "v1.NetworkPolicyIngressRule",
+ "description": "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.",
+ "properties": {
+ "ports": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.NetworkPolicyPort"
+ },
+ "description": "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": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.NetworkPolicyPeer"
+ },
+ "description": "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."
+ }
+ }
+ },
+ "v1.NetworkPolicyPort": {
+ "id": "v1.NetworkPolicyPort",
+ "description": "NetworkPolicyPort describes a port to allow traffic on",
+ "properties": {
+ "protocol": {
+ "$ref": "v1.Protocol",
+ "description": "The protocol (TCP or UDP) which traffic must match. If not specified, this field defaults to TCP."
+ },
+ "port": {
+ "type": "string",
+ "description": "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."
+ }
+ }
+ },
+ "v1.Protocol": {
+ "id": "v1.Protocol",
+ "properties": {}
+ },
+ "v1.NetworkPolicyPeer": {
+ "id": "v1.NetworkPolicyPeer",
+ "description": "NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields must be specified.",
+ "properties": {
+ "podSelector": {
+ "$ref": "v1.LabelSelector",
+ "description": "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": {
+ "$ref": "v1.LabelSelector",
+ "description": "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."
+ }
+ }
+ },
+ "v1.WatchEvent": {
+ "id": "v1.WatchEvent",
+ "required": [
+ "type",
+ "object"
+ ],
+ "properties": {
+ "type": {
+ "type": "string"
+ },
+ "object": {
+ "type": "string"
+ }
+ }
+ },
+ "v1.Patch": {
+ "id": "v1.Patch",
+ "description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.",
+ "properties": {}
+ },
+ "v1.DeleteOptions": {
+ "id": "v1.DeleteOptions",
+ "description": "DeleteOptions may be provided when deleting an API object.",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "gracePeriodSeconds": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately."
+ },
+ "preconditions": {
+ "$ref": "v1.Preconditions",
+ "description": "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned."
+ },
+ "orphanDependents": {
+ "type": "boolean",
+ "description": "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both."
+ },
+ "propagationPolicy": {
+ "$ref": "v1.DeletionPropagation",
+ "description": "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy."
+ }
+ }
+ },
+ "v1.Preconditions": {
+ "id": "v1.Preconditions",
+ "description": "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.",
+ "properties": {
+ "uid": {
+ "$ref": "types.UID",
+ "description": "Specifies the target UID."
+ }
+ }
+ },
+ "types.UID": {
+ "id": "types.UID",
+ "properties": {}
+ },
+ "v1.DeletionPropagation": {
+ "id": "v1.DeletionPropagation",
+ "properties": {}
+ },
+ "v1.APIResourceList": {
+ "id": "v1.APIResourceList",
+ "description": "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.",
+ "required": [
+ "groupVersion",
+ "resources"
+ ],
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
+ },
+ "groupVersion": {
+ "type": "string",
+ "description": "groupVersion is the group and version this APIResourceList is for."
+ },
+ "resources": {
+ "type": "array",
+ "items": {
+ "$ref": "v1.APIResource"
+ },
+ "description": "resources contains the name of the resources and if they are namespaced."
+ }
+ }
+ },
+ "v1.APIResource": {
+ "id": "v1.APIResource",
+ "description": "APIResource specifies the name of a resource and whether it is namespaced.",
+ "required": [
+ "name",
+ "singularName",
+ "namespaced",
+ "kind",
+ "verbs"
+ ],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "name is the plural name of the resource."
+ },
+ "singularName": {
+ "type": "string",
+ "description": "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface."
+ },
+ "namespaced": {
+ "type": "boolean",
+ "description": "namespaced indicates if a resource is namespaced or not."
+ },
+ "kind": {
+ "type": "string",
+ "description": "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')"
+ },
+ "verbs": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)"
+ },
+ "shortNames": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "shortNames is a list of suggested short names of the resource."
+ }
+ }
+ }
+ }
+ }
diff --git a/api/swagger-spec/resourceListing.json b/api/swagger-spec/resourceListing.json
index ea3f195a62a..6429c17b445 100644
--- a/api/swagger-spec/resourceListing.json
+++ b/api/swagger-spec/resourceListing.json
@@ -85,6 +85,14 @@
"path": "/apis/extensions",
"description": "get information of a group"
},
+ {
+ "path": "/apis/networking.k8s.io/v1",
+ "description": "API at /apis/networking.k8s.io/v1"
+ },
+ {
+ "path": "/apis/networking.k8s.io",
+ "description": "get information of a group"
+ },
{
"path": "/apis/policy/v1beta1",
"description": "API at /apis/policy/v1beta1"
diff --git a/cmd/kube-apiserver/app/BUILD b/cmd/kube-apiserver/app/BUILD
index 5154375b367..9ce59dacd71 100644
--- a/cmd/kube-apiserver/app/BUILD
+++ b/cmd/kube-apiserver/app/BUILD
@@ -23,6 +23,7 @@ go_library(
"//pkg/apis/apps:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/extensions:go_default_library",
+ "//pkg/apis/networking:go_default_library",
"//pkg/capabilities:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/informers/informers_generated/internalversion:go_default_library",
diff --git a/docs/api-reference/extensions/v1beta1/definitions.html b/docs/api-reference/extensions/v1beta1/definitions.html
index 36d660a86b1..9072ebc4fde 100755
--- a/docs/api-reference/extensions/v1beta1/definitions.html
+++ b/docs/api-reference/extensions/v1beta1/definitions.html
@@ -5211,6 +5211,9 @@ Examples:
v1beta1.NetworkPolicy
+
+
NetworkPolicy describes what network traffic is allowed for a set of Pods
+
@@ -5466,7 +5469,7 @@ Examples:
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. |
+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). |
false |
v1beta1.NetworkPolicyIngressRule array |
|
@@ -8117,7 +8120,7 @@ Both these may change in the future. Incoming requests are matched against the h
+
+
+
+
Top Level API Objects
+
+
+
+
Definitions
+
+
+
v1.APIResourceList
+
+
APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+kind |
+Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+false |
+string |
+ |
+
+
+apiVersion |
+APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources |
+false |
+string |
+ |
+
+
+groupVersion |
+groupVersion is the group and version this APIResourceList is for. |
+true |
+string |
+ |
+
+
+resources |
+resources contains the name of the resources and if they are namespaced. |
+true |
+v1.APIResource array |
+ |
+
+
+
+
+
+
+
v1.Patch
+
+
Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
+
+
+
+
v1.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.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+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. |
+false |
+v1.NetworkPolicyPort array |
+ |
+
+
+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. |
+false |
+v1.NetworkPolicyPeer array |
+ |
+
+
+
+
+
+
+
v1.DeleteOptions
+
+
DeleteOptions may be provided when deleting an API object.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+kind |
+Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+false |
+string |
+ |
+
+
+apiVersion |
+APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources |
+false |
+string |
+ |
+
+
+gracePeriodSeconds |
+The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
+false |
+integer (int64) |
+ |
+
+
+preconditions |
+Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. |
+false |
+v1.Preconditions |
+ |
+
+
+orphanDependents |
+Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object’s finalizers list. Either this field or PropagationPolicy may be set, but not both. |
+false |
+boolean |
+false |
+
+
+propagationPolicy |
+Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
+false |
+v1.DeletionPropagation |
+ |
+
+
+
+
+
+
+
v1.Protocol
+
+
+
+
+
+
ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+selfLink |
+SelfLink is a URL representing this object. Populated by the system. Read-only. |
+false |
+string |
+ |
+
+
+resourceVersion |
+String that identifies the server’s internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency |
+false |
+string |
+ |
+
+
+
+
+
+
+
v1.StatusDetails
+
+
StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+name |
+The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described). |
+false |
+string |
+ |
+
+
+group |
+The group attribute of the resource associated with the status StatusReason. |
+false |
+string |
+ |
+
+
+kind |
+The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+false |
+string |
+ |
+
+
+uid |
+UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids |
+false |
+string |
+ |
+
+
+causes |
+The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes. |
+false |
+v1.StatusCause array |
+ |
+
+
+retryAfterSeconds |
+If specified, the time in seconds before the operation should be retried. |
+false |
+integer (int32) |
+ |
+
+
+
+
+
+
+
v1.Preconditions
+
+
Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+uid |
+Specifies the target UID. |
+false |
+types.UID |
+ |
+
+
+
+
+
+
+
v1.Initializers
+
+
Initializers tracks the progress of initialization.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+pending |
+Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients. |
+true |
+v1.Initializer array |
+ |
+
+
+result |
+If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion. |
+false |
+v1.Status |
+ |
+
+
+
+
+
+
+
v1.Initializer
+
+
Initializer is information about an initializer that has not yet completed.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+name |
+name of the process that is responsible for initializing this object. |
+true |
+string |
+ |
+
+
+
+
+
+
+
v1.Status
+
+
Status is a return value for calls that don’t return other objects.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+kind |
+Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+false |
+string |
+ |
+
+
+apiVersion |
+APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources |
+false |
+string |
+ |
+
+
+metadata |
+Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+false |
+v1.ListMeta |
+ |
+
+
+status |
+Status of the operation. One of: "Success" or "Failure". More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status |
+false |
+string |
+ |
+
+
+message |
+A human-readable description of the status of this operation. |
+false |
+string |
+ |
+
+
+reason |
+A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it. |
+false |
+string |
+ |
+
+
+details |
+Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type. |
+false |
+v1.StatusDetails |
+ |
+
+
+code |
+Suggested HTTP return code for this status, 0 if not set. |
+false |
+integer (int32) |
+ |
+
+
+
+
+
+
+
v1.WatchEvent
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+type |
+ |
+true |
+string |
+ |
+
+
+object |
+ |
+true |
+string |
+ |
+
+
+
+
+
+
+
v1.NetworkPolicyPort
+
+
NetworkPolicyPort describes a port to allow traffic on
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+protocol |
+The protocol (TCP or UDP) which traffic must match. If not specified, this field defaults to TCP. |
+false |
+v1.Protocol |
+ |
+
+
+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. |
+false |
+string |
+ |
+
+
+
+
+
+
+
v1.LabelSelector
+
+
A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+matchLabels |
+matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. |
+false |
+object |
+ |
+
+
+matchExpressions |
+matchExpressions is a list of label selector requirements. The requirements are ANDed. |
+false |
+v1.LabelSelectorRequirement array |
+ |
+
+
+
+
+
+
+
+
+
ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+name |
+Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names |
+false |
+string |
+ |
+
+
+generateName |
+GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.
+
+If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).
+
+Applied only if Name is not specified. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#idempotency |
+false |
+string |
+ |
+
+
+namespace |
+Namespace defines the space within each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.
+
+Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces |
+false |
+string |
+ |
+
+
+selfLink |
+SelfLink is a URL representing this object. Populated by the system. Read-only. |
+false |
+string |
+ |
+
+
+uid |
+UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.
+
+Populated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids |
+false |
+string |
+ |
+
+
+resourceVersion |
+An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
+
+Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency |
+false |
+string |
+ |
+
+
+generation |
+A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. |
+false |
+integer (int64) |
+ |
+
+
+creationTimestamp |
+CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
+
+Populated by the system. Read-only. Null for lists. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata |
+false |
+string |
+ |
+
+
+deletionTimestamp |
+DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.
+
+Populated by the system when a graceful deletion is requested. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata |
+false |
+string |
+ |
+
+
+deletionGracePeriodSeconds |
+Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. |
+false |
+integer (int64) |
+ |
+
+
+labels |
+Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels |
+false |
+object |
+ |
+
+
+annotations |
+Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations |
+false |
+object |
+ |
+
+
+ownerReferences |
+List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. |
+false |
+v1.OwnerReference array |
+ |
+
+
+initializers |
+An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven’t explicitly asked to observe uninitialized objects.
+
+When an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user. |
+false |
+v1.Initializers |
+ |
+
+
+finalizers |
+Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. |
+false |
+string array |
+ |
+
+
+clusterName |
+The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. |
+false |
+string |
+ |
+
+
+
+
+
+
+
v1.OwnerReference
+
+
OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+apiVersion |
+API version of the referent. |
+true |
+string |
+ |
+
+
+kind |
+Kind of the referent. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds |
+true |
+string |
+ |
+
+
+name |
+Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names |
+true |
+string |
+ |
+
+
+uid |
+UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids |
+true |
+string |
+ |
+
+
+controller |
+If true, this reference points to the managing controller. |
+false |
+boolean |
+false |
+
+
+blockOwnerDeletion |
+If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. |
+false |
+boolean |
+false |
+
+
+
+
+
+
+
v1.NetworkPolicySpec
+
+
NetworkPolicySpec provides the specification of a NetworkPolicy
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+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. |
+true |
+v1.LabelSelector |
+ |
+
+
+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) |
+false |
+v1.NetworkPolicyIngressRule array |
+ |
+
+
+
+
+
+
+
v1.LabelSelectorRequirement
+
+
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+key |
+key is the label key that the selector applies to. |
+true |
+string |
+ |
+
+
+operator |
+operator represents a key’s relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist. |
+true |
+string |
+ |
+
+
+values |
+values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. |
+false |
+string array |
+ |
+
+
+
+
+
+
+
v1.NetworkPolicy
+
+
NetworkPolicy describes what network traffic is allowed for a set of Pods
+
+
+
+
+
+
v1.APIResource
+
+
APIResource specifies the name of a resource and whether it is namespaced.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+name |
+name is the plural name of the resource. |
+true |
+string |
+ |
+
+
+singularName |
+singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface. |
+true |
+string |
+ |
+
+
+namespaced |
+namespaced indicates if a resource is namespaced or not. |
+true |
+boolean |
+false |
+
+
+kind |
+kind is the kind for the resource (e.g. Foo is the kind for a resource foo) |
+true |
+string |
+ |
+
+
+verbs |
+verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy) |
+true |
+string array |
+ |
+
+
+shortNames |
+shortNames is a list of suggested short names of the resource. |
+false |
+string array |
+ |
+
+
+
+
+
+
+
v1.NetworkPolicyPeer
+
+
NetworkPolicyPeer describes a peer to allow traffic from. Exactly one of its fields must be specified.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+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. |
+false |
+v1.LabelSelector |
+ |
+
+
+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. |
+false |
+v1.LabelSelector |
+ |
+
+
+
+
+
+
+
types.UID
+
+
+
+
v1.StatusCause
+
+
StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.
+
+
+
+
+
+
+
+
+
+
+
+| Name |
+Description |
+Required |
+Schema |
+Default |
+
+
+
+
+reason |
+A machine-readable description of the cause of the error. If this value is empty there is no information available. |
+false |
+string |
+ |
+
+
+message |
+A human-readable description of the cause of the error. This field may be presented as-is to a reader. |
+false |
+string |
+ |
+
+
+field |
+The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.
+
+Examples:
+ "name" - the field "name" on the current resource
+ "items[0].name" - the field "name" on the first array entry in "items" |
+false |
+string |
+ |
+
+
+
+
+
+
+
v1.DeletionPropagation
+
+
+
+
v1.NetworkPolicyList
+
+
NetworkPolicyList is a list of NetworkPolicy objects.
+
+
+
+
+
+
any
+
+
Represents an untyped JSON map - see the description of the field for more info about the structure of this object.
+
+
+
+
+
+
+
diff --git a/docs/api-reference/networking.k8s.io/v1/definitions.html b/docs/api-reference/networking.k8s.io/v1/definitions.html
new file mode 100755
index 00000000000..05f5efa0f13
--- /dev/null
+++ b/docs/api-reference/networking.k8s.io/v1/definitions.html
@@ -0,0 +1,1590 @@
+
+
+