Skip to content

Commit

Permalink
charts: fix k8s v1.25 compatibility for PSP (#506)
Browse files Browse the repository at this point in the history
* ci: add k8s v1.25 to testing matrix

* charts: fix PSP compatibility check to work with ArgoCD

Related: #505
  • Loading branch information
zekker6 authored Mar 29, 2023
1 parent acb6504 commit 3311e77
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
matrix:
chart: ${{ fromJSON(needs.get-changed-charts.outputs.charts) }}
k8s_version: ["v1.22.16", "v1.23.14", "v1.24.8"]
k8s_version: ["v1.22.16", "v1.23.14", "v1.24.8", "v1.25.8"]
fail-fast: false
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-agent/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ rules:
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
{{- end }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down Expand Up @@ -39,4 +39,4 @@ spec:
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-alert/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ metadata:
{{ toYaml . | indent 4 }}
{{- end }}
rules:
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "vmalert.server.fullname" . }}]
{{- else }}
rules: []
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-auth/templates/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down Expand Up @@ -39,4 +39,4 @@ spec:
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/victoria-metrics-cluster/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down Expand Up @@ -39,4 +39,4 @@ spec:
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-cluster/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
Expand All @@ -22,4 +22,4 @@ rules:
{{- else }}
rules: []
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-operator/templates/psp.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down Expand Up @@ -84,4 +84,4 @@ roleRef:
name: {{ include "vm-operator.fullname" . }}-psp
apiGroup: rbac.authorization.k8s.io
---
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/victoria-metrics-single/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rules:
- nonResourceURLs: [ "/metrics" ]
verbs: [ "get" ]
{{- end }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
Expand Down Expand Up @@ -39,4 +39,4 @@ spec:
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-single/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -20,4 +20,4 @@ rules:
verbs: ['use']
resourceNames: [{{ template "victoria-metrics.fullname" . }}]
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/victoria-metrics-single/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1") }}
{{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -23,4 +23,4 @@ subjects:
name: {{ template "victoria-metrics.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 3311e77

Please sign in to comment.