Skip to content

Commit

Permalink
renaming transformed logic for pod informer
Browse files Browse the repository at this point in the history
  • Loading branch information
waynepeking348 committed Mar 19, 2024
1 parent 3b8b019 commit 91a4393
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func NewHealthzController(ctx context.Context,
ec.nodeSelector, podIndexer, ec.nodeLister, ec.cnrLister, ec.healthzHelper)
}

native.WithPodTransformer(podTransformerFunc)
native.SetPodTransformer(podTransformerFunc)
return ec, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/spd/spd.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func NewSPDController(ctx context.Context, controlCtx *katalystbase.GenericConte
return nil, err
}

native.WithPodTransformer(podTransformerFunc)
native.SetPodTransformer(podTransformerFunc)
return spdController, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/native/informer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestPodTransformer(t *testing.T) {

as := require.New(t)

WithPodTransformer(func(src, dest *core.Pod) {
SetPodTransformer(func(src, dest *core.Pod) {
dest.Spec.NodeName = src.Spec.NodeName
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ type PodTransformerFunc func(src, dest *corev1.Pod)
var podTransformers []PodTransformerFunc
var podTransformerMtx sync.RWMutex

func WithPodTransformer(f PodTransformerFunc) {
func SetPodTransformer(f PodTransformerFunc) {
podTransformerMtx.Lock()
defer podTransformerMtx.Unlock()
podTransformers = append(podTransformers, f)
}

func GetPodTransformer() (cache.TransformFunc, bool) {
podTransformerMtx.RLock()
defer podTransformerMtx.RUnlock()
Expand Down

0 comments on commit 91a4393

Please sign in to comment.