OperationPolicy
Scope: Cluster
Version: v1alpha1
Describes an operation policy for a cluster.
Each CustomResource OperationPolicy describes rules for objects in a cluster.
- objectspec
Required value
- stringspec.enforcementAction
The enforcement action to control what to do with the result of the constraint.
- Deny — Deny action.
- Dryrun — No action. It is used when debugging. Information about the event can be viewed in Grafana or in the console via kubectl.
- Warn — Same as
Dryrun. In addition to the event information, it provides some info on why that constraint would have been denied if you had setDenyinstead ofWarn.
Default:
"Deny"Allowed values:
Warn,Deny,Dryrun - objectspec.match
Required value
- objectspec.match.labelSelector
Specifies the label selector to filter Pods with.
You can get more into here.
- array of objectsspec.match.labelSelector.matchExpressions
List of label expressions for Pods.
Example:
matchExpressions: - key: tier operator: In values: - production - staging- stringspec.match.labelSelector.matchExpressions.key
Required value
- stringspec.match.labelSelector.matchExpressions.operator
Required value
Allowed values:
In,NotIn,Exists,DoesNotExist - array of stringsspec.match.labelSelector.matchExpressions.values
- objectspec.match.labelSelector.matchLabels
List of labels which Pod should have.
Example:
matchLabels: foo: bar baz: who
- objectspec.match.namespaceSelector
Required value
Specifies the Namespace selector to filter objects with.
- array of stringsspec.match.namespaceSelector.excludeNames
Include all namespaces except a particular set. Support glob pattern.
- objectspec.match.namespaceSelector.labelSelector
Specifies the label selector to filter namespaces.
You can get more info in the documentation.
- array of objectsspec.match.namespaceSelector.labelSelector.matchExpressions
List of label expressions for namespaces.
Example:
matchExpressions: - key: tier operator: In values: - production - staging- stringspec.match.namespaceSelector.labelSelector.matchExpressions.key
Required value
- stringspec.match.namespaceSelector.labelSelector.matchExpressions.operator
Required value
Allowed values:
In,NotIn,Exists,DoesNotExist - array of stringsspec.match.namespaceSelector.labelSelector.matchExpressions.values
- objectspec.match.namespaceSelector.labelSelector.matchLabels
List of labels which a namespace should have.
Example:
matchLabels: foo: bar baz: who
- array of stringsspec.match.namespaceSelector.matchNames
Include only a particular set of namespaces. Supports glob pattern.
- objectspec.policies
Required value
- array of stringsspec.policies.allowedRepos
The list of prefixes a container image is allowed to have.
- stringElement of the array
Example:
registry.deckhouse.io
- booleanspec.policies.checkContainerDuplicates
Check container names and env variables for duplicates.
- booleanspec.policies.checkHostNetworkDNSPolicy
Check
ClusterFirstWithHostNetdnsPolicy is set for Pods withhostNetwork: true. - array of strings
Requires container images to have an image tag different from the ones in the specified list.
Example:
disallowedImageTags: latest - stringspec.policies.imagePullPolicy
Required image pull policy for containers.
Allowed values:
Always,IfNotPresent - integerspec.policies.maxRevisionHistoryLimit
A maximum value for a revision history.
- array of stringsspec.policies.priorityClassNames
List of allowed priority class names.
- objectspec.policies.replicaLimits
A range of allowed replicas. Values are inclusive.
- integerspec.policies.replicaLimits.maxReplicas
The maximum number of replicas allowed, inclusive.
- integerspec.policies.replicaLimits.minReplicas
The minimum number of replicas allowed, inclusive.
- objectspec.policies.requiredAnnotations
A list of annotations and values the object must specify.
- array of objectsspec.policies.requiredAnnotations.annotations
- stringspec.policies.requiredAnnotations.annotations.allowedRegex
If specified, a regular expression, the annotation’s value must match. The value must contain at least one match for the regular expression.
- stringspec.policies.requiredAnnotations.annotations.key
The required annotation.
- array of stringsspec.policies.requiredAnnotations.watchKinds
The list of kubernetes objects in the format
$apiGroup/$kindto watch the annotations on.- stringElement of the array
Pattern:
^[a-z]*/[a-zA-Z]+$Examples:
apps/Deployment"/Pod"networking.k8s.io/Ingress
- objectspec.policies.requiredLabels
A list of labels and values the object must specify.
- array of objectsspec.policies.requiredLabels.labels
- stringspec.policies.requiredLabels.labels.allowedRegex
If specified, a regular expression, the label’s value must match. The value must contain at least one match for the regular expression.
- stringspec.policies.requiredLabels.labels.key
The required label.
- array of stringsspec.policies.requiredLabels.watchKinds
The list of kubernetes objects in the format
$apiGroup/$kindto watch the labels on.- stringElement of the array
Pattern:
^[a-z]*/[a-zA-Z]+$Examples:
apps/Deployment"/Pod"networking.k8s.io/Ingress
- array of stringsspec.policies.requiredProbes
The list of probes that are required (e.g.
readinessProbe)Examples:
requiredProbes: livenessProberequiredProbes: readinessProbe- stringElement of the array
Allowed values:
livenessProbe,readinessProbe,startupProbe
- objectspec.policies.requiredResources
Requires containers to have defined resources set.
- array of stringsspec.policies.requiredResources.limits
A list of limits that should be enforced (CPU, memory, or both).
Default:
["memory"]- stringElement of the array
Allowed values:
cpu,memory
- array of stringsspec.policies.requiredResources.requests
A list of requests that should be enforced (CPU, memory, or both).
Default:
["cpu","memory"]- stringElement of the array
Allowed values:
cpu,memory
SecurityPolicy
Scope: Cluster
Version: v1alpha1
Describes a security policy for a cluster.
Each CustomResource SecurityPolicy describes rules for objects in a cluster.
- objectspec
Required value
- stringspec.enforcementAction
The enforcement action to control what to do with the result of the constraint.
Deny— Deny action.Dryrun— No action. It is used when debugging. Information about the event can be viewed in Grafana or in the console via kubectl.Warn— Same asDryrun. In addition to the event information, it provides some info on why that constraint would have been denied if you had setDenyinstead ofWarn.
Default:
"Deny"Allowed values:
Warn,Deny,Dryrun - objectspec.match
Required value
- objectspec.match.labelSelector
Specifies the label selector to filter Pods with.
You can get more into here.
- array of objectsspec.match.labelSelector.matchExpressions
List of label expressions for Pods.
Example:
matchExpressions: - key: tier operator: In values: - production - staging- stringspec.match.labelSelector.matchExpressions.key
Required value
- stringspec.match.labelSelector.matchExpressions.operator
Required value
Allowed values:
In,NotIn,Exists,DoesNotExist - array of stringsspec.match.labelSelector.matchExpressions.values
- objectspec.match.labelSelector.matchLabels
List of labels which Pod should have.
Example:
matchLabels: foo: bar baz: who
- objectspec.match.namespaceSelector
Required value
Specifies the Namespace selector to filter objects with.
- array of stringsspec.match.namespaceSelector.excludeNames
Include all namespaces except a particular set. Support glob pattern.
- objectspec.match.namespaceSelector.labelSelector
Specifies the label selector to filter namespaces.
You can get more info in the documentation.
- array of objectsspec.match.namespaceSelector.labelSelector.matchExpressions
List of label expressions for namespaces.
Example:
matchExpressions: - key: tier operator: In values: - production - staging- stringspec.match.namespaceSelector.labelSelector.matchExpressions.key
Required value
- stringspec.match.namespaceSelector.labelSelector.matchExpressions.operator
Required value
Allowed values:
In,NotIn,Exists,DoesNotExist - array of stringsspec.match.namespaceSelector.labelSelector.matchExpressions.values
- objectspec.match.namespaceSelector.labelSelector.matchLabels
List of labels which a namespace should have.
Example:
matchLabels: foo: bar baz: who
- array of stringsspec.match.namespaceSelector.matchNames
Include only a particular set of namespaces. Supports glob pattern.
- objectspec.policies
Required value
- booleanspec.policies.allowHostIPC
Allows sharing the host’s IPC namespace with containers.
- booleanspec.policies.allowHostNetwork
Allows containers to use the host’s network.
- booleanspec.policies.allowHostPID
Allows sharing the host’s PID namespace with containers.
- booleanspec.policies.allowPrivilegeEscalation
Allows container processes to gain more privileges than its parent process.
- booleanspec.policies.allowPrivileged
Allows running containers in a privileged mode.
- array of stringsspec.policies.allowedAppArmor
List of allowed AppArmor profiles for use by containers.
Examples:
allowedAppArmor: runtime/defaultallowedAppArmor: unconfined- stringElement of the array
AppArmor profile.
- array of stringsspec.policies.allowedCapabilities
List of capabilities that containers are able to use.
To allow all capabilities you may use
ALL.Examples:
allowedCapabilities: SETGIDallowedCapabilities: SETUIDallowedCapabilities: NET_BIND_SERVICE- stringElement of the array
Allowed linux capabilities.
Allowed values:
ALL,SETPCAP,SYS_MODULE,SYS_RAWIO,SYS_PACCT,SYS_ADMIN,SYS_NICE,SYS_RESOURCE,SYS_TIME,SYS_TTY_CONFIG,MKNOD,AUDIT_WRITE,AUDIT_CONTROL,MAC_OVERRIDE,MAC_ADMIN,NET_ADMIN,SYSLOG,CHOWN,NET_RAW,DAC_OVERRIDE,FOWNER,DAC_READ_SEARCH,FSETID,KILL,SETGID,SETUID,LINUX_IMMUTABLE,NET_BIND_SERVICE,NET_BROADCAST,IPC_LOCK,IPC_OWNER,SYS_CHROOT,SYS_PTRACE,SYS_BOOT,LEASE,SETFCAP,WAKE_ALARM,BLOCK_SUSPEND
- array of objectsspec.policies.allowedFlexVolumes
Whitelist of allowed Flex Volume drivers.
- stringspec.policies.allowedFlexVolumes.driver
A driver name.
- array of objectsspec.policies.allowedHostPaths
The list of allowed hostpath prefixes. An empty list means any path can be used.
Example:
allowedHostPaths: pathPrefix: "/dev" readOnly: true- stringspec.policies.allowedHostPaths.pathPrefix
Required value
Path prefix that the host volume must match.
It does not support the
*mask. Trailing slashes are trimmed when validating the path prefix with a host path.For example, the
/fooprefix allows/foo,/foo/and/foo/barpath, but doesn’t allow/foodor/etc/foopath. - booleanspec.policies.allowedHostPaths.readOnly
When set to true, will allow host volumes matching the pathPrefix only if all the volume mounts are readOnly.
Default:
false
- array of objectsspec.policies.allowedHostPorts
The list of
hostPortranges allowed by the rule.- integerspec.policies.allowedHostPorts.max
Max value for the
hostPort - integerspec.policies.allowedHostPorts.min
Min value for the
hostPort
- stringspec.policies.allowedProcMount
The allowed
/procmount type for containers.Allowed values:
Default,UnmaskedExample:
allowedProcMount: Unmasked. - array of stringsspec.policies.allowedUnsafeSysctls
The list of explicitly allowed unsafe sysctls.
To allow all unsafe sysctls you may use
*.Examples:
allowedUnsafeSysctls: kernel.msg*allowedUnsafeSysctls: net.core.somaxconn - array of stringsspec.policies.allowedVolumes
The set of volume plugins allowed to use.
Examples:
allowedVolumes: hostPathallowedVolumes: persistentVolumeClaim- stringElement of the array
Allowed values:
*,none,awsElasticBlockStore,azureDisk,azureFile,cephFS,cinder,configMap,csi,downwardAPI,emptyDir,fc,flexVolume,flocker,gcePersistentDisk,gitRepo,glusterfs,hostPath,iscsi,nfs,persistentVolumeClaim,photonPersistentDisk,portworxVolume,projected,quobyte,rbd,scaleIO,secret,storageos,vsphereVolume
- array of stringsspec.policies.forbiddenSysctls
The list of forbidden sysctls.
Takes precedence over allowed unsafe sysctls (allowedUnsafeSysctls).
Examples:
forbiddenSysctls: kernel.msg*forbiddenSysctls: net.core.somaxconn - objectspec.policies.fsGroup
Specifies what fs group is allowed to be used by the security context.
- array of objectsspec.policies.fsGroup.ranges
List of acceptable ranges for the fs group ID to use with MustRunAs.
- integerspec.policies.fsGroup.ranges.max
Max ID value.
- integerspec.policies.fsGroup.ranges.min
Min ID value.
- stringspec.policies.fsGroup.rule
Required value
Specifes the strategy of the fs group selection.
Allowed values:
MustRunAs,MayRunAs,RunAsAny
- booleanspec.policies.readOnlyRootFilesystem
Defines if it’s possible to run containers with non-read only file system.
- array of stringsspec.policies.requiredDropCapabilities
The set of capabilities that have to be dropped from containers.
To exclude all capabilities you may use
ALL’.Examples:
requiredDropCapabilities: SETGIDrequiredDropCapabilities: SETUIDrequiredDropCapabilities: NET_BIND_SERVICE- stringElement of the array
Linux capabilities to drop from containers’ specs.
Allowed values:
ALL,SETPCAP,SYS_MODULE,SYS_RAWIO,SYS_PACCT,SYS_ADMIN,SYS_NICE,SYS_RESOURCE,SYS_TIME,SYS_TTY_CONFIG,MKNOD,AUDIT_WRITE,AUDIT_CONTROL,MAC_OVERRIDE,MAC_ADMIN,NET_ADMIN,SYSLOG,CHOWN,NET_RAW,DAC_OVERRIDE,FOWNER,DAC_READ_SEARCH,FSETID,KILL,SETGID,SETUID,LINUX_IMMUTABLE,NET_BIND_SERVICE,NET_BROADCAST,IPC_LOCK,IPC_OWNER,SYS_CHROOT,SYS_PTRACE,SYS_BOOT,LEASE,SETFCAP,WAKE_ALARM,BLOCK_SUSPEND
- objectspec.policies.runAsGroup
Specifies what
runAsGroupvalue is allowed to be used by the security context.- array of objectsspec.policies.runAsGroup.ranges
List of acceptable ranges for the group ID to use with
MustRunAs.- integerspec.policies.runAsGroup.ranges.max
Max ID value.
- integerspec.policies.runAsGroup.ranges.min
Min ID value.
- stringspec.policies.runAsGroup.rule
Required value
Specifies the strategy of the group ID selection.
Allowed values:
MustRunAs,MayRunAs,RunAsAny
- objectspec.policies.runAsUser
Specifies what
runAsUservalue is allowed to be used by the security context.- array of objectsspec.policies.runAsUser.ranges
List of acceptable ranges for the user ID to use with
MustRunAs.- integerspec.policies.runAsUser.ranges.max
Max ID value.
- integerspec.policies.runAsUser.ranges.min
Min ID value.
- stringspec.policies.runAsUser.rule
Required value
Specifies the strategy of the user ID selection.
Allowed values:
MustRunAs,MustRunAsNonRoot,RunAsAny
- array of objectsspec.policies.seLinux
Specifies what SElinux labels are allowed to be set in the security context.
- stringspec.policies.seLinux.level
Level is SELinux level label that applies to the container.
- stringspec.policies.seLinux.role
Role is SELinux role label that applies to the container.
- stringspec.policies.seLinux.type
Type is SELinux type label that applies to the container.
- stringspec.policies.seLinux.user
User is SELinux user label that applies to the container.
- objectspec.policies.seccompProfiles
This field specifies the list of allowed profiles that may be set for the Pod or container’s seccomp annotations.
- array of stringsspec.policies.seccompProfiles.allowedLocalhostFiles
When using
securityContextnaming scheme for seccomp and includingLocalhostthis array holds the allowed profile JSON files.An empty list prohibits the use of any local profiles.
- array of stringsspec.policies.seccompProfiles.allowedProfiles
The list of allowed profile values for seccomp on Pods/containers.
- objectspec.policies.supplementalGroups
Specifies what supplemental groups are allowed to be used by the security context.
- array of objectsspec.policies.supplementalGroups.ranges
List of acceptable ranges for the supplemental group ID to use with MustRunAs.
- integerspec.policies.supplementalGroups.ranges.max
Max ID value.
- integerspec.policies.supplementalGroups.ranges.min
Min ID value.
- stringspec.policies.supplementalGroups.rule
Required value
Specifies the strategy of the supplemental group ID selection.
Allowed values:
MustRunAs,MayRunAs,RunAsAny