Skip to content

Commit

Permalink
Resolved review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekdwivedi3060 committed Nov 23, 2023
1 parent d58bf24 commit 7ff7d90
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/v1/aerospikecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type AerospikeClusterSpec struct { //nolint:govet // for readability
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Seeds Finder Services"
SeedsFinderServices SeedsFinderServices `json:"seedsFinderServices,omitempty"`
// RosterNodeBlockList is a list of blocked nodeIDs from roster in a strong-consistency setup
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Roster NodeB lockList"
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Roster Node BlockList"
RosterNodeBlockList []string `json:"rosterNodeBlockList,omitempty"`
// IgnorePodList is the list of pods which are ignored by the operator while checking the cluster stability and
// are not considered part of cluster. This is only useful when there are some failed pods and operator is required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
while checking the cluster stability and are not considered part of cluster.
This is only useful when there are some failed pods and operator is required
to do some operation on the cluster. If pods in running state are defined
in this list, they are not ignored
in this list, they are not ignored.
displayName: Ignore Pod List
path: ignorePodList
- description: Aerospike server image
Expand All @@ -69,7 +69,7 @@ spec:
path: rackConfig
- description: RosterNodeBlockList is a list of blocked nodeIDs from roster
in a strong-consistency setup
displayName: Roster NodeB lockList
displayName: Roster Node BlockList
path: rosterNodeBlockList
- description: SeedsFinderServices creates additional Kubernetes service that
allow clients to discover Aerospike cluster nodes.
Expand Down
9 changes: 5 additions & 4 deletions controllers/aero_info_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ import (
// Aerospike helper
// ------------------------------------------------------------------------------------

// waitForMultipleNodesSafeStopReady waits util the input pods is safe to stop,
// skipping pods that are not running and present in ignorablePods for stability check.
// The ignorablePods list should be a list of failed or pending pods that are going to be
// deleted eventually and are safe to ignore in stability checks.
// waitForMultipleNodesSafeStopReady waits until the input pods are safe to stop,
// skipping pods that are not running and present in ignorablePodNames for stability check.
// The ignorablePodNames is the list of failed or pending pods that are either::
// 1. going to be deleted eventually and are safe to ignore in stability checks
// 2. given in ignorePodList by the user and are safe to ignore in stability checks
func (r *SingleClusterReconciler) waitForMultipleNodesSafeStopReady(
pods []*corev1.Pod, ignorablePodNames sets.Set[string],
) reconcileResult {
Expand Down
20 changes: 17 additions & 3 deletions test/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe(
// },
// )
Context(
"DeployClusterWithSyslog", func() {
"DeployClusterWithIgnorePodList", func() {
clusterWithIgnorePodList(ctx)
},
)
Expand Down Expand Up @@ -191,14 +191,14 @@ func clusterWithIgnorePodList(ctx goctx.Context) {
By("Upgrade version")
aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName)
Expect(err).ToNot(HaveOccurred())
aeroCluster.Spec.Image = baseImage + ":6.4.0.4"
newImage := baseImage + ":6.4.0.4"
aeroCluster.Spec.Image = newImage
err = updateCluster(k8sClient, ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())

By("Scale up")
aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName)
Expect(err).ToNot(HaveOccurred())
aeroCluster.Spec.IgnorePodList = []string{ignorePodName}
aeroCluster.Spec.Size++
err = updateCluster(k8sClient, ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -209,6 +209,20 @@ func clusterWithIgnorePodList(ctx goctx.Context) {
Expect(err).ToNot(HaveOccurred())
Expect(*pod.Status.ContainerStatuses[0].Started).To(BeFalse())
Expect(pod.Status.ContainerStatuses[0].Ready).To(BeFalse())

By("Remove pod from IgnorePodList and verify pod 2-0 is in running state")
aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName)
Expect(err).ToNot(HaveOccurred())
aeroCluster.Spec.IgnorePodList = []string{}
err = updateCluster(k8sClient, ctx, aeroCluster)
Expect(err).ToNot(HaveOccurred())

err = k8sClient.Get(ctx, types.NamespacedName{Name: ignorePodName,
Namespace: clusterNamespacedName.Namespace}, pod)
Expect(err).ToNot(HaveOccurred())
Expect(*pod.Status.ContainerStatuses[0].Started).To(BeTrue())
Expect(pod.Status.ContainerStatuses[0].Ready).To(BeTrue())
Expect(pod.Spec.Containers[0].Image).To(Equal(newImage))
},
)
},
Expand Down

0 comments on commit 7ff7d90

Please sign in to comment.