Skip to content

[dmt] chore: sync PSS policies from deckhouse 3230c33d89 - #494

Merged
ldmonster merged 1 commit into
mainfrom
chore/sync-pss-policies-pathtype
Oct 28, 2026
Merged

ldmonster merged 1 commit into
mainfrom
chore/sync-pss-policies-pathtype

Conversation

@duckhawk

Copy link
Copy Markdown
Member

Description

Syncs internal/pss/policies with deckhouse main @ 3230c33d89, so that dmt knows the new pathType field of spec.volumes.hostPath.allowedValues[] in SecurityPolicyException. Without it security-policy-exception-schema rejects every SPE that uses pathType: Prefix with unknown field, which blocks modules adopting it (e.g. sds-elastic).

Upstream changes (git log 2942ea4200..3230c33d89 -- modules/015-admission-policy-engine, the ones that touch the synced files):

  • deckhouse MR !993: D8AllowedHostPaths allows paths nested under an SPE hostPath entry, compared by path components (introduced as allowSubPaths); the SPE CRD documents the * suffix of seccomp profiles and sysctl names.
  • deckhouse MR !1054: allowSubPaths is replaced with pathType: Exact (the default, only the exact path) or Prefix (the path and every path nested under it; /var/lib allows /var/lib/docker, not /var/libvirt).
  • deckhouse MR !383: the Pod Security Standards are described as SecurityPolicy rules, and their constraints are rendered by the same code as a SecurityPolicy (security_policy_constraints). templates/policies/pod-security-standards/{baseline,restricted}/constraint.yaml are gone; the standards now live in templates/policies/{pod-security-standards.yaml,_pod-security-standards.tpl,_helpers.tpl,security-policy.yaml}. D8AllowedCapabilities gets the skipControllerChecks parameter.

The other commits in the range (!769, !943, !1011, !1052) touch nothing dmt syncs. GATEKEEPER_VERSION stays 3.23.1.

dmt changes:

  • internal/pss/pss.go: the PSS parameters are rendered from pod-security-standards.yaml; the other files of templates/policies only provide defines and are added as partials. The kind and parameters are taken from the d8-pod-security-<standard>-system constraints, the ones for the d8-* and kube-* namespaces dmt checks. The rendered checks are the same as before: the same kinds in both standards with the same parameters, except that restricted D8AllowPrivilegeEscalation no longer gets allowPrivilegeEscalation: false, which its rego never read.
  • internal/pss/stub.tpl: stubs system_namespaces, system_namespaces_action (module templates/_helpers.tpl) and helm_lib_module_labels (helm_lib), which the new templates call and which are not synced; the pod_security_standard_baseline|restricted stubs are dropped, nothing calls them anymore. ape.only_ready_constraints stays a pass-through.
  • Tests: pathType in the schema (Prefix passes, an unknown value fails with Unsupported value), in the hostPath check (Prefix covers a nested path, Exact and an omitted pathType require the exact path, Prefix /var/lib does not cover /var/libvirt), and DefaultSPE now sets pathType: Exact, as the apiserver does.

The policies sync script still copies the two removed constraint.yaml files and takes the PSS kinds from them; it needs the new file list before its next run.

Testing

  • go test ./... and golangci-lint v2.15.0 pass (0 issues).
  • The new tests fail on main.
  • dmt lint on sds-elastic with SPEs using pathType: Prefix: the two security-policy-exception-schema errors (spec.volumes.hostPath.allowedValues[N].pathType: unknown field) are gone, the module passes with 0 errors.
  • On deckhouse main (modules/, without the edition overlays) the findings of this branch and main are the same (247; 3 of them pod-security-standards), apart from the random name of the etcd-backup CronJob.

Syncs internal/pss/policies with deckhouse main @ 3230c33d89.

Upstream changes:
- !993: D8AllowedHostPaths allows paths nested under an SPE hostPath entry, matched by path
  components (added as allowSubPaths); the SPE CRD documents the `*` suffix of seccomp profiles
  and sysctl names.
- !1054: allowSubPaths is replaced with
  spec.volumes.hostPath.allowedValues[].pathType: Exact (the default) or Prefix.
- !383: the Pod Security Standards are described as SecurityPolicy rules and their constraints
  are rendered through security_policy_constraints; D8AllowedCapabilities gets
  skipControllerChecks. templates/policies/pod-security-standards/{baseline,restricted}/
  constraint.yaml are replaced by templates/policies/{pod-security-standards.yaml,
  _pod-security-standards.tpl,_helpers.tpl,security-policy.yaml}.

dmt changes:
- internal/pss/pss.go: the parameters are rendered from pod-security-standards.yaml, the other
  files of templates/policies are added as partials, and the kind and parameters are taken from
  the d8-pod-security-<standard>-system constraints, the ones of the d8-* and kube-* namespaces.
- internal/pss/stub.tpl: stubs system_namespaces, system_namespaces_action and
  helm_lib_module_labels instead of pod_security_standard_baseline|restricted.
- Tests: pathType in the schema and in the hostPath check; DefaultSPE sets pathType: Exact.

Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
@ldmonster
ldmonster merged commit a4d637d into main Oct 28, 2026
9 checks passed
@ldmonster
ldmonster deleted the chore/sync-pss-policies-pathtype branch October 28, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants