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

manifests: resources required for adding helm metrics in console #601

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions manifests/0000_90_console_01_prometheusrbac.yaml
@@ -0,0 +1,40 @@
# Role for accessing metrics exposed by the console
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: openshift-console
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
# Grant cluster-monitoring access to console metrics
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: openshift-console
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring
24 changes: 24 additions & 0 deletions manifests/0000_90_console_02_servicemonitor.yaml
@@ -0,0 +1,24 @@
# Configure cluster-monitoring for console
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: console
namespace: openshift-console
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
path: /metrics
port: https
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
serverName: console.openshift-console.svc
jobLabel: component
selector:
matchLabels:
app: console
1 change: 1 addition & 0 deletions manifests/02-namespace.yaml
Expand Up @@ -10,6 +10,7 @@ metadata:
workload.openshift.io/allowed: "management"
labels:
network.openshift.io/policy-group: "console"
openshift.io/cluster-monitoring: "true"
---
apiVersion: v1
kind: Namespace
Expand Down
20 changes: 20 additions & 0 deletions manifests/04-rbac-rolebinding-cluster.yaml
Expand Up @@ -88,3 +88,23 @@ roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: helm-chartrepos-viewer
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: console-auth-delegator
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
roleRef:
# for protected endpoints like /metrics, the operator must perform
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# for protected endpoints like /metrics, the operator must perform
# for protected endpoints like /metrics, the console backend must perform

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @jhadvig! Updated.

# authentication (tokenreview) & authorization (subjectaccessreview)
# which are granted by this ClusterRole
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: console
namespace: openshift-console
18 changes: 18 additions & 0 deletions manifests/04-rbac-rolebinding.yaml
Expand Up @@ -122,3 +122,21 @@ subjects:
- kind: ServiceAccount
name: console
namespace: openshift-console
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: console
namespace: kube-system
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
roleRef:
kind: Role
name: extension-apiserver-authentication-reader
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: console
namespace: openshift-console