Skip to content

Commit

Permalink
Merge pull request #2002 from rzetelskik/pod-resourceapply
Browse files Browse the repository at this point in the history
Add resourceapply helpers for Pods
  • Loading branch information
scylla-operator-bot[bot] committed Jul 4, 2024
2 parents 16e9531 + 3d675a9 commit 2f86251
Show file tree
Hide file tree
Showing 2 changed files with 582 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pkg/resourceapply/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,35 @@ func ApplyEndpoints(
options,
)
}

func ApplyPodWithControl(
ctx context.Context,
control ApplyControlInterface[*corev1.Pod],
recorder record.EventRecorder,
required *corev1.Pod,
options ApplyOptions,
) (*corev1.Pod, bool, error) {
return ApplyGeneric[*corev1.Pod](ctx, control, recorder, required, options)
}

func ApplyPod(
ctx context.Context,
client corev1client.PodsGetter,
lister corev1listers.PodLister,
recorder record.EventRecorder,
required *corev1.Pod,
options ApplyOptions,
) (*corev1.Pod, bool, error) {
return ApplyPodWithControl(
ctx,
ApplyControlFuncs[*corev1.Pod]{
GetCachedFunc: lister.Pods(required.Namespace).Get,
CreateFunc: client.Pods(required.Namespace).Create,
UpdateFunc: client.Pods(required.Namespace).Update,
DeleteFunc: client.Pods(required.Namespace).Delete,
},
recorder,
required,
options,
)
}
Loading

0 comments on commit 2f86251

Please sign in to comment.