Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
paas-tools
okd4-deployment
cluster-ingress-operator
Commits
285df816
Unverified
Commit
285df816
authored
May 12, 2021
by
OpenShift Merge Robot
Committed by
GitHub
May 12, 2021
Browse files
Merge pull request #611 from sgreene570/bz-1954330
Bug 1954330: ingress: Fix up openshift-ingress namespace reconciliation
parents
b7f990e5
0faf81ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
pkg/operator/controller/ingress/namespace.go
View file @
285df816
...
...
@@ -86,7 +86,7 @@ func routerNamespaceChanged(current, expected *corev1.Namespace) (bool, *corev1.
}
knownLabels
:=
[]
string
{
"opensift.io/cluster-monitoring"
,
"opens
h
ift.io/cluster-monitoring"
,
"name"
,
"network.openshift.io/policy-group"
,
"policy-group.network.openshift.io/ingress"
,
...
...
@@ -104,14 +104,14 @@ func routerNamespaceChanged(current, expected *corev1.Namespace) (bool, *corev1.
}
for
_
,
annotation
:=
range
knownAnnotations
{
if
current
.
Annotations
[
annotation
]
!=
expected
.
Annotations
[
annotation
]
{
if
val
,
ok
:=
current
.
Annotations
[
annotation
]
;
!
ok
||
val
!=
expected
.
Annotations
[
annotation
]
{
updated
.
Annotations
[
annotation
]
=
expected
.
Annotations
[
annotation
]
changed
=
true
}
}
for
_
,
label
:=
range
knownLabels
{
if
current
.
Labels
[
label
]
!=
expected
.
Labels
[
label
]
{
if
val
,
ok
:=
current
.
Labels
[
label
]
;
!
ok
||
val
!=
expected
.
Labels
[
label
]
{
updated
.
Labels
[
label
]
=
expected
.
Labels
[
label
]
changed
=
true
}
...
...
pkg/operator/controller/ingress/namespace_test.go
View file @
285df816
...
...
@@ -41,16 +41,23 @@ func TestRouterNamespaceChanged(t *testing.T) {
},
expect
:
false
,
},
{
description
:
"if a managed label with an empty string value is deleted"
,
mutate
:
func
(
ns
*
corev1
.
Namespace
)
{
delete
(
ns
.
Labels
,
"policy-group.network.openshift.io/ingress"
)
},
expect
:
true
,
},
}
for
_
,
tc
:=
range
testCases
{
original
:=
manifests
.
RouterNamespace
()
mutated
:=
original
.
DeepCopy
()
desired
:=
manifests
.
RouterNamespace
()
mutated
:=
desired
.
DeepCopy
()
tc
.
mutate
(
mutated
)
if
changed
,
updated
:=
routerNamespaceChanged
(
original
,
mutat
ed
);
changed
!=
tc
.
expect
{
if
changed
,
updated
:=
routerNamespaceChanged
(
mutated
,
desir
ed
);
changed
!=
tc
.
expect
{
t
.
Errorf
(
"%s, expect routerNamespaceChanged to be %t, got %t"
,
tc
.
description
,
tc
.
expect
,
changed
)
}
else
if
changed
{
if
changedAgain
,
_
:=
routerNamespaceChanged
(
mutat
ed
,
updated
);
changedAgain
{
if
changedAgain
,
_
:=
routerNamespaceChanged
(
desir
ed
,
updated
);
changedAgain
{
t
.
Errorf
(
"%s, routerNamespaceChanged does not behave as a fixed point function"
,
tc
.
description
)
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment