diff --git a/stable/fluent-bit/Chart.yaml b/stable/fluent-bit/Chart.yaml index f5fc2eda78..9a6e86b62a 100755 --- a/stable/fluent-bit/Chart.yaml +++ b/stable/fluent-bit/Chart.yaml @@ -1,5 +1,5 @@ name: fluent-bit -version: 0.2.3 +version: 0.2.4 appVersion: 0.12.7 description: Fast and Lightweight Log/Data Forwarder for Linux, BSD and OSX keywords: diff --git a/stable/fluent-bit/templates/_helpers.tpl b/stable/fluent-bit/templates/_helpers.tpl index 60a7147295..7518683c80 100644 --- a/stable/fluent-bit/templates/_helpers.tpl +++ b/stable/fluent-bit/templates/_helpers.tpl @@ -14,3 +14,14 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC APIs. +*/}} +{{- define "rbac.apiVersion" -}} +{{- if ge .Capabilities.KubeVersion.Minor "8" -}} +"rbac.authorization.k8s.io/v1" +{{- else -}} +"rbac.authorization.k8s.io/v1beta1" +{{- end -}} +{{- end -}} diff --git a/stable/fluent-bit/templates/cluster-role.yaml b/stable/fluent-bit/templates/cluster-role.yaml new file mode 100644 index 0000000000..c2979c54b4 --- /dev/null +++ b/stable/fluent-bit/templates/cluster-role.yaml @@ -0,0 +1,18 @@ +{{- if .Values.rbac.create -}} +apiVersion: {{ template "rbac.apiVersion" . }} +kind: ClusterRole +metadata: + labels: + app: {{ template "fluent-bit.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "fluent-bit.fullname" . }} +rules: + - apiGroups: + - "" + resources: + - pods + verbs: + - get +{{- end -}} diff --git a/stable/fluent-bit/templates/cluster-rolebinding.yaml b/stable/fluent-bit/templates/cluster-rolebinding.yaml new file mode 100644 index 0000000000..0bf892e959 --- /dev/null +++ b/stable/fluent-bit/templates/cluster-rolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.rbac.create -}} +apiVersion: {{ template "rbac.apiVersion" . }} +kind: ClusterRoleBinding +metadata: + labels: + app: {{ template "fluent-bit.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "fluent-bit.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "fluent-bit.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ template "fluent-bit.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- end -}} diff --git a/stable/fluent-bit/templates/daemonset.yaml b/stable/fluent-bit/templates/daemonset.yaml index d88ff5f28c..7a8c95dc7e 100644 --- a/stable/fluent-bit/templates/daemonset.yaml +++ b/stable/fluent-bit/templates/daemonset.yaml @@ -10,6 +10,7 @@ spec: labels: app: {{ template "fluent-bit.fullname" . }} spec: + serviceAccountName: {{ if .Values.rbac.create }}{{ template "fluent-bit.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }} containers: - name: fluent-bit image: "{{ .Values.image.fluent_bit.repository }}:{{ .Values.image.fluent_bit.tag }}" diff --git a/stable/fluent-bit/templates/serviceaccount.yaml b/stable/fluent-bit/templates/serviceaccount.yaml new file mode 100644 index 0000000000..292b56c91e --- /dev/null +++ b/stable/fluent-bit/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.rbac.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "fluent-bit.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "fluent-bit.fullname" . }} +{{- end -}} diff --git a/stable/fluent-bit/values.yaml b/stable/fluent-bit/values.yaml index 862a319804..9894d0045b 100644 --- a/stable/fluent-bit/values.yaml +++ b/stable/fluent-bit/values.yaml @@ -30,7 +30,7 @@ resources: ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ ## tolerations: [] -#- key: "key" +# - key: "key" # operator: "Equal|Exists" # value: "value" # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" @@ -39,3 +39,10 @@ tolerations: [] ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ ## nodeSelector: {} + +## Install Default RBAC roles and bindings +rbac: + ## If true, create & use RBAC resources + create: false + ## Ignored if rbac.create is true + serviceAccountName: default