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

[BUG][opensearch] Chart not installing in PSP enabled kubernetes clusters >= 1.21. #157

Closed
chbmuc opened this issue Dec 4, 2021 · 1 comment · Fixed by #162
Closed
Labels
bug Something isn't working

Comments

@chbmuc
Copy link

chbmuc commented Dec 4, 2021

Describe the bug
Chart not installing in Kubernetes clusters >= 1.21 with PodSecurityPolicies enabled.

This is because the chart want's to use apiVersion: policy/v1. However there is no such apiVersion and there never will be. podSecurityPolicys have been deprecated, because they will be removed completely in future Kubernetes versions.

To Reproduce
Steps to reproduce the behavior:

  1. Requirement: PSP enabled kubernetes cluster >= 1.21
  2. helm install opensearch --set=podSecurityPolicy.create=true --set=rbac.create=true opensearch/opensearch
  3. Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "PodSecurityPolicy" in version "policy/v1"

Expected behavior
Chart should install with a warning about the deprecation.

Chart Name
opensearch

Host/Environment (please complete the following information):

  • Helm Version: 3.7.1
  • Kubernetes Version: 1.21.5

Additional context
Suggested patch:

--- a/charts/opensearch/templates/podsecuritypolicy.yaml
+++ b/charts/opensearch/templates/podsecuritypolicy.yaml
@@ -1,10 +1,6 @@
 {{- if .Values.podSecurityPolicy.create -}}
 {{- $fullName := include "opensearch.uname" . -}}
-{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
-apiVersion: policy/v1
-{{- else -}}
 apiVersion: policy/v1beta1
-{{- end }}
 kind: PodSecurityPolicy
 metadata:
   name: {{ default $fullName .Values.podSecurityPolicy.name | quote }}
@chbmuc chbmuc added bug Something isn't working untriaged Issues that have not yet been triaged labels Dec 4, 2021
@TheAlgo TheAlgo removed the untriaged Issues that have not yet been triaged label Dec 6, 2021
@TheAlgo
Copy link
Member

TheAlgo commented Dec 6, 2021

@chbmuc Thanks for bringing this up. Do you plan of raising PR for it?

@peterzhuamazon peterzhuamazon linked a pull request Dec 9, 2021 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants