Skip to content

Commit

Permalink
Add resourceapply helpers for PersistentVolumeClaims
Browse files Browse the repository at this point in the history
  • Loading branch information
rzetelskik committed Jul 4, 2024
1 parent 2f86251 commit 3fda52e
Show file tree
Hide file tree
Showing 2 changed files with 580 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 @@ -243,3 +243,35 @@ func ApplyPod(
options,
)
}

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

func ApplyPersistentVolumeClaim(
ctx context.Context,
client corev1client.PersistentVolumeClaimsGetter,
lister corev1listers.PersistentVolumeClaimLister,
recorder record.EventRecorder,
required *corev1.PersistentVolumeClaim,
options ApplyOptions,
) (*corev1.PersistentVolumeClaim, bool, error) {
return ApplyPersistentVolumeClaimWithControl(
ctx,
ApplyControlFuncs[*corev1.PersistentVolumeClaim]{
GetCachedFunc: lister.PersistentVolumeClaims(required.Namespace).Get,
CreateFunc: client.PersistentVolumeClaims(required.Namespace).Create,
UpdateFunc: client.PersistentVolumeClaims(required.Namespace).Update,
DeleteFunc: client.PersistentVolumeClaims(required.Namespace).Delete,
},
recorder,
required,
options,
)
}
Loading

0 comments on commit 3fda52e

Please sign in to comment.