Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Brachwitz <peter.brachwitz@gmail.com>
  • Loading branch information
robbavey and pebrc committed Feb 2, 2024
1 parent 1fa362a commit fbed4df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/common/volume/pvc_expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func HandleVolumeExpansion(
}

// resize all PVCs that can be resized
err := ResizePVCs(ctx, k8sClient, owner, expectedSset, actualSset)
err := resizePVCs(ctx, k8sClient, owner, expectedSset, actualSset)
if err != nil {
return false, err
}
Expand All @@ -69,7 +69,7 @@ func HandleVolumeExpansion(
// ResizePVCs updates the spec of all existing PVCs whose storage requests can be expanded,
// according to their storage class and what's specified in the expected claim.
// It returns an error if the requested storage size is incompatible with the PVC.
func ResizePVCs(
func resizePVCs(
ctx context.Context,
k8sClient k8s.Client,
owner client.Object,
Expand Down Expand Up @@ -239,7 +239,7 @@ func deleteStatefulSet(ctx context.Context, k8sClient k8s.Client, sset appsv1.St
// ensure Pods are not also deleted
orphanPolicy := metav1.DeletePropagationOrphan
opts.PropagationPolicy = &orphanPolicy
ulog.FromContext(ctx).V(1).Info("Deleting stateful set", "name", sset.Name)
ulog.FromContext(ctx).V(1).Info("Deleting stateful set", "statefulset_name", sset.Name, "namespace", sset.Namespace)

return k8sClient.Delete(ctx, &sset, &opts)
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/logstash/logstash_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
)

var (
truePtr = true
sampleStorageClass = storagev1.StorageClass{
ObjectMeta: metav1.ObjectMeta{Name: "fixed"},
}
Expand All @@ -47,7 +46,7 @@ var (
}
resizableStorageClass = storagev1.StorageClass{
ObjectMeta: metav1.ObjectMeta{Name: "resizable"},
AllowVolumeExpansion: &truePtr,
AllowVolumeExpansion: ptr.To(true),
}
)

Expand Down Expand Up @@ -694,7 +693,7 @@ func TestReconcileLogstash_Resize(t *testing.T) {
ss := appsv1.StatefulSet{}
require.Error(t, r.Client.Get(ctx, ssNamespacedName, &ss))

// Third pass of the reconciler should recreates the StatefulSet
// Third pass of the reconciler should recreate the StatefulSet
result, err = r.Reconcile(ctx, request)

require.NoError(t, err)
Expand Down

0 comments on commit fbed4df

Please sign in to comment.