Skip to content

Commit

Permalink
add support for oauth-proxy sidecar (#84)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Ray <[email protected]>
Co-authored-by: Matt Ray <[email protected]>
  • Loading branch information
TheRealNoob and mattray authored Oct 19, 2023
1 parent fc1efeb commit 9e8288e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 6 deletions.
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:
- kubecost
- opencost
- monitoring
version: 1.21.1
version: 1.21.2
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
3 changes: 3 additions & 0 deletions charts/opencost/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ spec:
volumeMounts: {{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.opencost.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.opencost.exporter.persistence.enabled .Values.extraVolumes .Values.opencost.customPricing.enabled}}
volumes:
{{- if .Values.opencost.customPricing.enabled }}
Expand Down
8 changes: 4 additions & 4 deletions charts/opencost/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
service:
name: {{ include "opencost.fullname" $ }}
port:
name: http-ui
{{- end }}
{{- end }}
{{- end }}
name: {{ $.Values.opencost.ui.ingress.servicePort }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 4 additions & 1 deletion charts/opencost/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ spec:
port: 9090
targetPort: 9090
{{- end }}
{{- end }}
{{- with .Values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/opencost/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ spec:
{{- with .Values.opencost.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.opencost.metrics.serviceMonitor.extraEndpoints }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "opencost.selectorLabels" . | nindent 6 }}
namespaceSelector:
Expand Down
34 changes: 34 additions & 0 deletions charts/opencost/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ service:
labels: {}
# -- Kubernetes Service type
type: ClusterIP
# -- extra ports. Useful for sidecar pods such as oauth-proxy
extraPorts: []
# - name: oauth-proxy
# port: 8081
# targetPort: 8081
# - name: oauth-metrics
# port: 8082
# targetPort: 8082

# Create cluster role policies
rbac:
Expand Down Expand Up @@ -171,6 +179,10 @@ opencost:
relabelings: []
# -- MetricRelabelConfigs to apply to samples before ingestion
metricRelabelings: []
# -- extra Endpoints to add to the ServiceMonitor. Useful for scraping sidecars
extraEndpoints: []
# - port: oauth-metrics
# path: /metrics

prometheus:
# -- Secret name that contains credentials for Prometheus
Expand Down Expand Up @@ -281,11 +293,15 @@ opencost:
- host: example.local
paths:
- /
# -- Redirect ingress to an extraPort defined on the service such as oauth-proxy
servicePort: http-ui
# servicePort: oauth-proxy
# -- Ingress TLS configuration
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

# -- Toleration labels for pod assignment
tolerations: []
# -- Node labels for pod assignment
Expand All @@ -295,5 +311,23 @@ opencost:
# -- Assign custom TopologySpreadConstraints rules
topologySpreadConstraints: []

# -- extra sidecars to add to the pod. Useful for things like oauth-proxy for the UI
extraContainers: []
# - name: oauth-proxy
# image: quay.io/oauth2-proxy/oauth2-proxy:v7.4.0
# args:
# - --upstream=http://127.0.0.1:9090
# - --http-address=0.0.0.0:8081
# - --metrics-address=0.0.0.0:8082
# - ...
# ports:
# - name: oauth-proxy
# containerPort: 8081
# protocol: TCP
# - name: oauth-metrics
# containerPort: 8082
# protocol: TCP
# resources: {}

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

0 comments on commit 9e8288e

Please sign in to comment.