generated.proto 18 KB

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