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