Class PodSecurityContext

  • All Implemented Interfaces:
    com.marcnuri.yakc.model.Model

    public class PodSecurityContext
    extends java.lang.Object
    implements com.marcnuri.yakc.model.Model
    PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.
    • Constructor Detail

      • PodSecurityContext

        public PodSecurityContext​(java.lang.Number fsGroup,
                                  java.lang.String fsGroupChangePolicy,
                                  java.lang.Number runAsGroup,
                                  java.lang.Boolean runAsNonRoot,
                                  java.lang.Number runAsUser,
                                  SELinuxOptions seLinuxOptions,
                                  SeccompProfile seccompProfile,
                                  java.util.List<java.lang.Number> supplementalGroups,
                                  java.util.List<Sysctl> sysctls,
                                  WindowsSecurityContextOptions windowsOptions)
      • PodSecurityContext

        public PodSecurityContext()
    • Method Detail

      • getFsGroup

        public java.lang.Number getFsGroup()
        A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:


        1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----


        If unset, the Kubelet will not modify the ownership and permissions of any volume.

      • getFsGroupChangePolicy

        public java.lang.String getFsGroupChangePolicy()
        fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are "OnRootMismatch" and "Always". If not specified defaults to "Always".
      • getRunAsGroup

        public java.lang.Number getRunAsGroup()
        The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.
      • getRunAsNonRoot

        public java.lang.Boolean getRunAsNonRoot()
        Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
      • getRunAsUser

        public java.lang.Number getRunAsUser()
        The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.
      • getSupplementalGroups

        public java.util.List<java.lang.Number> getSupplementalGroups()
        A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.
      • getSysctls

        public java.util.List<Sysctl> getSysctls()
        Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.
      • setFsGroup

        public void setFsGroup​(java.lang.Number fsGroup)
        A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:


        1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----


        If unset, the Kubelet will not modify the ownership and permissions of any volume.

      • setFsGroupChangePolicy

        public void setFsGroupChangePolicy​(java.lang.String fsGroupChangePolicy)
        fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are "OnRootMismatch" and "Always". If not specified defaults to "Always".
      • setRunAsGroup

        public void setRunAsGroup​(java.lang.Number runAsGroup)
        The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.
      • setRunAsNonRoot

        public void setRunAsNonRoot​(java.lang.Boolean runAsNonRoot)
        Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
      • setRunAsUser

        public void setRunAsUser​(java.lang.Number runAsUser)
        The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.
      • setSeLinuxOptions

        public void setSeLinuxOptions​(SELinuxOptions seLinuxOptions)
      • setSeccompProfile

        public void setSeccompProfile​(SeccompProfile seccompProfile)
      • setSupplementalGroups

        public void setSupplementalGroups​(java.util.List<java.lang.Number> supplementalGroups)
        A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.
      • setSysctls

        public void setSysctls​(java.util.List<Sysctl> sysctls)
        Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object