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

fix openshift values to default with in-cluster prometheus #3721

Merged
merged 22 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e474d46
fix openshift values to default with in-cluster prometheus
mittal-ishaan Oct 25, 2024
9b0a5a8
enabling network cost as default
mittal-ishaan Oct 25, 2024
612513f
add pre-install helm hook annotation to SecurityContextConstraints
mittal-ishaan Oct 25, 2024
4091a6b
add pre-install helm hook small explanation comment
mittal-ishaan Oct 25, 2024
bf2d526
create a different values file
mittal-ishaan Oct 29, 2024
d5e7154
nit: fix comments
mittal-ishaan Oct 29, 2024
e684ad7
removing pre-hook
mittal-ishaan Oct 29, 2024
3a7e135
remove unneccessary commeennts and configs
mittal-ishaan Nov 1, 2024
7503377
fix openshift values to default with in-cluster prometheus
mittal-ishaan Oct 25, 2024
19e85e6
enabling network cost as default
mittal-ishaan Oct 25, 2024
af58338
add pre-install helm hook annotation to SecurityContextConstraints
mittal-ishaan Oct 25, 2024
0d6a066
add pre-install helm hook small explanation comment
mittal-ishaan Oct 25, 2024
ea6d672
create a different values file
mittal-ishaan Oct 29, 2024
07f30ed
nit: fix comments
mittal-ishaan Oct 29, 2024
9ebcf62
removing pre-hook
mittal-ishaan Oct 29, 2024
58a7eb6
remove unneccessary commeennts and configs
mittal-ishaan Nov 1, 2024
c5aba04
remove additional labels
mittal-ishaan Nov 14, 2024
d9ec52c
Merge branch 'openshift-prometheus-fix' of https://github.com/kubecos…
mittal-ishaan Nov 14, 2024
ddcff2b
get back nodeExporter scc
mittal-ishaan Nov 14, 2024
ba16825
improve openshift values example and make default values as one sourc…
mittal-ishaan Nov 14, 2024
a6a1181
lint
mittal-ishaan Nov 14, 2024
e24d72f
Merge branch 'develop' into openshift-prometheus-fix
mittal-ishaan Nov 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ metadata:
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
roleRef:
# Grant the kubecost service account the cluster-monitoring-view role to enable it to query OpenShift Prometheus.
# This is necessary for Kubecost to get access and query the in-cluster Prometheus instance using its service account token.
# https://docs.redhat.com/en/documentation/openshift_container_platform/4.2/html/monitoring/cluster-monitoring#monitoring-accessing-prometheus-alerting-ui-grafana-using-the-web-console_accessing-prometheus
thomasvn marked this conversation as resolved.
Show resolved Hide resolved
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-monitoring-view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ .Values.global.platforms.openshift.monitoringServiceAccountName | quote }}
namespace: openshift-monitoring
namespace: {{ .Values.global.platforms.openshift.monitoringServiceAccountNamespace | quote }}
roleRef:
kind: Role
name: {{ template "cost-analyzer.fullname" . }}-reader
Expand Down
54 changes: 54 additions & 0 deletions cost-analyzer/values-openshift-cluster-prometheus.yaml
thomasvn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This helm values file is a modified version of the values-openshift.yaml file that is used to deploy Kubecost on OpenShift.
# The main difference is that the values-openshift-cluster-prometheus.yaml file is configured to connect to the in-cluster Prometheus instance running on the OpenShift cluster and not use bundled prometheus.
thomasvn marked this conversation as resolved.
Show resolved Hide resolved

global:
prometheus:
enabled: false # Kubecost depends on Prometheus data, it is not optional. When enabled: false, Prometheus will not be installed and you must configure your own Prometheus to scrape kubecost as well as provide the fqdn below. -- Warning: Before changing this setting, please read to understand the risks https://docs.kubecost.com/install-and-configure/install/custom-prom
fqdn: https://prometheus-k8s.openshift-monitoring.svc.cluster.local:9091 # example address of a Prometheus to connect to. Include protocol (http:// or https://) Ignored if enabled: true
insecureSkipVerify: false # If true, kubecost will not check the TLS cert of prometheus
# queryServiceBearerTokenSecretName: mcdbsecret # kubectl create secret generic mcdbsecret -n kubecost --from-file=TOKEN
kubeRBACProxy: true # If true, kubecost will use kube-rbac-proxy to authenticate with in cluster Prometheus for openshift
grafana:
enabled: false # If false, Grafana will not be installed
domainName: grafana.grafana
proxy: false
# 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: true # Create a ClusterRoleBinding to allow using in-cluster Prometheus or Thanos.
createMonitoringResourceReaderRoleBinding: true # 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.
monitoringServiceAccountNamespace: openshift-monitoring # Namespace of the service account to bind to the Resource Reader Role Binding.
route:
enabled: false # Create an OpenShift Route.
annotations: {} # Add annotations to the Route.
# host: kubecost.apps.okd4.example.com # Add a custom host for your Route.
# Create Security Context Constraint resources for the DaemonSets requiring additional privileges.
scc:
nodeExporter: false # Creates an SCC for Prometheus Node Exporter. This requires Node Exporter be enabled.
networkCosts: false # Creates an SCC for Kubecost network-costs. This requires network-costs be enabled.
# When OpenShift is enabled, the following securityContext will be applied to all resources unless they define their own.
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault

# networkCosts:
# enabled: false # Enable network costs.
# prometheus:
# nodeExporter:
# enabled: true # Enable Prometheus Node Exporter.
serviceMonitor:
enabled: true
# additionalLabels:
# label-key: label-value
# networkCosts:
# enabled: false
# additionalLabels:
# label-key: label-value
prometheusRule:
enabled: true
# additionalLabels:
# label-key: label-value
9 changes: 5 additions & 4 deletions cost-analyzer/values-openshift.yaml
thomasvn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
global:
prometheus:
enabled: true # Kubecost depends on Prometheus data, it is not optional. When enabled: false, Prometheus will not be installed and you must configure your own Prometheus to scrape kubecost as well as provide the fqdn below. -- Warning: Before changing this setting, please read to understand the risks https://docs.kubecost.com/install-and-configure/install/custom-prom
fqdn: https://prometheus-k8s.openshift-monitoring.svc.cluster.local:9091 # example address of a prometheus to connect to. Include protocol (http:// or https://) Ignored if enabled: true
fqdn: https://prometheus-k8s.openshift-monitoring.svc.cluster.local:9091 # example address of a Prometheus to connect to. Include protocol (http:// or https://) Ignored if enabled: true
# insecureSkipVerify: false # If true, kubecost will not check the TLS cert of prometheus
# queryServiceBearerTokenSecretName: mcdbsecret # kubectl create secret generic mcdbsecret -n kubecost --from-file=TOKEN
# kubeRBACProxy: false # If true, kubecost will use kube-rbac-proxy to authenticate with in cluster Prometheus for openshift
Expand All @@ -11,9 +11,10 @@ global:
# 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.
# createMonitoringClusterRoleBinding: false # Create a ClusterRoleBinding 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.
# monitoringServiceAccountNamespace: openshift-monitoring # Namespace of the service account to bind to the Resource Reader Role Binding.
route:
enabled: false # Create an OpenShift Route.
annotations: {} # Add annotations to the Route.
Expand All @@ -32,4 +33,4 @@ global:
# enabled: true # Enable network costs.
# prometheus:
# nodeExporter:
# enabled: true # Enable Prometheus Node Exporter.
# enabled: true # Enable Prometheus Node Exporter.