podSecurityPolicy

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

Constuctors

Mixins
  • metadata

    Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata


    Functions
    • mixinInstance

      mixinInstance(metadata)
      


    • withAnnotations

      withAnnotations(annotations)
      

      Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations


    • withAnnotationsMixin

      withAnnotationsMixin(annotations)
      

      Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations


    • withClusterName

      withClusterName(clusterName)
      

      The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.


    • withFinalizers

      withFinalizers(finalizers)
      

      Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.


    • withFinalizersMixin

      withFinalizersMixin(finalizers)
      

      Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.


    • withGenerateName

      withGenerateName(generateName)
      

      GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.

      If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).

      Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency


    • withLabels

      withLabels(labels)
      

      Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels


    • withLabelsMixin

      withLabelsMixin(labels)
      

      Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels


    • withManagedFields

      withManagedFields(managedFields)
      

      ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn’t need to set or understand this field. A workflow can be the user’s name, a controller’s name, or the name of a specific apply path like “ci-cd”. The set of fields is always in the version that the workflow used when modifying the object.

      This field is alpha and can be changed or removed without notice.

      withManagedFields takes an array of type managedFieldsType. You can create an instance of managedFieldsType with hidden.meta.v1.managedFieldsEntry.new().

      see hidden.meta.v1.managedFieldsEntry


    • withManagedFieldsMixin

      withManagedFieldsMixin(managedFields)
      

      ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn’t need to set or understand this field. A workflow can be the user’s name, a controller’s name, or the name of a specific apply path like “ci-cd”. The set of fields is always in the version that the workflow used when modifying the object.

      This field is alpha and can be changed or removed without notice.

      withManagedFieldsMixin takes an array of type managedFieldsType. You can create an instance of managedFieldsType with hidden.meta.v1.managedFieldsEntry.new().

      see hidden.meta.v1.managedFieldsEntry


    • withName

      withName(name)
      

      Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names


    • withNamespace

      withNamespace(namespace)
      

      Namespace defines the space within each name must be unique. An empty namespace is equivalent to the “default” namespace, but “default” is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.

      Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces


    • withOwnerReferences

      withOwnerReferences(ownerReferences)
      

      List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.

      withOwnerReferences takes an array of type ownerReferencesType. You can create an instance of ownerReferencesType with hidden.meta.v1.ownerReference.new().

      see hidden.meta.v1.ownerReference


    • withOwnerReferencesMixin

      withOwnerReferencesMixin(ownerReferences)
      

      List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.

      withOwnerReferencesMixin takes an array of type ownerReferencesType. You can create an instance of ownerReferencesType with hidden.meta.v1.ownerReference.new().

      see hidden.meta.v1.ownerReference


    Mixins
    • initializers

      An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.

      When an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.

      DEPRECATED - initializers are an alpha field and will be removed in v1.15.


      Functions
      • mixinInstance

        mixinInstance(initializers)
        


      • withPending

        withPending(pending)
        

        Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.

        withPending takes an array of type pendingType. You can create an instance of pendingType with hidden.meta.v1.initializer.new().

        see hidden.meta.v1.initializer


      • withPendingMixin

        withPendingMixin(pending)
        

        Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.

        withPendingMixin takes an array of type pendingType. You can create an instance of pendingType with hidden.meta.v1.initializer.new().

        see hidden.meta.v1.initializer


  • spec

    spec defines the policy enforced.


    Functions
    • mixinInstance

      mixinInstance(spec)
      


    • withAllowPrivilegeEscalation

      withAllowPrivilegeEscalation(allowPrivilegeEscalation)
      

      allowPrivilegeEscalation determines if a pod can request to allow privilege escalation. If unspecified, defaults to true.


    • withAllowedCapabilities

      withAllowedCapabilities(allowedCapabilities)
      

      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.


    • withAllowedCapabilitiesMixin

      withAllowedCapabilitiesMixin(allowedCapabilities)
      

      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.


    • withAllowedCsiDrivers

      withAllowedCsiDrivers(allowedCsiDrivers)
      

      AllowedCSIDrivers is a whitelist 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 an alpha field, and is only honored if the API server enables the CSIInlineVolume feature gate.


    • withAllowedCsiDriversMixin

      withAllowedCsiDriversMixin(allowedCsiDrivers)
      

      AllowedCSIDrivers is a whitelist 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 an alpha field, and is only honored if the API server enables the CSIInlineVolume feature gate.


    • withAllowedFlexVolumes

      withAllowedFlexVolumes(allowedFlexVolumes)
      

      allowedFlexVolumes is a whitelist of allowed 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.

      withAllowedFlexVolumes takes an array of type allowedFlexVolumesType. You can create an instance of allowedFlexVolumesType with hidden.policy.v1beta1.allowedFlexVolume.new().

      see hidden.policy.v1beta1.allowedFlexVolume


    • withAllowedFlexVolumesMixin

      withAllowedFlexVolumesMixin(allowedFlexVolumes)
      

      allowedFlexVolumes is a whitelist of allowed 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.

      withAllowedFlexVolumesMixin takes an array of type allowedFlexVolumesType. You can create an instance of allowedFlexVolumesType with hidden.policy.v1beta1.allowedFlexVolume.new().

      see hidden.policy.v1beta1.allowedFlexVolume


    • withAllowedHostPaths

      withAllowedHostPaths(allowedHostPaths)
      

      allowedHostPaths is a white list of allowed host paths. Empty indicates that all host paths may be used.

      withAllowedHostPaths takes an array of type allowedHostPathsType. You can create an instance of allowedHostPathsType with hidden.policy.v1beta1.allowedHostPath.new().

      see hidden.policy.v1beta1.allowedHostPath


    • withAllowedHostPathsMixin

      withAllowedHostPathsMixin(allowedHostPaths)
      

      allowedHostPaths is a white list of allowed host paths. Empty indicates that all host paths may be used.

      withAllowedHostPathsMixin takes an array of type allowedHostPathsType. You can create an instance of allowedHostPathsType with hidden.policy.v1beta1.allowedHostPath.new().

      see hidden.policy.v1beta1.allowedHostPath


    • withAllowedProcMountTypes

      withAllowedProcMountTypes(allowedProcMountTypes)
      

      AllowedProcMountTypes is a whitelist of allowed ProcMountTypes. Empty or nil indicates that only the DefaultProcMountType may be used. This requires the ProcMountType feature flag to be enabled.


    • withAllowedProcMountTypesMixin

      withAllowedProcMountTypesMixin(allowedProcMountTypes)
      

      AllowedProcMountTypes is a whitelist of allowed ProcMountTypes. Empty or nil indicates that only the DefaultProcMountType may be used. This requires the ProcMountType feature flag to be enabled.


    • withAllowedUnsafeSysctls

      withAllowedUnsafeSysctls(allowedUnsafeSysctls)
      

      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 whitelist 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.


    • withAllowedUnsafeSysctlsMixin

      withAllowedUnsafeSysctlsMixin(allowedUnsafeSysctls)
      

      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 whitelist 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.


    • withDefaultAddCapabilities

      withDefaultAddCapabilities(defaultAddCapabilities)
      

      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.


    • withDefaultAddCapabilitiesMixin

      withDefaultAddCapabilitiesMixin(defaultAddCapabilities)
      

      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.


    • withDefaultAllowPrivilegeEscalation

      withDefaultAllowPrivilegeEscalation(defaultAllowPrivilegeEscalation)
      

      defaultAllowPrivilegeEscalation controls the default setting for whether a process can gain more privileges than its parent process.


    • withForbiddenSysctls

      withForbiddenSysctls(forbiddenSysctls)
      

      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.


    • withForbiddenSysctlsMixin

      withForbiddenSysctlsMixin(forbiddenSysctls)
      

      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.


    • withHostIpc

      withHostIpc(hostIpc)
      

      hostIPC determines if the policy allows the use of HostIPC in the pod spec.


    • withHostNetwork

      withHostNetwork(hostNetwork)
      

      hostNetwork determines if the policy allows the use of HostNetwork in the pod spec.


    • withHostPid

      withHostPid(hostPid)
      

      hostPID determines if the policy allows the use of HostPID in the pod spec.


    • withHostPorts

      withHostPorts(hostPorts)
      

      hostPorts determines which host port ranges are allowed to be exposed.

      withHostPorts takes an array of type hostPortsType. You can create an instance of hostPortsType with hidden.policy.v1beta1.hostPortRange.new().

      see hidden.policy.v1beta1.hostPortRange


    • withHostPortsMixin

      withHostPortsMixin(hostPorts)
      

      hostPorts determines which host port ranges are allowed to be exposed.

      withHostPortsMixin takes an array of type hostPortsType. You can create an instance of hostPortsType with hidden.policy.v1beta1.hostPortRange.new().

      see hidden.policy.v1beta1.hostPortRange


    • withPrivileged

      withPrivileged(privileged)
      

      privileged determines if a pod can request to be run as privileged.


    • withReadOnlyRootFilesystem

      withReadOnlyRootFilesystem(readOnlyRootFilesystem)
      

      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.


    • withRequiredDropCapabilities

      withRequiredDropCapabilities(requiredDropCapabilities)
      

      requiredDropCapabilities are the capabilities that will be dropped from the container. These are required to be dropped and cannot be added.


    • withRequiredDropCapabilitiesMixin

      withRequiredDropCapabilitiesMixin(requiredDropCapabilities)
      

      requiredDropCapabilities are the capabilities that will be dropped from the container. These are required to be dropped and cannot be added.


    • withVolumes

      withVolumes(volumes)
      

      volumes is a white list of allowed volume plugins. Empty indicates that no volumes may be used. To allow all volumes you may use ‘*‘.


    • withVolumesMixin

      withVolumesMixin(volumes)
      

      volumes is a white list of allowed volume plugins. Empty indicates that no volumes may be used. To allow all volumes you may use ‘*‘.


    Mixins
    • fsGroup

      fsGroup is the strategy that will dictate what fs group is used by the SecurityContext.


      Functions
      • mixinInstance

        mixinInstance(fsGroup)
        


      • withRanges

        withRanges(ranges)
        

        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.

        withRanges takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRangesMixin

        withRangesMixin(ranges)
        

        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.

        withRangesMixin takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRule

        withRule(rule)
        

        rule is the strategy that will dictate what FSGroup is used in the SecurityContext.


    • runAsGroup

      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.


      Functions
      • mixinInstance

        mixinInstance(runAsGroup)
        


      • withRanges

        withRanges(ranges)
        

        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.

        withRanges takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRangesMixin

        withRangesMixin(ranges)
        

        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.

        withRangesMixin takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRule

        withRule(rule)
        

        rule is the strategy that will dictate the allowable RunAsGroup values that may be set.


    • runAsUser

      runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set.


      Functions
      • mixinInstance

        mixinInstance(runAsUser)
        


      • withRanges

        withRanges(ranges)
        

        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.

        withRanges takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRangesMixin

        withRangesMixin(ranges)
        

        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.

        withRangesMixin takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRule

        withRule(rule)
        

        rule is the strategy that will dictate the allowable RunAsUser values that may be set.


    • runtimeClass

      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.


      Functions
      • mixinInstance

        mixinInstance(runtimeClass)
        


      • withAllowedRuntimeClassNames

        withAllowedRuntimeClassNames(allowedRuntimeClassNames)
        

        allowedRuntimeClassNames is a whitelist 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.


      • withAllowedRuntimeClassNamesMixin

        withAllowedRuntimeClassNamesMixin(allowedRuntimeClassNames)
        

        allowedRuntimeClassNames is a whitelist 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.


      • withDefaultRuntimeClassName

        withDefaultRuntimeClassName(defaultRuntimeClassName)
        

        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.


    • seLinux

      seLinux is the strategy that will dictate the allowable labels that may be set.


      Functions
      • mixinInstance

        mixinInstance(seLinux)
        


      • withRule

        withRule(rule)
        

        rule is the strategy that will dictate the allowable labels that may be set.


      Mixins
      • seLinuxOptions

        seLinuxOptions required to run as; required for MustRunAs More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/


        Functions
        • mixinInstance

          mixinInstance(seLinuxOptions)
          


        • withLevel

          withLevel(level)
          

          Level is SELinux level label that applies to the container.


        • withRole

          withRole(role)
          

          Role is a SELinux role label that applies to the container.


        • withType

          withType(type)
          

          Type is a SELinux type label that applies to the container.


        • withUser

          withUser(user)
          

          User is a SELinux user label that applies to the container.


    • supplementalGroups

      supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext.


      Functions
      • mixinInstance

        mixinInstance(supplementalGroups)
        


      • withRanges

        withRanges(ranges)
        

        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.

        withRanges takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRangesMixin

        withRangesMixin(ranges)
        

        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.

        withRangesMixin takes an array of type rangesType. You can create an instance of rangesType with hidden.policy.v1beta1.idRange.new().

        see hidden.policy.v1beta1.idRange


      • withRule

        withRule(rule)
        

        rule is the strategy that will dictate what supplemental groups is used in the SecurityContext.