Skip to content

Commit 3b8bff8

Browse files
fix(operator): broken CiliumEndpoint garbage collection (#801)
# Description Retina Operator deletes endpoints when processing Pod delete events, but if for some reason an endpoint exists after its Pod was deleted, then endpoint GC comes into play. Endpoint GC was broken because it was failing to watch CiliumNodes. Fix by using a fake CiliumNodes resource. ## Related Issue Fixes #598 (logs and details there) ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Testing Completed Manual testing. Operator e2e's are WIP in another PR. Signed-off-by: Hunter Gregory <[email protected]>
1 parent d9575f8 commit 3b8bff8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package k8s
2+
3+
import (
4+
"context"
5+
6+
k8sRuntime "k8s.io/apimachinery/pkg/runtime"
7+
8+
"github.com/cilium/cilium/pkg/k8s/resource"
9+
)
10+
11+
type fakeresource[T k8sRuntime.Object] struct {
12+
}
13+
14+
func (f *fakeresource[T]) Events(ctx context.Context, opts ...resource.EventsOpt) <-chan resource.Event[T] {
15+
return make(<-chan resource.Event[T])
16+
}
17+
18+
func (f *fakeresource[T]) Store(ctx context.Context) (resource.Store[T], error) {
19+
return nil, nil
20+
}
21+
22+
func (f *fakeresource[T]) Observe(ctx context.Context, next func(resource.Event[T]), complete func(error)) {
23+
}

operator/cilium-crds/k8s/resources.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ var ResourcesCell = cell.Module(
3636
k8s.CiliumIdentityResource,
3737
CiliumEndpointResource,
3838
CiliumEndpointSliceResource,
39-
k8s.CiliumNodeResource,
39+
func() resource.Resource[*cilium_api_v2.CiliumNode] {
40+
return &fakeresource[*cilium_api_v2.CiliumNode]{}
41+
},
4042
k8s.PodResource,
4143
k8s.NamespaceResource,
4244
),

0 commit comments

Comments
 (0)