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