Skip to content

Commit

Permalink
fix(falco): set the appropiate apiVersion for rbac
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Grasso <[email protected]>
  • Loading branch information
leogr authored and poiana committed Oct 1, 2020
1 parent 0083243 commit a0dfeee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions falco/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,15 @@ Extract the unixSocket's directory path
{{- if .Values.falco.grpc.unixSocketPath -}}
{{- .Values.falco.grpc.unixSocketPath | trimPrefix "unix://" | dir -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for rbac.
*/}}
{{- define "rbac.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }}
{{- print "rbac.authorization.k8s.io/v1" -}}
{{- else -}}
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion falco/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.rbac.create }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
metadata:
name: {{ template "falco.fullname" .}}
labels:
Expand Down
2 changes: 1 addition & 1 deletion falco/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.rbac.create }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
metadata:
name: {{ template "falco.fullname" .}}
labels:
Expand Down

0 comments on commit a0dfeee

Please sign in to comment.