Skip to content

[test] ApplyStatefulSet removes an init container dropped from the template - #563

Open
SLoeuillet wants to merge 1 commit into
apache:masterfrom
SLoeuillet:test-apply-statefulset-init-removal
Open

SLoeuillet wants to merge 1 commit into
apache:masterfrom
SLoeuillet:test-apply-statefulset-init-removal

Conversation

@SLoeuillet

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: close #562

Related PR: #545

Problem Summary:

In 26.0.1, enabling skipDefaultSystemInit on an existing compute group never removed the privileged default-init from its StatefulSet. PatchClientObject sent the desired object as a JSON merge patch, and the empty (omitempty) initContainers was absent from it. #545 fixed this on master by patching from the live object, but nothing tests this case.

This adds TestApplyStatefulSetRemovesDroppedInitContainer: an existing StatefulSet whose template has default-init, and a desired template without it (plus a SKIP_CHECK_ULIMIT env var, to check the update itself was applied). After ApplyStatefulSet, the init container must be gone.

  • On 26.0.1 it fails: expected no init containers after the update, got 1: default-init.
  • On master it passes, along with the whole pkg/common/utils/k8s package (with KUBEBUILDER_ASSETS set for the envtest cases).

Test only; no code change.

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.

…mplate

Regression test for apache#562: enabling skipDefaultSystemInit on an existing compute group drops
default-init from the rendered template, and applying it must remove the init container from
the live StatefulSet. 26.0.1 patched with the desired object as a JSON merge patch, where the
empty (omitempty) initContainers is absent, so default-init stayed; apache#545 fixed it on master.
The test fails on 26.0.1 and passes on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Al-assad Al-assad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Al-assad

Copy link
Copy Markdown
Member

cc @morningman

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.

[Bug] 26.0.1: enabling skipDefaultSystemInit on an existing compute group never removes default-init

2 participants