Skip to content

Commit

Permalink
fix: use non-caching client to get pod in getPodPrivateIP also in E…
Browse files Browse the repository at this point in the history
…IP controller
  • Loading branch information
alfredkrohmer committed Aug 19, 2024
1 parent 8c10c8c commit d9a591f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/eip_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (r *EIPReconciler) releaseEIP(ctx context.Context, eip *awsv1alpha1.EIP, lo

func (r *EIPReconciler) getPodPrivateIP(ctx context.Context, namespace, podName string) (string, error) {
pod := &corev1.Pod{}
if err := r.Client.Get(ctx, client.ObjectKey{
if err := r.NonCachingClient.Get(ctx, client.ObjectKey{
Namespace: namespace,
Name: podName,
}, pod); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ func main() {
}

err = (&controllers.EIPReconciler{
Client: cachingClient,
Log: ctrl.Log.WithName("controllers").WithName("EIP"),
EC2: ec2,
Client: cachingClient,
NonCachingClient: nonCachingClient,
Log: ctrl.Log.WithName("controllers").WithName("EIP"),
EC2: ec2,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "EIP")
Expand Down

0 comments on commit d9a591f

Please sign in to comment.