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

Metrics: grant hawkular namespace listener role #4865

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions roles/openshift_metrics/tasks/generate_rolebindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,27 @@
- kind: ServiceAccount
name: hawkular
changed_when: no

- name: generate hawkular-metrics cluster role binding for the hawkular service account
template:
src: rolebinding.j2
dest: "{{ mktemp.stdout }}/templates/hawkular-cluster-rolebinding.yaml"
vars:
cluster: True
obj_name: hawkular-namespace-watcher
labels:
metrics-infra: hawkular
roleRef:
kind: ClusterRole
name: hawkular-metrics
subjects:
- kind: ServiceAccount
name: hawkular
namespace: "{{openshift_metrics_project}}"
changed_when: no

- name: generate the hawkular cluster role
template:
src: hawkular_metrics_role.j2
dest: "{{ mktemp.stdout }}/templates/hawkular-cluster-role.yaml"
changed_when: no
3 changes: 2 additions & 1 deletion roles/openshift_metrics/tasks/uninstall_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
command: >
{{ openshift.common.client_binary }} -n {{ openshift_metrics_project }} --config={{ mktemp.stdout }}/admin.kubeconfig
delete --ignore-not-found --selector=metrics-infra
all,sa,secrets,templates,routes,pvc,rolebindings,clusterrolebindings
all,sa,secrets,templates,routes,pvc,rolebindings,clusterrolebindings,clusterrole
register: delete_metrics
changed_when: delete_metrics.stdout != 'No resources found'

Expand All @@ -16,4 +16,5 @@
delete --ignore-not-found
rolebinding/hawkular-view
clusterrolebinding/heapster-cluster-reader
clusterrolebinding/hawkular-metrics
changed_when: delete_metrics.stdout != 'No resources found'
15 changes: 15 additions & 0 deletions roles/openshift_metrics/templates/hawkular_metrics_role.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ClusterRole
metadata:
name: hawkular-metrics
labels:
metrics-infra: hawkular-metrics
rules:
- apiGroups:
- ""
resources:
- namespaces
verbs:
- list
- get
- watch