Skip to content
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
1 change: 1 addition & 0 deletions assets/admission-webhook/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
- --web.key-file=/etc/tls/private/tls.key
- --web.tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- --web.tls-min-version=VersionTLS12
- --name-validation-scheme=utf8
image: ""
livenessProbe:
httpGet:
Expand Down
1 change: 1 addition & 0 deletions jsonnet/components/admission-webhook.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function(params)
args+: [
'--web.tls-cipher-suites=' + params.tlsCipherSuites,
'--web.tls-min-version=VersionTLS12',
'--name-validation-scheme=utf8',
],
livenessProbe: {
httpGet: {
Expand Down
42 changes: 42 additions & 0 deletions test/e2e/validatingwebhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ spec:
webhookConfigs:
- url: 'https://example.com'
`, framework.E2eTestLabel)

utf8PromRuleYaml = fmt.Sprintf(`---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: cluster.monitoring-utf8
labels:
%s
spec:
groups:
- name: cluster-nodes-äöü-ß
rules:
- record: cluster_node_cpu_usage_ñáéíóú
expr: 1
- alert: ClusterNodeDown_äöü_ß
expr: up == 0
labels:
severity: warning
cluster: "production-cluster-cé"
node: "worker-node-ñáéíóú"
annotations:
summary: "Cluster node down - UTF-8 characters"
description: "Node in cluster-cé is down with UTF-8 characters"
`, framework.E2eTestLabel)
)

func TestPrometheusRuleValidatingWebhook(t *testing.T) {
Expand Down Expand Up @@ -133,6 +157,24 @@ func TestPrometheusRuleValidatingWebhook(t *testing.T) {

}

func TestPrometheusRuleValidatingWebhookUTF8Names(t *testing.T) {
ctx := context.Background()

// Test PrometheusRule with UTF-8 names.
utf8PromRule := monitoringv1.PrometheusRule{}
err := yaml.Unmarshal([]byte(utf8PromRuleYaml), &utf8PromRule)
if err != nil {
t.Fatal("unable to unmarshal UTF-8 prometheus rule", err)
}

_, err = f.MonitoringClient.PrometheusRules(f.Ns).Create(ctx, &utf8PromRule, metav1.CreateOptions{})
if err != nil {
t.Fatalf("UTF-8 prometheus rule was rejected by validating webhook: %v", err)
}

f.MonitoringClient.PrometheusRules(f.Ns).Delete(ctx, utf8PromRule.Name, metav1.DeleteOptions{})
}

func TestAlertManagerConfigValidatingWebhook(t *testing.T) {
ctx := context.Background()

Expand Down