Skip to content

Commit 1e67530

Browse files
committed
Speed up NodeConfig optimization test
1 parent baaca48 commit 1e67530

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

pkg/controllerhelpers/wait.go

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
scyllav1client "github.com/scylladb/scylla-operator/pkg/client/scylla/clientset/versioned/typed/scylla/v1"
1212
scyllav1alpha1client "github.com/scylladb/scylla-operator/pkg/client/scylla/clientset/versioned/typed/scylla/v1alpha1"
1313
"github.com/scylladb/scylla-operator/pkg/helpers"
14+
appsv1 "k8s.io/api/apps/v1"
1415
corev1 "k8s.io/api/core/v1"
1516
rbacv1 "k8s.io/api/rbac/v1"
1617
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -19,6 +20,7 @@ import (
1920
"k8s.io/apimachinery/pkg/runtime"
2021
"k8s.io/apimachinery/pkg/util/wait"
2122
"k8s.io/apimachinery/pkg/watch"
23+
appsv1client "k8s.io/client-go/kubernetes/typed/apps/v1"
2224
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
2325
rbacv1client "k8s.io/client-go/kubernetes/typed/rbac/v1"
2426
"k8s.io/client-go/tools/cache"
@@ -182,3 +184,7 @@ func WaitForSecretState(ctx context.Context, client corev1client.SecretInterface
182184
func WaitForServiceState(ctx context.Context, client corev1client.ServiceInterface, name string, options WaitForStateOptions, condition func(*corev1.Service) (bool, error), additionalConditions ...func(*corev1.Service) (bool, error)) (*corev1.Service, error) {
183185
return WaitForObjectState[*corev1.Service, *corev1.ServiceList](ctx, client, name, options, condition, additionalConditions...)
184186
}
187+
188+
func WaitForDaemonSetState(ctx context.Context, client appsv1client.DaemonSetInterface, name string, options WaitForStateOptions, condition func(*appsv1.DaemonSet) (bool, error), additionalConditions ...func(set *appsv1.DaemonSet) (bool, error)) (*appsv1.DaemonSet, error) {
189+
return WaitForObjectState[*appsv1.DaemonSet, *appsv1.DaemonSetList](ctx, client, name, options, condition, additionalConditions...)
190+
}

test/e2e/set/nodeconfig/nodeconfig_optimizations.go

+28
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"k8s.io/apimachinery/pkg/api/resource"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
"k8s.io/apimachinery/pkg/labels"
28+
"k8s.io/apimachinery/pkg/types"
2829
)
2930

3031
const (
@@ -349,6 +350,33 @@ var _ = g.Describe("NodeConfig Optimizations", framework.Serial, func() {
349350
scyllaContainerID, err := controllerhelpers.GetScyllaContainerID(pod)
350351
o.Expect(err).NotTo(o.HaveOccurred())
351352

353+
framework.By("Bumping tuning DaemonSet sync and waiting for it to become healthy")
354+
355+
dsList, err := f.KubeAdminClient().AppsV1().DaemonSets(naming.ScyllaOperatorNodeTuningNamespace).List(ctx, metav1.ListOptions{
356+
LabelSelector: labels.Set{
357+
"app.kubernetes.io/name": naming.NodeConfigAppName,
358+
}.AsSelector().String(),
359+
})
360+
o.Expect(err).NotTo(o.HaveOccurred())
361+
o.Expect(dsList.Items).To(o.HaveLen(1), "there should be exactly 1 matching NodeConfig in this test")
362+
ds := &dsList.Items[0]
363+
364+
// At this point the DaemonSet controller in kube-controller-manager is notably rate-limited
365+
// because of resource quota failures. We have to trigger an event to reset its queue rate limiter,
366+
// or there will be a large delay.
367+
ds, err = f.KubeAdminClient().AppsV1().DaemonSets(naming.ScyllaOperatorNodeTuningNamespace).Patch(
368+
ctx,
369+
ds.Name,
370+
types.JSONPatchType,
371+
[]byte(fmt.Sprintf(`[{"op": "add", "path": "/metadata/annotations/e2e-requeue", "value": %q}]`, time.Now())),
372+
metav1.PatchOptions{},
373+
)
374+
375+
ctxTuningDS, ctxTuningDSCancel := utils.ContextForRollout(ctx, sc)
376+
defer ctxTuningDSCancel()
377+
ds, err = controllerhelpers.WaitForDaemonSetState(ctxTuningDS, f.KubeAdminClient().AppsV1().DaemonSets(ds.Namespace), ds.Name, controllerhelpers.WaitForStateOptions{}, controllerhelpers.IsDaemonSetRolledOut)
378+
o.Expect(err).NotTo(o.HaveOccurred())
379+
352380
framework.By("Waiting for the NodeConfig to deploy")
353381
ctx3, ctx3Cancel := context.WithTimeout(ctx, nodeConfigRolloutTimeout)
354382
defer ctx3Cancel()

0 commit comments

Comments
 (0)