Skip to content

Bug: copier error in ReconcileWorkerSliceConfig logged but not returned — zero-value config written to cluster #399

Description

@mdryaaan

📜 Description

In ReconcileWorkerSliceConfig, copier.CopyWithOption is used at line 230 to deep-copy externalGatewayControllersConfig into externalGatewayConfig. If the copy fails, the error is logged at line 234 but execution continues. At line 275, workerSliceConfig.Spec.ExternalGatewayConfig = externalGatewayConfig writes the zero-value (empty) struct to the Kubernetes API. Worker clusters then receive an empty external gateway config, silently losing all gateway configuration.

👟 Reproduction steps

  1. Read service/worker_slice_config_service.go:230-235 — error from copier.CopyWithOption is logged but not returned.
  2. Read line 275 — workerSliceConfig.Spec.ExternalGatewayConfig = externalGatewayConfig unconditionally writes the result.
  3. If copier.CopyWithOption fails at runtime, externalGatewayConfig remains as its zero value and overwrites real config on the worker slice.

👍 Expected behavior

If copier.CopyWithOption returns an error, ReconcileWorkerSliceConfig should return ctrl.Result{}, err immediately so the bad value is never written to Kubernetes.

👎 Actual Behavior

The error is logged and execution continues. A zero-value ExternalGatewayConfig is written to the worker slice config resource, silently erasing the real gateway configuration.

🐚 Relevant log output

Version

main branch — run git describe --tags in the repo

🖥️ What operating system are you seeing the problem on?

Linux

✅ Proposed Solution

Change lines 233–235 from logging-and-continuing to returning the error:

if err != nil {
    return ctrl.Result{}, err
}

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find any similar issue

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions