Skip to content

policy_v1beta1

AllowedCSIDriver

class lightkube.models.policy_v1beta1.AllowedCSIDriver(name)

AllowedCSIDriver represents a single inline CSI Driver that is allowed to be used.

parameters

  • name str - Name is the registered name of the CSI driver

AllowedFlexVolume

class lightkube.models.policy_v1beta1.AllowedFlexVolume(driver)

AllowedFlexVolume represents a single Flexvolume that is allowed to be used.

parameters

  • driver str - driver is the name of the Flexvolume driver.

AllowedHostPath

class lightkube.models.policy_v1beta1.AllowedHostPath(pathPrefix=None, readOnly=None)

AllowedHostPath defines the host volume conditions that will be enabled by a policy for pods to use. It requires the path prefix to be defined.

parameters

  • pathPrefix str - (optional) pathPrefix is the path prefix that the host volume must match. It does not support *. Trailing slashes are trimmed when validating the path prefix with a host path. Examples: /foo would allow /foo, /foo/ and /foo/bar /foo would not allow /food or /etc/foo
  • readOnly bool - (optional) when set to true, will allow host volumes matching the pathPrefix only if all volume mounts are readOnly.

Eviction

class lightkube.models.policy_v1beta1.Eviction(apiVersion=None, deleteOptions=None, kind=None, metadata=None)

Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions.

parameters

  • apiVersion str - (optional) APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info
  • deleteOptions meta_v1.DeleteOptions - (optional) DeleteOptions may be provided
  • kind str - (optional) Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info
  • metadata meta_v1.ObjectMeta - (optional) ObjectMeta describes the pod that is being evicted.

FSGroupStrategyOptions

class lightkube.models.policy_v1beta1.FSGroupStrategyOptions(ranges=None, rule=None)

FSGroupStrategyOptions defines the strategy type and options used to create the strategy.

parameters

  • ranges IDRange - (optional) ranges are the allowed ranges of fs groups. If you would like to force a single fs group then supply a single range with the same start and end. Required for MustRunAs.
  • rule str - (optional) rule is the strategy that will dictate what FSGroup is used in the SecurityContext.

HostPortRange

class lightkube.models.policy_v1beta1.HostPortRange(max, min)

HostPortRange defines a range of host ports that will be enabled by a policy for pods to use. It requires both the start and end to be defined.

parameters

  • max int - max is the end of the range, inclusive.
  • min int - min is the start of the range, inclusive.

IDRange

class lightkube.models.policy_v1beta1.IDRange(max, min)

IDRange provides a min/max of an allowed range of IDs.

parameters

  • max int - max is the end of the range, inclusive.
  • min int - min is the start of the range, inclusive.

PodDisruptionBudget

class lightkube.models.policy_v1beta1.PodDisruptionBudget(apiVersion=None, kind=None, metadata=None, spec=None, status=None)

PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods

parameters

  • apiVersion str - (optional) APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info
  • kind str - (optional) Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info
  • metadata meta_v1.ObjectMeta - (optional)
  • spec PodDisruptionBudgetSpec - (optional) Specification of the desired behavior of the PodDisruptionBudget.
  • status PodDisruptionBudgetStatus - (optional) Most recently observed status of the PodDisruptionBudget.

PodDisruptionBudgetList

class lightkube.models.policy_v1beta1.PodDisruptionBudgetList(items, apiVersion=None, kind=None, metadata=None)

PodDisruptionBudgetList is a collection of PodDisruptionBudgets.

parameters

  • items PodDisruptionBudget -
  • apiVersion str - (optional) APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info
  • kind str - (optional) Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info
  • metadata meta_v1.ListMeta - (optional)

PodDisruptionBudgetSpec

class lightkube.models.policy_v1beta1.PodDisruptionBudgetSpec(maxUnavailable=None, minAvailable=None, selector=None)

PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.

parameters

  • maxUnavailable util_intstr.IntOrString - (optional) An eviction is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with "minAvailable".
  • minAvailable util_intstr.IntOrString - (optional) An eviction is allowed if at least "minAvailable" pods selected by "selector" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying "100%".
  • selector meta_v1.LabelSelector - (optional) Label query over pods whose evictions are managed by the disruption budget.

PodDisruptionBudgetStatus

class lightkube.models.policy_v1beta1.PodDisruptionBudgetStatus(currentHealthy, desiredHealthy, disruptionsAllowed, expectedPods, disruptedPods=None, observedGeneration=None)

PodDisruptionBudgetStatus represents information about the status of a PodDisruptionBudget. Status may trail the actual state of a system.

parameters

  • currentHealthy int - current number of healthy pods
  • desiredHealthy int - minimum desired number of healthy pods
  • disruptionsAllowed int - Number of pod disruptions that are currently allowed.
  • expectedPods int - total number of pods counted by this disruption budget
  • disruptedPods dict - (optional) DisruptedPods contains information about pods whose eviction was processed by the API server eviction subresource handler but has not yet been observed by the PodDisruptionBudget controller. A pod will be in this map from the time when the API server processed the eviction request to the time when the pod is seen by PDB controller as having been marked for deletion (or after a timeout). The key in the map is the name of the pod and the value is the time when the API server processed the eviction request. If the deletion didn't occur and a pod is still there it will be removed from the list automatically by PodDisruptionBudget controller after some time. If everything goes smooth this map should be empty for the most of the time. Large number of entries in the map may indicate problems with pod deletions.
  • observedGeneration int - (optional) Most recent generation observed when updating this PDB status. DisruptionsAllowed and other status information is valid only if observedGeneration equals to PDB's object generation.

PodSecurityPolicy

class lightkube.models.policy_v1beta1.PodSecurityPolicy(apiVersion=None, kind=None, metadata=None, spec=None)

PodSecurityPolicy governs the ability to make requests that affect the Security Context that will be applied to a pod and container.

parameters

  • apiVersion str - (optional) APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info
  • kind str - (optional) Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info
  • metadata meta_v1.ObjectMeta - (optional) Standard object's metadata. More info
  • spec PodSecurityPolicySpec - (optional) spec defines the policy enforced.

PodSecurityPolicyList

class lightkube.models.policy_v1beta1.PodSecurityPolicyList(items, apiVersion=None, kind=None, metadata=None)

PodSecurityPolicyList is a list of PodSecurityPolicy objects.

parameters

  • items PodSecurityPolicy - items is a list of schema objects.
  • apiVersion str - (optional) APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info
  • kind str - (optional) Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info
  • metadata meta_v1.ListMeta - (optional) Standard list metadata. More info

PodSecurityPolicySpec

class lightkube.models.policy_v1beta1.PodSecurityPolicySpec(fsGroup, runAsUser, seLinux, supplementalGroups, allowPrivilegeEscalation=None, allowedCSIDrivers=None, allowedCapabilities=None, allowedFlexVolumes=None, allowedHostPaths=None, allowedProcMountTypes=None, allowedUnsafeSysctls=None, defaultAddCapabilities=None, defaultAllowPrivilegeEscalation=None, forbiddenSysctls=None, hostIPC=None, hostNetwork=None, hostPID=None, hostPorts=None, privileged=None, readOnlyRootFilesystem=None, requiredDropCapabilities=None, runAsGroup=None, runtimeClass=None, volumes=None)

PodSecurityPolicySpec defines the policy enforced.

parameters

  • fsGroup FSGroupStrategyOptions - fsGroup is the strategy that will dictate what fs group is used by the SecurityContext.
  • runAsUser RunAsUserStrategyOptions - runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set.
  • seLinux SELinuxStrategyOptions - seLinux is the strategy that will dictate the allowable labels that may be set.
  • supplementalGroups SupplementalGroupsStrategyOptions - supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext.
  • allowPrivilegeEscalation bool - (optional) allowPrivilegeEscalation determines if a pod can request to allow privilege escalation. If unspecified, defaults to true.
  • allowedCSIDrivers AllowedCSIDriver - (optional) AllowedCSIDrivers is an allowlist of inline CSI drivers that must be explicitly set to be embedded within a pod spec. An empty value indicates that any CSI driver can be used for inline ephemeral volumes. This is a beta field, and is only honored if the API server enables the CSIInlineVolume feature gate.
  • allowedCapabilities List[str] - (optional) allowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field may be added at the pod author's discretion. You must not list a capability in both allowedCapabilities and requiredDropCapabilities.
  • allowedFlexVolumes AllowedFlexVolume - (optional) allowedFlexVolumes is an allowlist of Flexvolumes. Empty or nil indicates that all Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes is allowed in the "volumes" field.
  • allowedHostPaths AllowedHostPath - (optional) allowedHostPaths is an allowlist of host paths. Empty indicates that all host paths may be used.
  • allowedProcMountTypes List[str] - (optional) AllowedProcMountTypes is an allowlist of allowed ProcMountTypes. Empty or nil indicates that only the DefaultProcMountType may be used. This requires the ProcMountType feature flag to be enabled.
  • allowedUnsafeSysctls List[str] - (optional) allowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "" in which case it is considered as a prefix of allowed sysctls. Single * means all unsafe sysctls are allowed. Kubelet has to allowlist all allowed unsafe sysctls explicitly to avoid rejection. Examples: e.g. "foo/" allows "foo/bar", "foo/baz", etc. e.g. "foo." allows "foo.bar", "foo.baz", etc.
  • defaultAddCapabilities List[str] - (optional) defaultAddCapabilities is the default set of capabilities that will be added to the container unless the pod spec specifically drops the capability. You may not list a capability in both defaultAddCapabilities and requiredDropCapabilities. Capabilities added here are implicitly allowed, and need not be included in the allowedCapabilities list.
  • defaultAllowPrivilegeEscalation bool - (optional) defaultAllowPrivilegeEscalation controls the default setting for whether a process can gain more privileges than its parent process.
  • forbiddenSysctls List[str] - (optional) forbiddenSysctls is a list of explicitly forbidden sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "" in which case it is considered as a prefix of forbidden sysctls. Single * means all sysctls are forbidden. Examples: e.g. "foo/" forbids "foo/bar", "foo/baz", etc. e.g. "foo." forbids "foo.bar", "foo.baz", etc.
  • hostIPC bool - (optional) hostIPC determines if the policy allows the use of HostIPC in the pod spec.
  • hostNetwork bool - (optional) hostNetwork determines if the policy allows the use of HostNetwork in the pod spec.
  • hostPID bool - (optional) hostPID determines if the policy allows the use of HostPID in the pod spec.
  • hostPorts HostPortRange - (optional) hostPorts determines which host port ranges are allowed to be exposed.
  • privileged bool - (optional) privileged determines if a pod can request to be run as privileged.
  • readOnlyRootFilesystem bool - (optional) readOnlyRootFilesystem when set to true will force containers to run with a read only root file system. If the container specifically requests to run with a non-read only root file system the PSP should deny the pod. If set to false the container may run with a read only root file system if it wishes but it will not be forced to.
  • requiredDropCapabilities List[str] - (optional) requiredDropCapabilities are the capabilities that will be dropped from the container. These are required to be dropped and cannot be added.
  • runAsGroup RunAsGroupStrategyOptions - (optional) RunAsGroup is the strategy that will dictate the allowable RunAsGroup values that may be set. If this field is omitted, the pod's RunAsGroup can take any value. This field requires the RunAsGroup feature gate to be enabled.
  • runtimeClass RuntimeClassStrategyOptions - (optional) runtimeClass is the strategy that will dictate the allowable RuntimeClasses for a pod. If this field is omitted, the pod's runtimeClassName field is unrestricted. Enforcement of this field depends on the RuntimeClass feature gate being enabled.
  • volumes List[str] - (optional) volumes is an allowlist of volume plugins. Empty indicates that no volumes may be used. To allow all volumes you may use '*'.

RunAsGroupStrategyOptions

class lightkube.models.policy_v1beta1.RunAsGroupStrategyOptions(rule, ranges=None)

RunAsGroupStrategyOptions defines the strategy type and any options used to create the strategy.

parameters

  • rule str - rule is the strategy that will dictate the allowable RunAsGroup values that may be set.
  • ranges IDRange - (optional) ranges are the allowed ranges of gids that may be used. If you would like to force a single gid then supply a single range with the same start and end. Required for MustRunAs.

RunAsUserStrategyOptions

class lightkube.models.policy_v1beta1.RunAsUserStrategyOptions(rule, ranges=None)

RunAsUserStrategyOptions defines the strategy type and any options used to create the strategy.

parameters

  • rule str - rule is the strategy that will dictate the allowable RunAsUser values that may be set.
  • ranges IDRange - (optional) ranges are the allowed ranges of uids that may be used. If you would like to force a single uid then supply a single range with the same start and end. Required for MustRunAs.

RuntimeClassStrategyOptions

class lightkube.models.policy_v1beta1.RuntimeClassStrategyOptions(allowedRuntimeClassNames, defaultRuntimeClassName=None)

RuntimeClassStrategyOptions define the strategy that will dictate the allowable RuntimeClasses for a pod.

parameters

  • allowedRuntimeClassNames List[str] - allowedRuntimeClassNames is an allowlist of RuntimeClass names that may be specified on a pod. A value of "*" means that any RuntimeClass name is allowed, and must be the only item in the list. An empty list requires the RuntimeClassName field to be unset.
  • defaultRuntimeClassName str - (optional) defaultRuntimeClassName is the default RuntimeClassName to set on the pod. The default MUST be allowed by the allowedRuntimeClassNames list. A value of nil does not mutate the Pod.

SELinuxStrategyOptions

class lightkube.models.policy_v1beta1.SELinuxStrategyOptions(rule, seLinuxOptions=None)

SELinuxStrategyOptions defines the strategy type and any options used to create the strategy.

parameters

  • rule str - rule is the strategy that will dictate the allowable labels that may be set.
  • seLinuxOptions core_v1.SELinuxOptions - (optional) seLinuxOptions required to run as; required for MustRunAs More info

SupplementalGroupsStrategyOptions

class lightkube.models.policy_v1beta1.SupplementalGroupsStrategyOptions(ranges=None, rule=None)

SupplementalGroupsStrategyOptions defines the strategy type and options used to create the strategy.

parameters

  • ranges IDRange - (optional) ranges are the allowed ranges of supplemental groups. If you would like to force a single supplemental group then supply a single range with the same start and end. Required for MustRunAs.
  • rule str - (optional) rule is the strategy that will dictate what supplemental groups is used in the SecurityContext.