Skip to content

Commit b177be3

Browse files
tmshortclaude
andauthored
fix(catalogd): follow-up fixes after HA PR merge (#2679)
Two fixes on top of the catalogd HA work (#2674): 1. serverutil: wrap http.Server.Serve error with the catalog listen address so the failure message is self-diagnosing in aggregated manager logs. 2. e2e: fix CatalogdHA gate to override node-count check with actual catalogd replica count. The node-count heuristic fires on any multi-node cluster (e.g. OpenShift standard e2e on AWS), causing the @CatalogdHA scenario to run even when catalogd has only 1 replica, which makes the step "catalogd is ready to reconcile resources" fail with exit status 1. After olmNamespace is populated, query the catalogd deployment's spec.replicas and set the gate unconditionally to (replicas >= 2), overriding the earlier node-count result. For upgrade scenarios the detectOLMDeployment early-return keeps the node-count value intact. Signed-off-by: Todd Short <tshort@redhat.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 74e39f5 commit b177be3

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

internal/catalogd/serverutil/serverutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (r *catalogServerRunnable) Start(ctx context.Context) error {
120120
}()
121121

122122
if err := r.server.Serve(listener); err != nil && !errors.Is(err, http.ErrServerClosed) {
123-
return err
123+
return fmt.Errorf("catalog server on %q failed: %w", r.cfg.CatalogAddr, err)
124124
}
125125
return nil
126126
}

test/e2e/steps/hooks.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,23 @@ func BeforeSuite() {
148148
}
149149
olmNamespace = olm.Namespace
150150

151+
// Refine CatalogdHA based on actual catalogd replica count now that
152+
// olmNamespace is known. The node-count check above can fire on any
153+
// multi-node cluster even when catalogd runs with only 1 replica.
154+
// Override the gate: HA scenarios require ≥2 catalogd replicas.
155+
// If the deployment is not found (kubectl error), or the replica
156+
// count is empty/non-numeric, the gate keeps whatever the node-count
157+
// check set.
158+
if repOut, err := k8sClient("get", "deployments", "-n", olmNamespace,
159+
"-l", "app.kubernetes.io/name=catalogd",
160+
"-o", "jsonpath={.items[0].spec.replicas}"); err == nil {
161+
if repOut = strings.TrimSpace(repOut); repOut != "" {
162+
if replicas, err := strconv.Atoi(repOut); err == nil {
163+
featureGates[catalogdHAFeature] = replicas >= 2
164+
}
165+
}
166+
}
167+
151168
featureGatePattern := regexp.MustCompile(`--feature-gates=([[:alnum:]]+)=(true|false)`)
152169
for _, c := range olm.Spec.Template.Spec.Containers {
153170
if c.Name == "manager" {

0 commit comments

Comments
 (0)