mirror of
				https://github.com/prometheus-operator/kube-prometheus.git
				synced 2025-11-04 10:01:03 +01:00 
			
		
		
		
	Support utf8 in external file alertmanager config
This could have been achieved either by switching to stringData, or doing `std.base64(std.encodeUTF8($._config.alertmanager.config))` as per google/jsonnet#575 I went with the former, because it's: 1. Easier to read existing config 2. Consistent with the way jsonnet object-based config is written just above
This commit is contained in:
		
							parent
							
								
									4f872f1e31
								
							
						
					
					
						commit
						28b717a984
					
				@ -1,6 +1,7 @@
 | 
				
			|||||||
# external alertmanager yaml
 | 
					# external alertmanager yaml
 | 
				
			||||||
global:
 | 
					global:
 | 
				
			||||||
  resolve_timeout: 10m
 | 
					  resolve_timeout: 10m
 | 
				
			||||||
 | 
					  slack_api_url: url
 | 
				
			||||||
route:
 | 
					route:
 | 
				
			||||||
  group_by: ['job']
 | 
					  group_by: ['job']
 | 
				
			||||||
  group_wait: 30s
 | 
					  group_wait: 30s
 | 
				
			||||||
@ -13,3 +14,17 @@ route:
 | 
				
			|||||||
    receiver: 'null'
 | 
					    receiver: 'null'
 | 
				
			||||||
receivers:
 | 
					receivers:
 | 
				
			||||||
- name: 'null'
 | 
					- name: 'null'
 | 
				
			||||||
 | 
					- name: slack
 | 
				
			||||||
 | 
					slack_configs:
 | 
				
			||||||
 | 
					- channel: '#alertmanager-testing'
 | 
				
			||||||
 | 
					  send_resolved: true
 | 
				
			||||||
 | 
					  title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
 | 
				
			||||||
 | 
					  text: |-
 | 
				
			||||||
 | 
					    {{ range .Alerts }}
 | 
				
			||||||
 | 
					      *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
 | 
				
			||||||
 | 
					      *Description:* {{ .Annotations.description }}
 | 
				
			||||||
 | 
					      *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
 | 
				
			||||||
 | 
					      *Details:*
 | 
				
			||||||
 | 
					      {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
 | 
				
			||||||
 | 
					      {{ end }}
 | 
				
			||||||
 | 
					    {{ end }}
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
 | 
				
			|||||||
        .withStringData({ 'alertmanager.yaml': std.manifestYamlDoc($._config.alertmanager.config) }) +
 | 
					        .withStringData({ 'alertmanager.yaml': std.manifestYamlDoc($._config.alertmanager.config) }) +
 | 
				
			||||||
        secret.mixin.metadata.withNamespace($._config.namespace)
 | 
					        secret.mixin.metadata.withNamespace($._config.namespace)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        secret.new('alertmanager-' + $._config.alertmanager.name, { 'alertmanager.yaml': std.base64($._config.alertmanager.config) }) +
 | 
					        secret.new('alertmanager-' + $._config.alertmanager.name, {})
 | 
				
			||||||
 | 
					        .withStringData({ 'alertmanager.yaml': $._config.alertmanager.config }) +
 | 
				
			||||||
        secret.mixin.metadata.withNamespace($._config.namespace),
 | 
					        secret.mixin.metadata.withNamespace($._config.namespace),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    serviceAccount:
 | 
					    serviceAccount:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user