Skip to content

Commit bf56d56

Browse files
committed
Merge remote-tracking branch 'jgoelen/main' into test/#11680-e2e-test
2 parents 1d3b302 + 6cfd223 commit bf56d56

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

internal/ingress/annotations/customheaders/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package customheaders
1818

1919
import (
2020
"fmt"
21+
"reflect"
2122
"regexp"
2223

2324
"k8s.io/klog/v2"
@@ -35,6 +36,18 @@ type Config struct {
3536
Headers map[string]string `json:"headers,omitempty"`
3637
}
3738

39+
// Equal tests for equality between two Config types
40+
func (c1 *Config) Equal(c2 *Config) bool {
41+
if c1 == c2 {
42+
return true
43+
}
44+
if c1 == nil || c2 == nil {
45+
return false
46+
}
47+
48+
return reflect.DeepEqual(c1.Headers, c2.Headers)
49+
}
50+
3851
var (
3952
headerRegexp = regexp.MustCompile(`^[a-zA-Z\d\-_]+$`)
4053
valueRegexp = regexp.MustCompile(`^[a-zA-Z\d_ :;.,\\/"'?!(){}\[\]@<>=\-+*#$&\x60|~^%]+$`)

pkg/apis/ingress/types_equals.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ func (l1 *Location) Equal(l2 *Location) bool {
467467
return false
468468
}
469469

470+
if !l1.CustomHeaders.Equal(&l2.CustomHeaders) {
471+
return false
472+
}
473+
470474
return true
471475
}
472476

test/manifests/configuration-a.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@
302302
"validationDepth": 0
303303
},
304304
"use-port-in-redirects": false,
305-
"configuration-snippet": ""
305+
"configuration-snippet": "",
306+
"customHeaders": {
307+
"headers": {
308+
"Server": "HAL9000"
309+
}
310+
}
306311
}]
307312
}, {
308313
"hostname": "dev.mycompany.com",

test/manifests/configuration-b.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@
302302
"validationDepth": 0
303303
},
304304
"use-port-in-redirects": false,
305-
"configuration-snippet": ""
305+
"configuration-snippet": "",
306+
"customHeaders": {
307+
"headers": {
308+
"Server": "HAL9000"
309+
}
310+
}
306311
}]
307312
}, {
308313
"hostname": "dev.mycompany.com",

0 commit comments

Comments
 (0)