Skip to content

Commit 6cbc0fa

Browse files
authored
fix: Ingress annotations not reconciling (#773)
Signed-off-by: Yosiah de Koeyer <[email protected]>
1 parent 4b76e47 commit 6cbc0fa

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

internal/controller/core/flagd/resources/ingress.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
api "github.com/open-feature/open-feature-operator/apis/core/v1beta1"
88
"github.com/open-feature/open-feature-operator/internal/common"
9-
"github.com/open-feature/open-feature-operator/internal/controller/core/flagd/common"
9+
resources "github.com/open-feature/open-feature-operator/internal/controller/core/flagd/common"
1010
networkingv1 "k8s.io/api/networking/v1"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -27,7 +27,7 @@ func (r FlagdIngress) AreObjectsEqual(o1 client.Object, o2 client.Object) bool {
2727
return false
2828
}
2929

30-
return reflect.DeepEqual(oldIngress.Spec, newIngress.Spec)
30+
return reflect.DeepEqual(oldIngress.Spec, newIngress.Spec) && reflect.DeepEqual(oldIngress.Annotations, newIngress.Annotations)
3131
}
3232

3333
func (r FlagdIngress) GetResource(_ context.Context, flagd *api.Flagd) (client.Object, error) {

internal/controller/core/flagd/resources/ingress_test.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ func TestFlagdIngress_getIngress(t *testing.T) {
164164
},
165165
},
166166
}, ingressResult.(*networkingv1.Ingress).Spec)
167-
168167
}
169168

170169
func strPtr(s string) *string {
@@ -182,7 +181,7 @@ func Test_areIngressesEqual(t *testing.T) {
182181
want bool
183182
}{
184183
{
185-
name: "has changed",
184+
name: "has spec changes",
186185
args: args{
187186
old: &networkingv1.Ingress{
188187
Spec: networkingv1.IngressSpec{
@@ -197,6 +196,27 @@ func Test_areIngressesEqual(t *testing.T) {
197196
},
198197
want: false,
199198
},
199+
{
200+
name: "has annotation changes",
201+
args: args{
202+
old: &networkingv1.Ingress{
203+
ObjectMeta: metav1.ObjectMeta{
204+
Annotations: map[string]string{
205+
"foo": "bar",
206+
},
207+
},
208+
Spec: networkingv1.IngressSpec{
209+
IngressClassName: strPtr("nginx"),
210+
},
211+
},
212+
new: &networkingv1.Ingress{
213+
Spec: networkingv1.IngressSpec{
214+
IngressClassName: strPtr("nginx"),
215+
},
216+
},
217+
},
218+
want: false,
219+
},
200220
{
201221
name: "has not changed",
202222
args: args{
@@ -240,7 +260,6 @@ func Test_areIngressesEqual(t *testing.T) {
240260
}
241261
for _, tt := range tests {
242262
t.Run(tt.name, func(t *testing.T) {
243-
244263
i := &FlagdIngress{}
245264
got := i.AreObjectsEqual(tt.args.old, tt.args.new)
246265

0 commit comments

Comments
 (0)