blob: ab3731e9c399463284028c41df5aef1f178886dc [file] [log] [blame]
sslobodrd046be82019-01-16 10:02:22 -05001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17
18// This file was autogenerated by go-to-protobuf. Do not edit it manually!
19
20syntax = 'proto2';
21
22package k8s.io.api.networking.v1;
23
24import "k8s.io/api/core/v1/generated.proto";
25import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
26import "k8s.io/apimachinery/pkg/runtime/generated.proto";
27import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
28import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
29
30// Package-wide variables from generator "generated".
31option go_package = "v1";
32
33// IPBlock describes a particular CIDR (Ex. "192.168.1.1/24") that is allowed to the pods
34// matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should
35// not be included within this rule.
36message IPBlock {
37 // CIDR is a string representing the IP Block
38 // Valid examples are "192.168.1.1/24"
39 optional string cidr = 1;
40
41 // Except is a slice of CIDRs that should not be included within an IP Block
42 // Valid examples are "192.168.1.1/24"
43 // Except values will be rejected if they are outside the CIDR range
44 // +optional
45 repeated string except = 2;
46}
47
48// NetworkPolicy describes what network traffic is allowed for a set of Pods
49message NetworkPolicy {
50 // Standard object's metadata.
51 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
52 // +optional
53 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
54
55 // Specification of the desired behavior for this NetworkPolicy.
56 // +optional
57 optional NetworkPolicySpec spec = 2;
58}
59
60// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods
61// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to.
62// This type is beta-level in 1.8
63message NetworkPolicyEgressRule {
64 // List of destination ports for outgoing traffic.
65 // Each item in this list is combined using a logical OR. If this field is
66 // empty or missing, this rule matches all ports (traffic not restricted by port).
67 // If this field is present and contains at least one item, then this rule allows
68 // traffic only if the traffic matches at least one port in the list.
69 // +optional
70 repeated NetworkPolicyPort ports = 1;
71
72 // List of destinations for outgoing traffic of pods selected for this rule.
73 // Items in this list are combined using a logical OR operation. If this field is
74 // empty or missing, this rule matches all destinations (traffic not restricted by
75 // destination). If this field is present and contains at least one item, this rule
76 // allows traffic only if the traffic matches at least one item in the to list.
77 // +optional
78 repeated NetworkPolicyPeer to = 2;
79}
80
81// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods
82// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.
83message NetworkPolicyIngressRule {
84 // List of ports which should be made accessible on the pods selected for this
85 // rule. Each item in this list is combined using a logical OR. If this field is
86 // empty or missing, this rule matches all ports (traffic not restricted by port).
87 // If this field is present and contains at least one item, then this rule allows
88 // traffic only if the traffic matches at least one port in the list.
89 // +optional
90 repeated NetworkPolicyPort ports = 1;
91
92 // List of sources which should be able to access the pods selected for this rule.
93 // Items in this list are combined using a logical OR operation. If this field is
94 // empty or missing, this rule matches all sources (traffic not restricted by
95 // source). If this field is present and contains at least on item, this rule
96 // allows traffic only if the traffic matches at least one item in the from list.
97 // +optional
98 repeated NetworkPolicyPeer from = 2;
99}
100
101// NetworkPolicyList is a list of NetworkPolicy objects.
102message NetworkPolicyList {
103 // Standard list metadata.
104 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
105 // +optional
106 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
107
108 // Items is a list of schema objects.
109 repeated NetworkPolicy items = 2;
110}
111
112// NetworkPolicyPeer describes a peer to allow traffic from. Only certain combinations of
113// fields are allowed
114message NetworkPolicyPeer {
115 // This is a label selector which selects Pods. This field follows standard label
116 // selector semantics; if present but empty, it selects all pods.
117 //
118 // If NamespaceSelector is also set, then the NetworkPolicyPeer as a whole selects
119 // the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
120 // Otherwise it selects the Pods matching PodSelector in the policy's own Namespace.
121 // +optional
122 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
123
124 // Selects Namespaces using cluster-scoped labels. This field follows standard label
125 // selector semantics; if present but empty, it selects all namespaces.
126 //
127 // If PodSelector is also set, then the NetworkPolicyPeer as a whole selects
128 // the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
129 // Otherwise it selects all Pods in the Namespaces selected by NamespaceSelector.
130 // +optional
131 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 2;
132
133 // IPBlock defines policy on a particular IPBlock. If this field is set then
134 // neither of the other fields can be.
135 // +optional
136 optional IPBlock ipBlock = 3;
137}
138
139// NetworkPolicyPort describes a port to allow traffic on
140message NetworkPolicyPort {
141 // The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this
142 // field defaults to TCP.
143 // +optional
144 optional string protocol = 1;
145
146 // The port on the given protocol. This can either be a numerical or named port on
147 // a pod. If this field is not provided, this matches all port names and numbers.
148 // +optional
149 optional k8s.io.apimachinery.pkg.util.intstr.IntOrString port = 2;
150}
151
152// NetworkPolicySpec provides the specification of a NetworkPolicy
153message NetworkPolicySpec {
154 // Selects the pods to which this NetworkPolicy object applies. The array of
155 // ingress rules is applied to any pods selected by this field. Multiple network
156 // policies can select the same set of pods. In this case, the ingress rules for
157 // each are combined additively. This field is NOT optional and follows standard
158 // label selector semantics. An empty podSelector matches all pods in this
159 // namespace.
160 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
161
162 // List of ingress rules to be applied to the selected pods. Traffic is allowed to
163 // a pod if there are no NetworkPolicies selecting the pod
164 // (and cluster policy otherwise allows the traffic), OR if the traffic source is
165 // the pod's local node, OR if the traffic matches at least one ingress rule
166 // across all of the NetworkPolicy objects whose podSelector matches the pod. If
167 // this field is empty then this NetworkPolicy does not allow any traffic (and serves
168 // solely to ensure that the pods it selects are isolated by default)
169 // +optional
170 repeated NetworkPolicyIngressRule ingress = 2;
171
172 // List of egress rules to be applied to the selected pods. Outgoing traffic is
173 // allowed if there are no NetworkPolicies selecting the pod (and cluster policy
174 // otherwise allows the traffic), OR if the traffic matches at least one egress rule
175 // across all of the NetworkPolicy objects whose podSelector matches the pod. If
176 // this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
177 // solely to ensure that the pods it selects are isolated by default).
178 // This field is beta-level in 1.8
179 // +optional
180 repeated NetworkPolicyEgressRule egress = 3;
181
182 // List of rule types that the NetworkPolicy relates to.
183 // Valid options are Ingress, Egress, or Ingress,Egress.
184 // If this field is not specified, it will default based on the existence of Ingress or Egress rules;
185 // policies that contain an Egress section are assumed to affect Egress, and all policies
186 // (whether or not they contain an Ingress section) are assumed to affect Ingress.
187 // If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ].
188 // Likewise, if you want to write a policy that specifies that no egress is allowed,
189 // you must specify a policyTypes value that include "Egress" (since such a policy would not include
190 // an Egress section and would otherwise default to just [ "Ingress" ]).
191 // This field is beta-level in 1.8
192 // +optional
193 repeated string policyTypes = 4;
194}
195