Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update remaining resource ingress.class behaviors #815

Merged
merged 8 commits into from
Aug 31, 2020
Merged
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
10 changes: 5 additions & 5 deletions internal/ingress/annotations/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const (
)

const (
ingressClassKey = "kubernetes.io/ingress.class"
IngressClassKey = "kubernetes.io/ingress.class"

deprecatedAnnotationPrefix = "configuration.konghq.com"
annotationPrefix = "konghq.com"

deprecatedPluginsKey = "plugins.konghq.com"
DeprecatedPluginsKey = "plugins.konghq.com"
deprecatedConfigurationKey = deprecatedAnnotationPrefix

configurationKey = "/override"
Expand Down Expand Up @@ -80,7 +80,7 @@ func IngressClassValidatorFunc(
ingressClass string) func(obj metav1.Object, handling ClassMatching) bool {

return func(obj metav1.Object, handling ClassMatching) bool {
ingress := obj.GetAnnotations()[ingressClassKey]
ingress := obj.GetAnnotations()[IngressClassKey]
return validIngress(ingress, ingressClass, handling)
}
}
Expand All @@ -91,7 +91,7 @@ func IngressClassValidatorFuncFromObjectMeta(
ingressClass string) func(obj *metav1.ObjectMeta, handling ClassMatching) bool {

return func(obj *metav1.ObjectMeta, handling ClassMatching) bool {
ingress := obj.GetAnnotations()[ingressClassKey]
ingress := obj.GetAnnotations()[IngressClassKey]
return validIngress(ingress, ingressClass, handling)
}
}
Expand All @@ -114,7 +114,7 @@ func pluginsFromAnnotations(anns map[string]string) (string, bool) {
if exists {
return value, exists
}
value, exists = anns[deprecatedPluginsKey]
value, exists = anns[DeprecatedPluginsKey]
return value, exists
}

Expand Down
6 changes: 3 additions & 3 deletions internal/ingress/annotations/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestIngressClassValidatorFunc(t *testing.T) {
data := map[string]string{}
ing.SetAnnotations(data)
for _, test := range tests {
ing.Annotations[ingressClassKey] = test.ingress
ing.Annotations[IngressClassKey] = test.ingress
f := IngressClassValidatorFunc(test.controller)

result := f(&ing.ObjectMeta, test.classMatching)
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestExtractKongPluginsFromAnnotations(t *testing.T) {
name: "legacy annotation",
args: args{
anns: map[string]string{
"plugins.konghq.com": "kp-rl, kp-cors",
DeprecatedPluginsKey: "kp-rl, kp-cors",
},
},
want: []string{"kp-rl", "kp-cors"},
Expand All @@ -208,7 +208,7 @@ func TestExtractKongPluginsFromAnnotations(t *testing.T) {
name: "annotation prioriy",
args: args{
anns: map[string]string{
"plugins.konghq.com": "a,b",
DeprecatedPluginsKey: "a,b",
"konghq.com/plugins": "kp-rl, kp-cors",
},
},
Expand Down
Loading