8000 fix(chi): emit event for Service reconcile error by devmalcevv · Pull Request #2165 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content

fix(chi): emit event for Service reconcile error - #2165

Open
devmalcevv wants to merge 1 commit into
Altinity:0.28.0from
devmalcevv:chi-reconcilation
Open

devmalcevv wants to merge 1 commit into
Altinity:0.28.0from
devmalcevv:chi-reconcilation

Conversation

@devmalcevv
@devmalcevv devmalcevv commented Nov 18, 2026 •
Copy link
Copy Markdown

Summary

Fixes #1650

Basically, same as b92d58e44. The identical code for Keeper in pkg/controller/chk/worker-service.go, but the CHI copy wasn't changed.

Unlike the keeper version I've added apiErrors.IsInvalid(err) check because test_010012 would fail (see logs below)

tests pass with `IsInvalid`
Passing

✔ [ OK ] /regression/e2e.test_operator/test_010012. Test service templates (4m 21s)
✔ [ OK ] /regression/e2e.test_operator (4m 21s)
✔ [ OK ] /regression (4m 21s)

Coverage

QA-SRS026 ClickHouse Operator
  262 requirements (6 satisfied 2.3%, 256 untested 97.7%)

1 suite (1 ok)
1 feature (1 ok)
1 scenario (1 ok)
85 steps (85 ok)

Total time 4m 21s
tests failing without `IsInvalid`
      kubectl.check_service("service-test-012-0-0", "ClusterIP", headless = True)
    File "/.../clickhouse-operator/tests/e2e/kubectl.py", line 1154, in check_service
      assert clusterIP == "None"
             ^^^^^^^^^^^^^^^^^^^
  AssertionError

Failing

✘ [ Fail ] /regression/e2e.test_operator/test_010012. Test service templates (2m 53s)
✘ [ Fail ] /regression/e2e.test_operator (2m 53s)
✘ [ Fail ] /regression (2m 53s)

Coverage

QA-SRS026 ClickHouse Operator
  262 requirements (6 unsatisfied 2.3%, 256 untested 97.7%)

1 suite (1 failed)
1 feature (1 failed)
1 scenario (1 failed)
75 steps (71 ok, 4 failed)

Important items to consider before making a Pull Request

Please check items PR complies to:

  • All commits in the PR are squashed. More info
  • The PR is made into dedicated next-release branch, not into master branch1. More info
  • The PR is signed. More info

--

1 If you feel your PR does not affect any Go-code or any testable functionality (for example, PR contains docs only or supplementary materials), PR can be made into master branch, but it has to be confirmed by project's maintainer.

Signed-off-by: Viacheslav Maltsev <devmalcevv@gmail.com>
@devmalcevv
devmalcevv marked this pull request as ready for review November 18, 2026 17:50
@alex-zaitsev
Copy link
Copy Markdown
Member

@devmalcevv , the change addresses #1650, but apiErrors.IsInvalid(err) is too broad to justify deleting and recreating a Service.

Invalid may indicate an invalid desired specification, not just an immutable-field transition. For example, updating an existing LoadBalancer with an invalid port can return Invalid. With this patch, the operator would delete the working Service and then fail to recreate it with the same invalid configuration, resulting in an outage.

I suggest detecting the ClusterIP <-> headless transition explicitly in updateService() and returning a dedicated sentinel error, as is already done for Service type changes. This would preserve test_010012 without reopening the destructive failure mode described in #1650.

@alex-zaitsev alex-zaitsev changed the title fix(chi): emit event for reconcile error fix(chi): emit event for Service reconcile error Dec 1, 2026
Copy link
Copy Markdown
Member

I implemented the change proposed in my review in draft PR #2185: #2185

It builds on this PR's head commit and adds two commits:

  • 3cd7577 — explicitly detect ClusterIP ↔ headless transitions with a sentinel; remove the broad apiErrors.IsInvalid(err) recreation path.
  • fb91e60 — regression tests for both transitions, preserving an existing LoadBalancer on an Invalid update, and normal Service updates.

I couldn't push directly to the contributor's fork through the connected GitHub integration (403), even though maintainer edits are enabled. The author can cherry-pick these two commits into this PR, or we can use #2185 as a replacement (not both). CI on the draft follow-up will verify the change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0