Skip to content

feat(deploy/chart): adding hostUsers property to pods #7973

Merged
cert-manager-prow[bot] merged 4 commits intocert-manager:masterfrom
hjoshi123:feat/user-namespace-feature
Sep 15, 2025
Merged

feat(deploy/chart): adding hostUsers property to pods #7973
cert-manager-prow[bot] merged 4 commits intocert-manager:masterfrom
hjoshi123:feat/user-namespace-feature

Conversation

@hjoshi123
Copy link
Copy Markdown
Collaborator

@hjoshi123 hjoshi123 commented Aug 18, 2025

Pull Request Motivation

Fixes #7885

Refer to https://kubernetes.io/blog/2025/04/25/userns-enabled-by-default/ for more context on the feature.

Kind

/kind feature

Release Note

added experimental field `hostUsers` flag to all pods. Not set by default.

@cert-manager-prow cert-manager-prow bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. area/deploy Indicates a PR modifies deployment configuration size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 18, 2025
@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from d49a30d to 5c7c2ab Compare August 18, 2025 16:46
@cert-manager-prow cert-manager-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 18, 2025
@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch 4 times, most recently from f524509 to 6339771 Compare August 18, 2025 17:45
@hawksight
Copy link
Copy Markdown
Member

Hey @hjoshi123, thanks for taking the time to add this. I think there are 2 issues or points to discuss:

  1. I think you can se with and coalesce helm functions here to minimise the YAML. For example, a similar global vs specific values here: https://github.com/cert-manager/cert-manager/blob/master/deploy/charts/cert-manager/templates/startupapicheck-job.yaml#L79-L84 - (goal - less YAML / maintainability)
  2. Given that this is default in 1.33 which is current minus 1, we might want to enable this is a way where we don't specify it by default. For example .Values.global.hostUsers: "" to make it blank. In which case, no YAML. Unless you can prove that providing the default value of hostUsers: false works on k8s 1.29 (from our supported releases for v1.18). If it works on a 1.29 kind cluster set to false, then we can ignore this point. - (goal - maintain support for all supported versions / backwards compatibility)

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

Hey @hjoshi123, thanks for taking the time to add this. I think there are 2 issues or points to discuss:

  1. I think you can se with and coalesce helm functions here to minimise the YAML. For example, a similar global vs specific values here: https://github.com/cert-manager/cert-manager/blob/master/deploy/charts/cert-manager/templates/startupapicheck-job.yaml#L79-L84 - (goal - less YAML / maintainability)
  2. Given that this is default in 1.33 which is current minus 1, we might want to enable this is a way where we don't specify it by default. For example .Values.global.hostUsers: "" to make it blank. In which case, no YAML. Unless you can prove that providing the default value of hostUsers: false works on k8s 1.29 (from our supported releases for v1.18). If it works on a 1.29 kind cluster set to false, then we can ignore this point. - (goal - maintain support for all supported versions / backwards compatibility)

@hawksight yes it does make sense to use with here I think.. I can refactor the code and try to make it better.
On the second point, my intention was to only put the hostUsers field when its true; this way if the value is false then the field doesn't show up in the spec at all so we don't have to worry about compatibility issues below 1.33. 1.33 has the hostUsers field false by default.

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

Also, I am not sure if coalesce can handle booleans, was reading the documentation to make sure and they seem to mention lists

@hawksight
Copy link
Copy Markdown
Member

hawksight commented Sep 2, 2025

@hjoshi123 - I'll join stand up today to talk about it hopefully, you are probably right.

I did a quick test in kind 1.27:

➜  cert-manager git:(feat/user-namespace-feature) ✗ k explain deployment.spec.template.spec.hostUsers
GROUP:      apps
KIND:       Deployment
VERSION:    v1

FIELD: hostUsers <boolean>


DESCRIPTION:
    Use the host's user namespace. Optional: Default to true. If set to true or
    not present, the pod will be run in the host user namespace, useful for when
    the pod needs a feature only available to the host user namespace, such as
    loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns
    is created for the pod. Setting false is useful for mitigating container
    breakout vulnerabilities even allowing users to run their containers as root
    without actually having root privileges on the host. This field is
    alpha-level and is only honored by servers that enable the
    UserNamespacesSupport feature.


➜  cert-manager git:(feat/user-namespace-feature) ✗ k version
Client Version: v1.34.0
Kustomize Version: v5.7.1
Server Version: v1.27.13
Warning: version difference between client (1.34) and server (1.27) exceeds the supported minor version skew of +/-1

It's confusingly worded I find:

Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace...

When set to false, a new userns is created for the pod.

I actually think we want to default it to false, unless someone explicitly needs it true.
I guess we need to check with maintainers to see if there are any host user namespace capabilities needed. My gut says no.

@hawksight
Copy link
Copy Markdown
Member

If we assume we want to set it to a safe default of "false", then the logic could be shorter:

      {{- if hasKey .Values.cainjector "hostUsers" }}
      hostUsers: {{ .Values.cainjector.hostUsers }}
      {{- else }}
      hostUsers: {{ .Values.global.hostUsers }}
      {{- end }}

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

If we assume we want to set it to a safe default of "false", then the logic could be shorter:

      {{- if hasKey .Values.cainjector "hostUsers" }}

      hostUsers: {{ .Values.cainjector.hostUsers }}

      {{- else }}

      hostUsers: {{ .Values.global.hostUsers }}

      {{- end }}

Ah yes that makes it simpler. So it is a valid field in 1.27 too then. I will make the change. Thank you @hawksight

@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from 6339771 to 2c4f3a8 Compare September 2, 2025 23:59
@hjoshi123
Copy link
Copy Markdown
Collaborator Author

@hawksight changed the code.. could you take a look at it again?

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

/release-note-edit

added `hostUsers` flag to all pods. Defaults to false. 

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

/retest

@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from 2c4f3a8 to f57cb82 Compare September 3, 2025 01:36
@hjoshi123
Copy link
Copy Markdown
Collaborator Author

not sure why the tests are failing.. locally all tests seem to be running..
/retest

@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch 2 times, most recently from de7b4df to a4401ab Compare September 3, 2025 15:41
@hawksight
Copy link
Copy Markdown
Member

/retest
/lgtm

@hjoshi123
Copy link
Copy Markdown
Collaborator Author

hjoshi123 commented Sep 13, 2025

I lean towards the first option and adding comments about how to use the false value if required. This way users can be prepared if they want to. The default value for this field is true after 1.33 anyway. And then once its GA we can mark it as false. WDYT?

Not sure if I understand. 😅 We use cert-manager, and I don't want to have the hostUsers field set at all in the pod template. At least not until all supported K8s versions understand it.

Ah I understand now.. so we make the field optional then i.e. not set any value at all and then add comments about the fact that its an experimental feature? I understand what you are arriving at but still confused how i would implement it 😅

@erikgb
Copy link
Copy Markdown
Member

erikgb commented Sep 13, 2025

Ah I understand now.. so we make the field optional then i.e. not set any value at all and then add comments about the fact that its an experimental feature? I understand what you are arriving at but still confused how i would implement it 😅

That's a typical Helm issue. I think you need to distinguish between an unset value and the false value. There must be some way of doing this in Helm......

@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from cbc99c8 to 0afdc2f Compare September 14, 2025 04:06
@cert-manager-prow cert-manager-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 14, 2025
@hjoshi123
Copy link
Copy Markdown
Collaborator Author

@erikgb pushed some changes according to our discussions.. the comments may not be that polished so let me know if it needs changing

…ce-feature

Signed-off-by: hjoshi123 <mail@hjoshi.me>
@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from 0afdc2f to 80e38ec Compare September 14, 2025 04:15
Co-authored-by: Erik Godding Boye <egboye@gmail.com>
Signed-off-by: Hemant Joshi <mail2hemantjoshi@pm.me>
Signed-off-by: hjoshi123 <mail@hjoshi.me>
@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from b34d68f to 13f2ed8 Compare September 14, 2025 20:22
Copy link
Copy Markdown
Member

@erikgb erikgb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for working on this, @hjoshi123. It's a very interesting subject, and I am glad we spent some time deciding on where to go here. Your solution looks good now, and I hope both you and @hawksight agree?

I've added a suggestion to the value docs. The last part is no longer correct, and I think the text was a bit hard to read. With a little help from ChatGPT, I put in a suggestion. Feel free to adjust.

/approve

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 15, 2025
@cert-manager-prow
Copy link
Copy Markdown
Contributor

cert-manager-prow bot commented Sep 15, 2025

@hjoshi123: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cert-manager-master-license 7c5a26a link false /test pull-cert-manager-master-license
pull-cert-manager-master-e2e-v1-33 cbc99c8 link true /test pull-cert-manager-master-e2e-v1-33
pull-cert-manager-master-e2e-v1-33-upgrade cbc99c8 link true /test pull-cert-manager-master-e2e-v1-33-upgrade

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Co-authored-by: Erik Godding Boye <egboye@gmail.com>
Signed-off-by: Hemant Joshi <mail2hemantjoshi@pm.me>
Signed-off-by: hjoshi123 <mail@hjoshi.me>
@hjoshi123 hjoshi123 force-pushed the feat/user-namespace-feature branch from a7fd37e to caeb2d0 Compare September 15, 2025 20:35
Copy link
Copy Markdown
Member

@erikgb erikgb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @hjoshi123! 🚀

/lgtm
/approve

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2025
@cert-manager-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erikgb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@erikgb
Copy link
Copy Markdown
Member

erikgb commented Sep 15, 2025

/hold

Can you update release notes, please?

@cert-manager-prow cert-manager-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 15, 2025
@cert-manager-prow cert-manager-prow bot merged commit 954cb20 into cert-manager:master Sep 15, 2025
6 checks passed
@erikgb
Copy link
Copy Markdown
Member

erikgb commented Sep 15, 2025

/unhold

@cert-manager-prow cert-manager-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 15, 2025
@hjoshi123
Copy link
Copy Markdown
Collaborator Author

/release-note-edit

added experimental field `hostUsers` flag to all pods. Not set by default.

alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Oct 8, 2025
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cert-manager](https://cert-manager.io) ([source](https://github.com/cert-manager/cert-manager)) | minor | `v1.18.2` -> `v1.19.0` |

---

### Release Notes

<details>
<summary>cert-manager/cert-manager (cert-manager)</summary>

### [`v1.19.0`](https://github.com/cert-manager/cert-manager/releases/tag/v1.19.0)

[Compare Source](cert-manager/cert-manager@v1.18.2...v1.19.0)

cert-manager is the easiest way to automatically manage certificates in Kubernetes and OpenShift clusters.

This release focuses on expanding platform compatibility, improving deployment flexibility, enhancing observability, and addressing key reliability issues.

> 📖  Read the full release notes at cert-manager.io: <https://cert-manager.io/docs/releases/release-notes/release-notes-1.19>

Changes since `v1.18.0`:

#### Feature

- Add IPv6 rules to the default network policy ([#&#8203;7726](cert-manager/cert-manager#7726), [@&#8203;jcpunk](https://github.com/jcpunk))
- Add `global.nodeSelector` to helm chart to allow for a single `nodeSelector` to be set across all services. ([#&#8203;7818](cert-manager/cert-manager#7818), [@&#8203;StingRayZA](https://github.com/StingRayZA))
- Add a feature gate to default to Ingress `pathType` `Exact` in ACME HTTP01 Ingress challenge solvers. ([#&#8203;7795](cert-manager/cert-manager#7795), [@&#8203;sspreitzer](https://github.com/sspreitzer))
- Add generated `applyconfigurations` allowing clients to make type-safe server-side apply requests for cert-manager resources. ([#&#8203;7866](cert-manager/cert-manager#7866), [@&#8203;erikgb](https://github.com/erikgb))
- Added API defaults to issuer references group (cert-manager.io) and kind (Issuer). ([#&#8203;7414](cert-manager/cert-manager#7414), [@&#8203;erikgb](https://github.com/erikgb))
- Added `certmanager_certificate_challenge_status` Prometheus metric. ([#&#8203;7736](cert-manager/cert-manager#7736), [@&#8203;hjoshi123](https://github.com/hjoshi123))
- Added `protocol` field for `rfc2136` DNS01 provider ([#&#8203;7881](cert-manager/cert-manager#7881), [@&#8203;hjoshi123](https://github.com/hjoshi123))
- Added experimental field `hostUsers` flag to all pods. Not set by default. ([#&#8203;7973](cert-manager/cert-manager#7973), [@&#8203;hjoshi123](https://github.com/hjoshi123))
- Support configurable resource requests and limits for ACME HTTP01 solver pods through ClusterIssuer and Issuer specifications, allowing granular resource management that overrides global `--acme-http01-solver-resource-*` settings. ([#&#8203;7972](cert-manager/cert-manager#7972), [@&#8203;lunarwhite](https://github.com/lunarwhite))
- The `CAInjectorMerging` feature has been promoted to BETA and is now enabled by default ([#&#8203;8017](cert-manager/cert-manager#8017), [@&#8203;ThatsMrTalbot](https://github.com/ThatsMrTalbot))
- The controller, webhook and ca-injector now log their version and git commit on startup for easier debugging and support. ([#&#8203;8072](cert-manager/cert-manager#8072), [@&#8203;prasad89](https://github.com/prasad89))
- Updated `certificate` metrics to the collector approach. ([#&#8203;7856](cert-manager/cert-manager#7856), [@&#8203;hjoshi123](https://github.com/hjoshi123))

#### Bug or Regression

- ACME: Increased challenge authorization timeout to 2 minutes to fix `error waiting for authorization` ([#&#8203;7796](cert-manager/cert-manager#7796), [@&#8203;hjoshi123](https://github.com/hjoshi123))
- BUGFIX: permitted URI domains were incorrectly used to set the excluded URI domains in the CSR's name constraints ([#&#8203;7816](cert-manager/cert-manager#7816), [@&#8203;kinolaev](https://github.com/kinolaev))
- Enforced ACME HTTP-01 solver validation to properly reject configurations when multiple ingress options (`class`, `ingressClassName`, `name`) are specified simultaneously ([#&#8203;8021](cert-manager/cert-manager#8021), [@&#8203;lunarwhite](https://github.com/lunarwhite))
- Increase maximum sizes of PEM certificates and chains which can be parsed in cert-manager, to handle leaf certificates with large numbers of DNS names or other identities ([#&#8203;7961](cert-manager/cert-manager#7961), [@&#8203;SgtCoDFish](https://github.com/SgtCoDFish))
- Reverted adding the `global.rbac.disableHTTPChallengesRole` Helm option. ([#&#8203;7836](cert-manager/cert-manager#7836), [@&#8203;inteon](https://github.com/inteon))
- This change removes the `path` label of core ACME client metrics and will require users to update their monitoring dashboards and alerting rules if using those metrics. ([#&#8203;8109](cert-manager/cert-manager#8109), [@&#8203;mladen-rusev-cyberark](https://github.com/mladen-rusev-cyberark))
- Use the latest version of `ingress-nginx` in E2E tests to ensure compatibility ([#&#8203;7792](cert-manager/cert-manager#7792), [@&#8203;wallrj](https://github.com/wallrj))

#### Other (Cleanup or Flake)

- Helm: Fix naming template of `tokenrequest` RoleBinding resource to improve consistency ([#&#8203;7761](cert-manager/cert-manager#7761), [@&#8203;lunarwhite](https://github.com/lunarwhite))
- Improve error messages when certificates, CRLs or private keys fail admission due to malformed or missing PEM data ([#&#8203;7928](cert-manager/cert-manager#7928), [@&#8203;SgtCoDFish](https://github.com/SgtCoDFish))
- Major upgrade of Akamai SDK. NOTE: The new version has not been fully tested end-to-end due to the lack of cloud infrastructure. ([#&#8203;8003](cert-manager/cert-manager#8003), [@&#8203;hjoshi123](https://github.com/hjoshi123))
- Update kind images to include the Kubernetes 1.33 node image ([#&#8203;7786](cert-manager/cert-manager#7786), [@&#8203;wallrj](https://github.com/wallrj))
- Use `maps.Copy` for cleaner map handling ([#&#8203;8092](cert-manager/cert-manager#8092), [@&#8203;quantpoet](https://github.com/quantpoet))
- Vault: Migrate Vault E2E add-on tests from deprecated `vault-client-go` to the new `vault/api` client. ([#&#8203;8059](cert-manager/cert-manager#8059), [@&#8203;armagankaratosun](https://github.com/armagankaratosun))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNCIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJjaGFydCJdfQ==-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/1711
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
@wallrj-cyberark
Copy link
Copy Markdown
Member

@hjoshi123 We have released this. Please test and feedback: https://github.com/cert-manager/cert-manager/releases/tag/v1.19.1

@jcpunk
Copy link
Copy Markdown
Contributor

jcpunk commented Dec 19, 2025

Adding a note here: kind doesn't work with hostUsers: false. So while I fully support making user namespaces the default, I'll need a way to continue testing my environment in kind...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/acme Indicates a PR directly modifies the ACME Issuer code area/deploy Indicates a PR modifies deployment configuration area/testing Issues relating to testing dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow enabling user namespaces in helm chart

5 participants