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