Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
[Feature/Chart] Quick fix for supporting watching multiple namespaces (
Browse files Browse the repository at this point in the history
…#25)

* Update role_binding.yaml

* Update role.yaml

* Update values.yaml

* Add non clustered role as described in  #9

Signed-off-by: arttii <[email protected]>

* Add changelog

Signed-off-by: arttii <[email protected]>

* Add missing list to string conversion

Signed-off-by: arttii <[email protected]>
  • Loading branch information
Arttii authored Aug 19, 2020
1 parent d0552c0 commit 678e014
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Added

- [PR #25](https://github.com/Orange-OpenSource/nifikop/pull/25) - [Helm Chart] Add support for iterating over namespaces

- [PR #18](https://github.com/Orange-OpenSource/nifikop/pull/18) - [Operator] NiFiKop CRDs in version `v1beta1` of CustomResourceDefinition object.

### Changed
Expand Down
2 changes: 1 addition & 1 deletion helm/nifikop/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- nifikop
args:
{{- if .Values.namespaces }}
- --namespaces={{ .Values.namespaces }}
- --namespaces={{ join "," .Values.namespaces }}
{{- end }}
readinessProbe:
exec:
Expand Down
18 changes: 11 additions & 7 deletions helm/nifikop/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{{- if .Values.rbacEnable }}
{{- range $namespace := $.Values.namespaces }}
{{- $_ := set $ "vals" $.Values }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app: {{ template "nifikop.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nifikop.name" . }}
app: {{ template "nifikop.name" $_ }}
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
heritage: {{ $.Release.Service }}
release: {{ $.Release.Name }}
name: {{ template "nifikop.name" $_ }}
namespace: {{$namespace}}
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -89,7 +92,7 @@ rules:
- cert-manager.io
resources:
- issuers
{{- if.Values.certManager.clusterScoped }}
{{- if $.Values.certManager.clusterScoped }}
- clusterissuers
{{- end }}
- certificates
Expand All @@ -111,4 +114,5 @@ rules:
- update
- patch
---
{{- end}}
{{- end}}
{{- end}}
25 changes: 15 additions & 10 deletions helm/nifikop/templates/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
# TODO : add a role binding for each namespace
{{- if .Values.rbacEnable }}
{{- range $namespace := $.Values.namespaces }}
{{- $_ := set $ "vals" $.Values }}
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nifikop.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nifikop.name" . }}
app: {{ template "nifikop.name" $ }}
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
heritage: {{ $.Release.Service }}
release: {{ $.Release.Name }}
name: {{ template "nifikop.name" $ }}
namespace: {{$namespace}}
subjects:
- kind: ServiceAccount
name: {{ template "nifikop.name" . }}
name: {{ template "nifikop.name" $ }}
namespace: {{$.Release.Namespace}}
roleRef:
kind: Role
name: {{ template "nifikop.name" . }}
name: {{ template "nifikop.name" $ }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
{{- end }}
---
#
#kind: RoleBinding
#apiVersion: rbac.authorization.k8s.io/v1
#metadata:
Expand All @@ -37,4 +42,4 @@ roleRef:
# kind: Role
# name: {{ template "nifikop.name" . }}
# apiGroup: rbac.authorization.k8s.io
#
#
3 changes: 2 additions & 1 deletion helm/nifikop/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vaultAddress: ""
# vaultSecret containing a `ca.crt` key with the Vault CA Certificate
vaultSecret: ""
# set of namespaces where the operator watches resources
namespaces: ""
namespaces: []

## Prometheus-operator resource limits & requests
## Ref: https://kubernetes.io/docs/user-guide/compute-resources/
Expand All @@ -30,6 +30,7 @@ createCustomResource: true
## If true, create & use RBAC resources
##
rbacEnable: true


## if true deploy service for metrics access
metricService: false
Expand Down

0 comments on commit 678e014

Please sign in to comment.