Note: The kube-system namespace, unlike other namespaces, has a failPolicy of ignore on update calls.
Verifies that the annotation field.cattle.io/projectId value can only be updated by users with the manage-namespaces
verb on the project specified in the annotation.
Validates that users who create or edit a PSA enforcement label on a namespace have the updatepsa verb on projects
in management.cattle.io/v3. See the upstream docs
for more information on the effect of these labels.
The following labels are considered relevant for PSA enforcement:
- pod-security.kubernetes.io/enforce
- pod-security.kubernetes.io/enforce-version
- pod-security.kubernetes.io/audit
- pod-security.kubernetes.io/audit-version
- pod-security.kubernetes.io/warn
- pod-security.kubernetes.io/warn-version
A secret cannot be deleted if its deletion request has an orphan policy, and the secret has roles or role bindings dependent on it.
For all secrets of type provisioning.cattle.io/cloud-credential,
places a field.cattle.io/creatorId annotation with the name of the user as the value.
Checks if there are any RoleBindings owned by this secret which provide access to a role granting access to this secret. If yes, the webhook redacts the role, so that it only grants a deletion permission.
Users can only create/update ClusterRoleTemplateBindings which grant permissions to RoleTemplates with rights less than or equal to those they currently possess. This is to prevent privilege escalation.
Users cannot create ClusterRoleTemplateBindings which violate the following constraints:
- Either a user subject (through
UserNameorUserPrincipalName) or a group subject (throughGroupNameorGroupPrincipalName) must be specified; both a user subject and a group subject cannot be specified ClusterNamemust be specified- The roleTemplate indicated in
RoleTemplateNamemust be:- Provided as a non-empty value
- Valid (i.e. is an existing
roleTemplateobject of given name in themanagement.cattle.io/v3API group) - Not locked (i.e.
roleTemplate.Lockedmust befalse) - Associated with its appropriate context (
roleTemplate.Contextmust be equal to "cluster")
Users cannot update the following fields after creation:
- RoleTemplateName
- ClusterName
Users can update the following fields if they have not been set, but after they have been set they cannot be changed:
- UserName
- UserPrincipalName
- GroupName
- GroupPrincipalName
In addition, as in the create validation, both a user subject and a group subject cannot be specified.
The desired value must not change on new spec unless it's equal to the lockedValue or lockedValue is nil.
Note: all checks are bypassed if the GlobalRole is being deleted.
When a GlobalRole is created or updated, the webhook checks that each rule has at least one verb.
Users can only change GlobalRoles with rights less than or equal to those they currently possess. This is to prevent privilege escalation.
Note: all checks are bypassed if the GlobalRoleBinding is being deleted.
Users can only create/update GlobalRoleBindings with rights less than or equal to those they currently possess. This is to prevent privilege escalation.
GlobalRoleBindings must refer to a valid global role (i.e. an existing GlobalRole object in the management.cattle.io/v3 apiGroup).
Note: checks only run if a node driver is being disabled or deleted
This admission webhook prevents the disabling or deletion of a NodeDriver if there are any Nodes that are under management by said driver. If there are any nodes that use the driver the request will be denied.
Users can only create/update ProjectRoleTemplateBindings with rights less than or equal to those they currently possess. This is to prevent privilege escalation.
Users cannot create ProjectRoleTemplateBindings that violate the following constraints:
- Either a user subject (through
UserNameorUserPrincipalName), or a group subject (throughGroupNameorGroupPrincipalName), or a service account subject (throughServiceAccount) must be specified. Exactly one subject type of the three must be provided. ProjectNamemust be specified- The roleTemplate indicated in
RoleTemplateNamemust be:- Provided as a non-empty value
- Valid (there must exist a
roleTemplateobject of given name in themanagement.cattle.io/v3API group) - Not locked (
roleTemplate.Lockedmust befalse) - Associated with its appropriate context (
roleTemplate.Contextmust be equal to "project")
Users cannot update the following fields after creation:
- RoleTemplateName
- ProjectName
- ServiceAccount
Users can update the following fields if they had not been set. But after getting initial values, the fields cannot be changed:
- UserName
- UserPrincipalName
- GroupName
- GroupPrincipalName
In addition, as in the create validation, both a user subject and a group subject cannot be specified.
Note: all checks are bypassed if the RoleTemplate is being deleted
Circular references to a RoleTemplate (a inherits b, b inherits a) are not allowed. More specifically, if "roleTemplate1" is included in the roleTemplateNames of "roleTemplate2", then "roleTemplate2" must not be included in the roleTemplateNames of "roleTemplate1". This check prevents the creation of roles whose end-state cannot be resolved.
Rules without verbs are not permitted. The rules included in a RoleTemplate are of the same type as the rules used by standard Kubernetes RBAC types (such as Roles from rbac.authorization.k8s.io/v1). Because of this, they inherit the same restrictions as these types, including this one.
Users can only change RoleTemplates with rights less than or equal to those they currently possess. This prevents privilege escalation.
The roletemplates.context field must be one of the following values ["cluster", "project", ""].
If the roletemplates.administrative is set to true the context must equal "cluster".
The roletemplates.builtin field is immutable, and new builtIn RoleTemplates cannot be created.
If roletemplates.builtin is true then all fields are immutable except:
metadataclusterCreatorDefaultprojectCreatorDefaultlocked
RoleTemplate can not be deleted if they are referenced by other RoleTemplates via roletemplates.roleTemplateNames