Render native AppArmor profiles on Kubernetes 1.30+ - #1
Merged
maksimu merged 1 commit intoMay 4, 2026
Merged
Conversation
Context: - The gateway chart only emitted the legacy AppArmor pod annotation. - Kubernetes 1.30+ supports native container securityContext.appArmorProfile. - Ubuntu 24.04 AppArmor deployments can require the native field for the gateway container to run under the intended local profile. Changes: - Translate the existing appArmorProfile value into native appArmorProfile syntax when Helm renders against Kubernetes 1.30+. - Preserve the legacy AppArmor annotation for Kubernetes versions before 1.30. - Document the version-gated behavior and runtime profile verification command. - Bump the keeper-gateway chart version to 0.2.1. Validation: - helm lint charts/keeper-gateway - helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.29.0 --set appArmorProfile=localhost/gateway-apparmor-profile - helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=localhost/gateway-apparmor-profile - helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=runtime/default - helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=unconfined - git diff --check Risk/Rollback: - Low risk; the native field is gated to Kubernetes 1.30+ and the legacy annotation remains in place. - Revert this commit to restore annotation-only AppArmor rendering.
freimer
force-pushed
the
codex/native-apparmor-profile
branch
from
May 1, 2026 16:31
be363aa to
8e558ed
Compare
Contributor
Author
|
Sorry, I needed to publish on my gh-pages, and pushed to the wrong branch. I reverted to the original PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This updates the
keeper-gatewaychart so the existingappArmorProfilevalue can render the native Kubernetes containersecurityContext.appArmorProfilefield when Helm renders against Kubernetes 1.30 or later.The chart continues to emit the legacy
container.apparmor.security.kubernetes.io/gatewaypod annotation for compatibility with Kubernetes versions before 1.30.Motivation
The current chart only emits the legacy AppArmor pod annotation. On Kubernetes 1.30+ clusters, including Ubuntu 24.04/k3s environments, the native container
appArmorProfilefield may be required for the gateway container to actually run under the intended local AppArmor profile.Without the native field, a hardened gateway deployment can appear correctly configured while
/proc/1/attr/currentstill reportsunconfined, which can break RBI/CEF startup under AppArmor.Changes
appArmorProfilevalues into native Kubernetes AppArmor profile objects:unconfined->type: Unconfinedruntime/default->type: RuntimeDefaultlocalhost/<profile>->type: LocalhostandlocalhostProfile: <profile>securityContext.appArmorProfileonly renders for Kubernetes 1.30+.keeper-gatewaychart version to0.2.1.Validation
helm lint charts/keeper-gatewayhelm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.29.0 --set appArmorProfile=localhost/gateway-apparmor-profilesecurityContext.appArmorProfiledoes not render.helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=localhost/gateway-apparmor-profilesecurityContext.appArmorProfile.type: LocalhostandlocalhostProfile: gateway-apparmor-profilerender.helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=runtime/defaulttype: RuntimeDefaultrenders.helm template kg charts/keeper-gateway --show-only templates/deployment.yaml --kube-version 1.30.0 --set appArmorProfile=unconfinedtype: Unconfinedrenders.git diff --checkDeployment And Rollback
Risk is low. The native field is gated to Kubernetes 1.30+ and the legacy annotation remains in place for all supported chart render paths.
Rollback by reverting commit
8e558edcbb02717a68dba72597d529790192baa5.