blob: 1a14d946fcf0cc91efab9f047f80ed88ff0b9ec4 [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.policy.v1beta1;
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 = "v1beta1";
32
33// AllowedFlexVolume represents a single Flexvolume that is allowed to be used.
34message AllowedFlexVolume {
35 // driver is the name of the Flexvolume driver.
36 optional string driver = 1;
37}
38
39// AllowedHostPath defines the host volume conditions that will be enabled by a policy
40// for pods to use. It requires the path prefix to be defined.
41message AllowedHostPath {
42 // pathPrefix is the path prefix that the host volume must match.
43 // It does not support `*`.
44 // Trailing slashes are trimmed when validating the path prefix with a host path.
45 //
46 // Examples:
47 // `/foo` would allow `/foo`, `/foo/` and `/foo/bar`
48 // `/foo` would not allow `/food` or `/etc/foo`
49 optional string pathPrefix = 1;
50
51 // when set to true, will allow host volumes matching the pathPrefix only if all volume mounts are readOnly.
52 // +optional
53 optional bool readOnly = 2;
54}
55
56// Eviction evicts a pod from its node subject to certain policies and safety constraints.
57// This is a subresource of Pod. A request to cause such an eviction is
58// created by POSTing to .../pods/<pod name>/evictions.
59message Eviction {
60 // ObjectMeta describes the pod that is being evicted.
61 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
62
63 // DeleteOptions may be provided
64 optional k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions deleteOptions = 2;
65}
66
67// FSGroupStrategyOptions defines the strategy type and options used to create the strategy.
68message FSGroupStrategyOptions {
69 // rule is the strategy that will dictate what FSGroup is used in the SecurityContext.
70 // +optional
71 optional string rule = 1;
72
73 // ranges are the allowed ranges of fs groups. If you would like to force a single
74 // fs group then supply a single range with the same start and end. Required for MustRunAs.
75 // +optional
76 repeated IDRange ranges = 2;
77}
78
79// HostPortRange defines a range of host ports that will be enabled by a policy
80// for pods to use. It requires both the start and end to be defined.
81message HostPortRange {
82 // min is the start of the range, inclusive.
83 optional int32 min = 1;
84
85 // max is the end of the range, inclusive.
86 optional int32 max = 2;
87}
88
89// IDRange provides a min/max of an allowed range of IDs.
90message IDRange {
91 // min is the start of the range, inclusive.
92 optional int64 min = 1;
93
94 // max is the end of the range, inclusive.
95 optional int64 max = 2;
96}
97
98// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods
99message PodDisruptionBudget {
100 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
101
102 // Specification of the desired behavior of the PodDisruptionBudget.
103 optional PodDisruptionBudgetSpec spec = 2;
104
105 // Most recently observed status of the PodDisruptionBudget.
106 optional PodDisruptionBudgetStatus status = 3;
107}
108
109// PodDisruptionBudgetList is a collection of PodDisruptionBudgets.
110message PodDisruptionBudgetList {
111 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
112
113 repeated PodDisruptionBudget items = 2;
114}
115
116// PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.
117message PodDisruptionBudgetSpec {
118 // An eviction is allowed if at least "minAvailable" pods selected by
119 // "selector" will still be available after the eviction, i.e. even in the
120 // absence of the evicted pod. So for example you can prevent all voluntary
121 // evictions by specifying "100%".
122 optional k8s.io.apimachinery.pkg.util.intstr.IntOrString minAvailable = 1;
123
124 // Label query over pods whose evictions are managed by the disruption
125 // budget.
126 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2;
127
128 // An eviction is allowed if at most "maxUnavailable" pods selected by
129 // "selector" are unavailable after the eviction, i.e. even in absence of
130 // the evicted pod. For example, one can prevent all voluntary evictions
131 // by specifying 0. This is a mutually exclusive setting with "minAvailable".
132 optional k8s.io.apimachinery.pkg.util.intstr.IntOrString maxUnavailable = 3;
133}
134
135// PodDisruptionBudgetStatus represents information about the status of a
136// PodDisruptionBudget. Status may trail the actual state of a system.
137message PodDisruptionBudgetStatus {
138 // Most recent generation observed when updating this PDB status. PodDisruptionsAllowed and other
139 // status informatio is valid only if observedGeneration equals to PDB's object generation.
140 // +optional
141 optional int64 observedGeneration = 1;
142
143 // DisruptedPods contains information about pods whose eviction was
144 // processed by the API server eviction subresource handler but has not
145 // yet been observed by the PodDisruptionBudget controller.
146 // A pod will be in this map from the time when the API server processed the
147 // eviction request to the time when the pod is seen by PDB controller
148 // as having been marked for deletion (or after a timeout). The key in the map is the name of the pod
149 // and the value is the time when the API server processed the eviction request. If
150 // the deletion didn't occur and a pod is still there it will be removed from
151 // the list automatically by PodDisruptionBudget controller after some time.
152 // If everything goes smooth this map should be empty for the most of the time.
153 // Large number of entries in the map may indicate problems with pod deletions.
154 map<string, k8s.io.apimachinery.pkg.apis.meta.v1.Time> disruptedPods = 2;
155
156 // Number of pod disruptions that are currently allowed.
157 optional int32 disruptionsAllowed = 3;
158
159 // current number of healthy pods
160 optional int32 currentHealthy = 4;
161
162 // minimum desired number of healthy pods
163 optional int32 desiredHealthy = 5;
164
165 // total number of pods counted by this disruption budget
166 optional int32 expectedPods = 6;
167}
168
169// PodSecurityPolicy governs the ability to make requests that affect the Security Context
170// that will be applied to a pod and container.
171message PodSecurityPolicy {
172 // Standard object's metadata.
173 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
174 // +optional
175 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
176
177 // spec defines the policy enforced.
178 // +optional
179 optional PodSecurityPolicySpec spec = 2;
180}
181
182// PodSecurityPolicyList is a list of PodSecurityPolicy objects.
183message PodSecurityPolicyList {
184 // Standard list metadata.
185 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
186 // +optional
187 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
188
189 // items is a list of schema objects.
190 repeated PodSecurityPolicy items = 2;
191}
192
193// PodSecurityPolicySpec defines the policy enforced.
194message PodSecurityPolicySpec {
195 // privileged determines if a pod can request to be run as privileged.
196 // +optional
197 optional bool privileged = 1;
198
199 // defaultAddCapabilities is the default set of capabilities that will be added to the container
200 // unless the pod spec specifically drops the capability. You may not list a capability in both
201 // defaultAddCapabilities and requiredDropCapabilities. Capabilities added here are implicitly
202 // allowed, and need not be included in the allowedCapabilities list.
203 // +optional
204 repeated string defaultAddCapabilities = 2;
205
206 // requiredDropCapabilities are the capabilities that will be dropped from the container. These
207 // are required to be dropped and cannot be added.
208 // +optional
209 repeated string requiredDropCapabilities = 3;
210
211 // allowedCapabilities is a list of capabilities that can be requested to add to the container.
212 // Capabilities in this field may be added at the pod author's discretion.
213 // You must not list a capability in both allowedCapabilities and requiredDropCapabilities.
214 // +optional
215 repeated string allowedCapabilities = 4;
216
217 // volumes is a white list of allowed volume plugins. Empty indicates that
218 // no volumes may be used. To allow all volumes you may use '*'.
219 // +optional
220 repeated string volumes = 5;
221
222 // hostNetwork determines if the policy allows the use of HostNetwork in the pod spec.
223 // +optional
224 optional bool hostNetwork = 6;
225
226 // hostPorts determines which host port ranges are allowed to be exposed.
227 // +optional
228 repeated HostPortRange hostPorts = 7;
229
230 // hostPID determines if the policy allows the use of HostPID in the pod spec.
231 // +optional
232 optional bool hostPID = 8;
233
234 // hostIPC determines if the policy allows the use of HostIPC in the pod spec.
235 // +optional
236 optional bool hostIPC = 9;
237
238 // seLinux is the strategy that will dictate the allowable labels that may be set.
239 optional SELinuxStrategyOptions seLinux = 10;
240
241 // runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set.
242 optional RunAsUserStrategyOptions runAsUser = 11;
243
244 // supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext.
245 optional SupplementalGroupsStrategyOptions supplementalGroups = 12;
246
247 // fsGroup is the strategy that will dictate what fs group is used by the SecurityContext.
248 optional FSGroupStrategyOptions fsGroup = 13;
249
250 // readOnlyRootFilesystem when set to true will force containers to run with a read only root file
251 // system. If the container specifically requests to run with a non-read only root file system
252 // the PSP should deny the pod.
253 // If set to false the container may run with a read only root file system if it wishes but it
254 // will not be forced to.
255 // +optional
256 optional bool readOnlyRootFilesystem = 14;
257
258 // defaultAllowPrivilegeEscalation controls the default setting for whether a
259 // process can gain more privileges than its parent process.
260 // +optional
261 optional bool defaultAllowPrivilegeEscalation = 15;
262
263 // allowPrivilegeEscalation determines if a pod can request to allow
264 // privilege escalation. If unspecified, defaults to true.
265 // +optional
266 optional bool allowPrivilegeEscalation = 16;
267
268 // allowedHostPaths is a white list of allowed host paths. Empty indicates
269 // that all host paths may be used.
270 // +optional
271 repeated AllowedHostPath allowedHostPaths = 17;
272
273 // allowedFlexVolumes is a whitelist of allowed Flexvolumes. Empty or nil indicates that all
274 // Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes
275 // is allowed in the "volumes" field.
276 // +optional
277 repeated AllowedFlexVolume allowedFlexVolumes = 18;
278
279 // allowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none.
280 // Each entry is either a plain sysctl name or ends in "*" in which case it is considered
281 // as a prefix of allowed sysctls. Single * means all unsafe sysctls are allowed.
282 // Kubelet has to whitelist all allowed unsafe sysctls explicitly to avoid rejection.
283 //
284 // Examples:
285 // e.g. "foo/*" allows "foo/bar", "foo/baz", etc.
286 // e.g. "foo.*" allows "foo.bar", "foo.baz", etc.
287 // +optional
288 repeated string allowedUnsafeSysctls = 19;
289
290 // forbiddenSysctls is a list of explicitly forbidden sysctls, defaults to none.
291 // Each entry is either a plain sysctl name or ends in "*" in which case it is considered
292 // as a prefix of forbidden sysctls. Single * means all sysctls are forbidden.
293 //
294 // Examples:
295 // e.g. "foo/*" forbids "foo/bar", "foo/baz", etc.
296 // e.g. "foo.*" forbids "foo.bar", "foo.baz", etc.
297 // +optional
298 repeated string forbiddenSysctls = 20;
299}
300
301// RunAsUserStrategyOptions defines the strategy type and any options used to create the strategy.
302message RunAsUserStrategyOptions {
303 // rule is the strategy that will dictate the allowable RunAsUser values that may be set.
304 optional string rule = 1;
305
306 // ranges are the allowed ranges of uids that may be used. If you would like to force a single uid
307 // then supply a single range with the same start and end. Required for MustRunAs.
308 // +optional
309 repeated IDRange ranges = 2;
310}
311
312// SELinuxStrategyOptions defines the strategy type and any options used to create the strategy.
313message SELinuxStrategyOptions {
314 // rule is the strategy that will dictate the allowable labels that may be set.
315 optional string rule = 1;
316
317 // seLinuxOptions required to run as; required for MustRunAs
318 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
319 // +optional
320 optional k8s.io.api.core.v1.SELinuxOptions seLinuxOptions = 2;
321}
322
323// SupplementalGroupsStrategyOptions defines the strategy type and options used to create the strategy.
324message SupplementalGroupsStrategyOptions {
325 // rule is the strategy that will dictate what supplemental groups is used in the SecurityContext.
326 // +optional
327 optional string rule = 1;
328
329 // ranges are the allowed ranges of supplemental groups. If you would like to force a single
330 // supplemental group then supply a single range with the same start and end. Required for MustRunAs.
331 // +optional
332 repeated IDRange ranges = 2;
333}
334