Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
allanhung authored Oct 16, 2023
2 parents e537bae + b142d03 commit 9977502
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 51.7.0
version: 51.8.0
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
17 changes: 17 additions & 0 deletions charts/kube-prometheus-stack/hack/sync_grafana_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def yaml_str_repr(struct, indent=2):
return text


def replace_nested_key(data, key, value, replace):
if isinstance(data, dict):
return {
k: replace if k == key and v == value else replace_nested_key(v, key, value, replace)
for k, v in data.items()
}
elif isinstance(data, list):
return [replace_nested_key(v, key, value, replace) for v in data]
else:
return data


def patch_dashboards_json(content, multicluster_key):
try:
content_struct = json.loads(content)
Expand All @@ -115,6 +127,11 @@ def patch_dashboards_json(content, multicluster_key):
variable['hide'] = ':multicluster:'
overwrite_list.append(variable)
content_struct['templating']['list'] = overwrite_list

# Replace decimals=-1 with decimals= (nil value)
# ref: https://github.com/kubernetes-monitoring/kubernetes-mixin/pull/859
content_struct = replace_nested_key(content_struct, "decimals", -1, None)

content = json.dumps(content_struct, separators=(',', ':'))
content = content.replace('":multicluster:"', '`}}{{ if %s }}0{{ else }}2{{ end }}{{`' % multicluster_key,)
except (ValueError, KeyError):
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion charts/prometheus-json-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.7.1
version: 0.7.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
3 changes: 3 additions & 0 deletions charts/prometheus-json-exporter/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "prometheus-json-exporter.labels" . | nindent 4 }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
7 changes: 7 additions & 0 deletions charts/prometheus-json-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ metadata:
name: {{ include "prometheus-json-exporter.fullname" . }}
labels:
{{- include "prometheus-json-exporter.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
13 changes: 8 additions & 5 deletions charts/prometheus-json-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Default values for prometheus-json-exporter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
Expand All @@ -18,18 +19,17 @@ serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: []
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: []
podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

# podLabels:
# Custom labels for the pod
podLabels: {}

securityContext: {}
# capabilities:
Expand All @@ -44,6 +44,8 @@ service:
port: 7979
targetPort: http
name: http
labels: {}
annotations: {}

serviceMonitor:
## If true, a ServiceMonitor CRD is created for a prometheus operator
Expand Down Expand Up @@ -73,7 +75,8 @@ serviceMonitor:
ingress:
enabled: false
className: ""
annotations: []
labels: {}
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
Expand Down

0 comments on commit 9977502

Please sign in to comment.