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

add seperate openshift block to handle openshift related configurations #245

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion charts/opencost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords:
- finops
- monitoring
- opencost
version: 1.43.0
version: 1.43.1
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
2 changes: 1 addition & 1 deletion charts/opencost/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ subjects:
namespace: {{ include "opencost.namespace" . }}
---
{{- end }}
{{- if .Values.opencost.prometheus.createMonitoringClusterRoleBinding }}
{{- if and .Values.opencost.platforms.openshift.enabled .Values.opencost.platforms.openshift.createMonitoringClusterRoleBinding }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand Down
11 changes: 10 additions & 1 deletion charts/opencost/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,13 @@ spec:
{{- with .Values.opencost.ui.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- with .Values.opencost.ui.extraVolumeMounts }}
volumeMounts: {{- toYaml . | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.opencost.platforms.openshift.enabled }}
- name: empty-var-www
mountPath: /var/www
{{- end }}
{{- end }}
{{- with .Values.opencost.extraContainers }}
Expand Down Expand Up @@ -389,6 +394,10 @@ spec:
- key: cloud-integration.json
path: cloud-integration.json
{{- end }}
{{- if .Values.opencost.platforms.openshift.enabled }}
- name: empty-var-www
emptyDir: {}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- if (.Values.opencost.prometheus.createMonitoringResourceReaderRoleBinding) }}
{{- if and .Values.opencost.platforms.openshift.enabled .Values.opencost.platforms.openshift.createMonitoringResourceReaderRoleBinding }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: {{ include "opencost.namespace" . }}
name: {{ include "opencost.fullname" . }}-reader
subjects:
- kind: ServiceAccount
name: {{ .Values.opencost.prometheus.monitoringServiceAccountName | quote }}
namespace: {{ .Values.opencost.prometheus.monitoringServiceAccountNamespace | quote }}
name: {{ .Values.opencost.platforms.openshift.monitoringServiceAccountName | quote }}
namespace: {{ .Values.opencost.platforms.openshift.monitoringServiceAccountNamespace | quote }}
roleRef:
kind: Role
name: {{ include "opencost.fullname" . }}-reader
Expand Down
2 changes: 1 addition & 1 deletion charts/opencost/templates/monitoring-role-template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if (.Values.opencost.prometheus.createMonitoringResourceReaderRoleBinding) }}
{{- if and .Values.opencost.platforms.openshift.enabled .Values.opencost.platforms.openshift.createMonitoringResourceReaderRoleBinding }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand Down
23 changes: 14 additions & 9 deletions charts/opencost/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,6 @@ opencost:
bearer_token_key: DB_BEARER_TOKEN
# -- If true, opencost will use kube-rbac-proxy to authenticate with in cluster Prometheus for openshift
kubeRBACProxy: false
# OPTIONAL. The following configs only to be enabled when using a Prometheus instance already installed in the cluster.
# -- If true, the helm chart will create a ClusterRoleBinding to grant the OpenCost ServiceAccount access to query Prometheus.
createMonitoringClusterRoleBinding: false
# -- If true, create a Role and RoleBinding to allow Prometheus to list and watch OpenCost resources.
createMonitoringResourceReaderRoleBinding: false
# -- Name of the Prometheus serviceaccount to bind to the Resource Reader Role Binding.
monitoringServiceAccountName: prometheus-k8s
# -- Namespace of the Prometheus serviceaccount to bind to the Resource Reader Role Binding.
monitoringServiceAccountNamespace: openshift-monitoring
external:
# -- Use external Prometheus (eg. Grafana Cloud)
enabled: false
Expand Down Expand Up @@ -519,5 +510,19 @@ opencost:
# protocol: TCP
# resources: {}

platforms:
openshift:
# -- Enable OpenShift specific configurations
enabled: false
# OPTIONAL. The following configs only to be enabled when using a Prometheus instance already installed in the cluster.
# -- If true, the helm chart will create a ClusterRoleBinding to grant the OpenCost ServiceAccount access to query Prometheus.
createMonitoringClusterRoleBinding: false
# -- If true, create a Role and RoleBinding to allow Prometheus to list and watch OpenCost resources.
createMonitoringResourceReaderRoleBinding: false
# -- Name of the Prometheus serviceaccount to bind to the Resource Reader Role Binding.
monitoringServiceAccountName: prometheus-k8s
# -- Namespace of the Prometheus serviceaccount to bind to the Resource Reader Role Binding.
monitoringServiceAccountNamespace: openshift-monitoring

# -- A list of volumes to be added to the pod
extraVolumes: []
Loading