-
Notifications
You must be signed in to change notification settings - Fork 418
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
Add kubeRBACProxy property to support querying in cluster prometheus in openshift #3700
Conversation
96579c5
to
64a1cfa
Compare
…crape cost-analyzer
This looks good to me. Let's merge when the opencost PR is merged. |
8da5e63
to
4082b4b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.global.platforms.openshift.monitoringServiceAccountName | quote }} | ||
namespace: openshift-monitoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to assume that the ServiceAccount we want to bind to will always be in openshift-monitoring
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you are correct here. It is not safe to assume the namespace. I would have to correct this.
# createMonitoringClusterRoleBinding: false # Create a Cluster Role Binding to allow using in-cluster prometheus or thanos. | ||
# createMonitoringResourceReaderRoleBinding: false # Create a Role and Role Binding to allow in-cluster prometheus or thanos to list and watch resources. This will be necessary if you are not using bundled prometheus and need to add scrape config for resources. | ||
# monitoringServiceAccountName: prometheus-k8s # Name of the service account to bind to the Resource Reader Role Binding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add these comments to the main values.yaml
file as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, I think we should also uncomment them and set default values when possible. Example:
# Platforms is a higher-level abstraction for platform-specific values and settings.
platforms:
# Deploying to OpenShift (OCP) requires enabling this option.
openshift:
enabled: true # Deploy Kubecost to OpenShift.
createMonitoringClusterRoleBinding: false # Create a Cluster Role Binding to allow using in-cluster prometheus or thanos.
createMonitoringResourceReaderRoleBinding: false # Create a Role and Role Binding to allow in-cluster prometheus or thanos to list and watch resources. This will be necessary if you are not using bundled prometheus and need to add scrape config for resources.
monitoringServiceAccountName: prometheus-k8s # Name of the service account to bind to the Resource Reader Role Binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, will uncomment these. I added these specific to openshift and should make it more generalized. Should I move these to global instead? instead of having them under openshift?
Good finds Thomas. Ishaan- we merged because we have an urgent need with some customers and needed to test. Thank you for getting this done so quickly! |
kind: ClusterRole | ||
name: cluster-monitoring-view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What ClusterRole is this referring to? I couldn't find any reference to this in the Helm chart. Is this an existing ClusterRole that's specific to OpenShift installs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for clarifying! Lets leave a comment in the template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure 👍
Thank you Thomas for pointing these out. |
What does this PR change?
kubeRBACProxy
property to setKUBE_RBAC_PROXY_ENABLED
as true in the env var of the cost-model.createPrometheusClusterRoleBinding
property to create cluster role binding to grant required permissions to the serviceaccount to query prometheus with kube-rbac-proxy enabled.kubeRBACProxy
andBearerToken
property can not be set together,Does this PR rely on any other PRs?
opencost/opencost#2944
How does this PR impact users? (This is the kind of thing that goes in release notes!)
THis will enable openshift cluster users to configure installing kubecost while using their in-cluster prometheus.
Links to Issues or tickets this PR addresses or fixes
Closes #3690
What risks are associated with merging this PR? What is required to fully test this PR?
NA
How was this PR tested?
tested by installing kubecost using custom built cost-model image having these changes while disabling the bundled prometheus and using the in-cluster prometheus.
Have you made an update to documentation? If so, please provide the corresponding PR.
https://github.com/kubecost/docs/pull/1144/files