Skip to content

Commit 42aed19

Browse files
authored
Use Kubernetes Reader instead of full Client (#1093)
Replace client.Client with client.Reader to enforce read only access to k8s API. There is no actual modification expected as part of Pod listing and updating. Signed-off-by: Etai Lev Ran <[email protected]>
1 parent 3322cf8 commit 42aed19

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pkg/epp/controller/pod_reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
type PodReconciler struct {
38-
client.Client
38+
client.Reader
3939
Datastore datastore.Datastore
4040
Record record.EventRecorder
4141
}

pkg/epp/controller/pod_reconciler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func TestPodReconciler(t *testing.T) {
187187
store.PodUpdateOrAddIfNotExist(pod)
188188
}
189189

190-
podReconciler := &PodReconciler{Client: fakeClient, Datastore: store}
190+
podReconciler := &PodReconciler{Reader: fakeClient, Datastore: store}
191191
if test.req == nil {
192192
namespacedName := types.NamespacedName{Name: test.incomingPod.Name, Namespace: test.incomingPod.Namespace}
193193
test.req = &ctrl.Request{NamespacedName: namespacedName}

pkg/epp/server/runserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (r *ExtProcServerRunner) SetupWithManager(ctx context.Context, mgr ctrl.Man
110110

111111
if err := (&controller.PodReconciler{
112112
Datastore: r.Datastore,
113-
Client: mgr.GetClient(),
113+
Reader: mgr.GetClient(),
114114
Record: mgr.GetEventRecorderFor("pod"),
115115
}).SetupWithManager(mgr); err != nil {
116116
return fmt.Errorf("failed setting up PodReconciler: %v", err)

0 commit comments

Comments
 (0)