Skip to content

Commit

Permalink
Fix accidental ignition
Browse files Browse the repository at this point in the history
  • Loading branch information
tnozicka committed Nov 28, 2024
1 parent b0ebdda commit d9caa3b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/scylladbdatacenter/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ wait
},
},
{
Name: "scylladb-ignition",
Name: naming.ScyllaDBIgnitionContainerName,
Image: sidecarImage,
ImagePullPolicy: corev1.PullIfNotPresent,
Command: []string{
Expand Down
11 changes: 6 additions & 5 deletions pkg/naming/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ const (

// Configuration Values
const (
ScyllaContainerName = "scylla"
SidecarInjectorContainerName = "sidecar-injection"
PerftuneContainerName = "perftune"
CleanupContainerName = "cleanup"
RLimitsContainerName = "rlimits"
ScyllaContainerName = "scylla"
SidecarInjectorContainerName = "sidecar-injection"
ScyllaDBIgnitionContainerName = "scylladb-ignition"
PerftuneContainerName = "perftune"
CleanupContainerName = "cleanup"
RLimitsContainerName = "rlimits"

PVCTemplateName = "data"

Expand Down
21 changes: 21 additions & 0 deletions test/e2e/set/nodeconfig/nodeconfig_optimizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ var _ = g.Describe("NodeConfig Optimizations", framework.Serial, func() {
o.Expect(err).NotTo(o.HaveOccurred())

sc := f.GetDefaultScyllaCluster()
o.Expect(sc.Spec.Datacenter.Racks).To(o.HaveLen(1))
sc.Spec.Datacenter.Racks[0].AgentResources = corev1.ResourceRequirements{
Requests: map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse("50m"),
Expand Down Expand Up @@ -320,6 +321,7 @@ var _ = g.Describe("NodeConfig Optimizations", framework.Serial, func() {
o.Expect(src.MatchingNodeConfigs).NotTo(o.BeEmpty())

waitTime := utils.RolloutTimeoutForScyllaCluster(sc)
waitTime = 30 * time.Second
framework.By("Sleeping for %v", waitTime)
time.Sleep(waitTime)

Expand All @@ -328,6 +330,25 @@ var _ = g.Describe("NodeConfig Optimizations", framework.Serial, func() {
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(utils.IsScyllaClusterRolledOut(sc)).To(o.BeFalse())

framework.By("Verifying the containers are blocked and not ready")
podSelector := labels.Set(naming.ClusterLabelsForScyllaCluster(sc)).AsSelector()
scPods, err := f.KubeClient().CoreV1().Pods(sc.Namespace).List(ctx, metav1.ListOptions{
LabelSelector: podSelector.String(),
})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(scPods.Items).NotTo(o.BeEmpty())

for _, pod := range scPods.Items {
crm := utils.GetContainerReadinessMap(&pod)
o.Expect(crm).To(
o.And(
o.HaveKeyWithValue(naming.ScyllaContainerName, false),
o.HaveKeyWithValue(naming.ScyllaDBIgnitionContainerName, false),
),
fmt.Sprintf("container in Pod %q don't match the expected state", pod.Name),
)
}

framework.By("Unblocking tuning")
intermittentArtifactsDir := ""
if len(f.GetDefaultArtifactsDir()) != 0 {
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/utils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,3 +766,19 @@ func WaitForScyllaOperatorConfigStatus(ctx context.Context, client scyllav1alpha
func IsScyllaClusterRegisteredWithManager(sc *scyllav1.ScyllaCluster) (bool, error) {
return sc.Status.ManagerID != nil && len(*sc.Status.ManagerID) > 0, nil
}

func GetContainerReadinessMap(pod *corev1.Pod) map[string]bool {
res := map[string]bool{}

for _, statusSet := range [][]corev1.ContainerStatus{
pod.Status.InitContainerStatuses,
pod.Status.ContainerStatuses,
pod.Status.EphemeralContainerStatuses,
} {
for _, cs := range statusSet {
res[cs.Name] = cs.Ready
}
}

return res
}

0 comments on commit d9caa3b

Please sign in to comment.