-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: stateful set persistent volume claim retention policy #5946
Changes from 1 commit
7619210
2f4fadd
32ad67a
352b027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,14 +41,15 @@ func TestStatefulSetReconcile(t *testing.T) { | |
g.Expect(err).To(BeNil()) | ||
|
||
type test struct { | ||
name string | ||
metaServer metav1.ObjectMeta | ||
metaServerConfig metav1.ObjectMeta | ||
podSpec *v1.PodSpec | ||
volumeClaimTemplates []mlopsv1alpha1.PersistentVolumeClaim | ||
scaling *mlopsv1alpha1.ScalingSpec | ||
existing *appsv1.StatefulSet | ||
expectedReconcileOp constants.ReconcileOperation | ||
name string | ||
metaServer metav1.ObjectMeta | ||
metaServerConfig metav1.ObjectMeta | ||
podSpec *v1.PodSpec | ||
volumeClaimTemplates []mlopsv1alpha1.PersistentVolumeClaim | ||
scaling *mlopsv1alpha1.ScalingSpec | ||
statefulSetPersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy | ||
existing *appsv1.StatefulSet | ||
expectedReconcileOp constants.ReconcileOperation | ||
} | ||
|
||
getIntPtr := func(i int32) *int32 { | ||
|
@@ -334,6 +335,7 @@ func TestStatefulSetReconcile(t *testing.T) { | |
test.podSpec, | ||
test.volumeClaimTemplates, | ||
test.scaling, | ||
test.statefulSetPersistentVolumeClaimRetentionPolicy, | ||
test.metaServerConfig, | ||
annotator) | ||
rop, err := r.getReconcileOperation() | ||
|
@@ -355,14 +357,15 @@ func TestToStatefulSet(t *testing.T) { | |
g := NewGomegaWithT(t) | ||
|
||
type test struct { | ||
name string | ||
meta metav1.ObjectMeta | ||
podSpec *v1.PodSpec | ||
labels map[string]string | ||
annotations map[string]string | ||
volumeClaimTemplates []mlopsv1alpha1.PersistentVolumeClaim | ||
scaling *mlopsv1alpha1.ScalingSpec | ||
statefulSet *appsv1.StatefulSet | ||
name string | ||
meta metav1.ObjectMeta | ||
podSpec *v1.PodSpec | ||
labels map[string]string | ||
annotations map[string]string | ||
volumeClaimTemplates []mlopsv1alpha1.PersistentVolumeClaim | ||
statefulSetPersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy | ||
scaling *mlopsv1alpha1.ScalingSpec | ||
statefulSet *appsv1.StatefulSet | ||
} | ||
|
||
getIntPtr := func(i int32) *int32 { | ||
|
@@ -463,7 +466,13 @@ func TestToStatefulSet(t *testing.T) { | |
|
||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
statefulSet := toStatefulSet(test.meta, test.podSpec, test.volumeClaimTemplates, test.scaling, test.labels, test.annotations) | ||
statefulSet := toStatefulSet(test.meta, | ||
test.podSpec, | ||
test.volumeClaimTemplates, | ||
test.scaling, | ||
test.statefulSetPersistentVolumeClaimRetentionPolicy, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While you're referencing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated a current test, to have PersistentVolumeClaimRetentionPolicy in it :) |
||
test.labels, | ||
test.annotations) | ||
g.Expect(equality.Semantic.DeepEqual(statefulSet, test.statefulSet)).To(BeTrue()) | ||
}) | ||
} | ||
|
@@ -523,6 +532,7 @@ func TestLabelsAnnotations(t *testing.T) { | |
&v1.PodSpec{}, | ||
[]mlopsv1alpha1.PersistentVolumeClaim{}, | ||
&mlopsv1alpha1.ScalingSpec{}, | ||
&appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy{}, | ||
test.metaServerConfig, | ||
annotator) | ||
for k, v := range test.expectedLabels { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion to rename this to volumeClaimRetentionPolicy. Mostly because in the future we might end up with more policies for different things, and to eliminate any confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this is update and renamed to
volumeClaimRetentionPolicy