Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm: disabled PodSecurityPolicy in 1.25 still blocks upgrades #5238

Closed
dimitarvdimitrov opened this issue Jun 13, 2023 · 1 comment · Fixed by #5357
Closed

Helm: disabled PodSecurityPolicy in 1.25 still blocks upgrades #5238

dimitarvdimitrov opened this issue Jun 13, 2023 · 1 comment · Fixed by #5357
Labels
bug Something isn't working helm

Comments

@dimitarvdimitrov
Copy link
Contributor

dimitarvdimitrov commented Jun 13, 2023

The mimir-distributed helm chart doesn't render the PodSecurityPolicy resource when installed on clusters with version >= 1.25 (as of #2870)

{{- define "mimir.rbac.usePodSecurityPolicy" -}}
{{- and (semverCompare "< 1.25-0" (include "mimir.kubeVersion" .)) (and .Values.rbac.create (eq .Values.rbac.type "psp")) -}}
{{- end -}}

Helm stores the history of manifests of resources in a kubernetes secret in the namespace of the release. So upon upgrading the 1.25 the helm chart no longer renders the manifest, however Helm still tries to recover it from the release history. This causes failed installations with the following error

resource mapping not found for name: "mimir" namespace: "" from "": no matches for kind "PodSecurityPolicy" in version "policy/v1beta1" ensure CRDs are installed first

Helm docs document this as expected behaviour (which effectively forbids using deprecated resources in the last release they are available)

Workarounds

  • Delete the Kubernetes Secret that contains the release history. This forfeits the ability to do rollbacks.
  • Upgrade the chart while still on kubernetes 1.24 but force omitting the PodSecurityPolicy with rbac.create: false

Proposed fix

Change the condition of omitting the PodSecurityContext resource to <= 1.24.

@dimitarvdimitrov dimitarvdimitrov added bug Something isn't working helm labels Jun 13, 2023
@dimitarvdimitrov
Copy link
Contributor Author

This was reported in the community slack by Mario and Pea (thread; link expires after a few months)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working helm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant