Skip to content

NEXUS-50170: Fix StatefulSet updateStrategy to always use RollingUpdate#152

Open
SraavanChevireddy wants to merge 1 commit into
mainfrom
NEXUS-50170-fix-updatestrategy-ondelete
Open

NEXUS-50170: Fix StatefulSet updateStrategy to always use RollingUpdate#152
SraavanChevireddy wants to merge 1 commit into
mainfrom
NEXUS-50170-fix-updatestrategy-ondelete

Conversation

@SraavanChevireddy
Copy link
Copy Markdown
Contributor

@SraavanChevireddy SraavanChevireddy commented Jan 28, 2026

Problem Statement

The Nexus HA Helm chart was conditionally setting the StatefulSet updateStrategy to OnDelete when zeroDowntimeEnabled was false (which is the default configuration). This prevented customers from performing standard Kubernetes rolling updates and administrative activities.

Customer Impact: Hyundai reported that this affects their Kubernetes administration activities, as they cannot perform normal pod updates without manually deleting pods.

Root Cause Analysis

The issue was in nxrm-ha/templates/statefulset.yaml lines 23-26:

Before:

{{- if not .Values.statefulset.container.env.zeroDowntimeEnabled }}
updateStrategy:
  type: OnDelete
{{- end }}

This conditional logic meant:

  • When zeroDowntimeEnabled: false (default) → updateStrategy.type: OnDelete
  • When zeroDowntimeEnabled: true → No updateStrategy block (defaults to RollingUpdate)

The OnDelete strategy requires manual intervention to delete pods before they are updated, which is not standard Kubernetes behavior.

Solution Details

Changed the StatefulSet template to always use RollingUpdate strategy:

After:

updateStrategy:
  type: RollingUpdate

This ensures that Kubernetes will automatically perform rolling updates of StatefulSet pods when the Helm chart is upgraded, regardless of the Zero Downtime Upgrade setting.

Testing Verification

Template Changes

  • File: nxrm-ha/templates/statefulset.yaml
  • Change: Removed conditional logic, always set updateStrategy.type: RollingUpdate

Test Updates

Updated two tests in nxrm-ha/tests/statefulset_test.yaml:

  1. Test: "should set zdu env to true and rollingUpgrades when zeroDowntimeEnabled is true"

    • Before: Expected spec.updateStrategy to be null
    • After: Expects spec.updateStrategy.type: RollingUpdate
  2. Test: "should create nxrm-app container with dynamic nexusdata volume"

    • Before: Expected spec.updateStrategy.type: OnDelete
    • After: Expects spec.updateStrategy.type: RollingUpdate

Expected Behavior

With this fix, the rendered StatefulSet YAML will always include:

spec:
  updateStrategy:
    type: RollingUpdate

This applies to both scenarios:

  • zeroDowntimeEnabled: false (default)
  • zeroDowntimeEnabled: true

Impact on Customers

Positive Impact:

  • Customers can now perform normal Kubernetes rolling updates without enabling the Zero Downtime Upgrade workaround
  • StatefulSet pods will be automatically updated in a rolling fashion when the Helm chart is upgraded
  • Aligns with standard Kubernetes StatefulSet update behavior

Zero Downtime Upgrade (ZDU) Functionality:

  • ZDU functionality remains completely unaffected
  • ZDU operates at the application level via the NEXUS_ZERO_DOWNTIME_ENABLED environment variable
  • The updateStrategy setting does not interfere with ZDU's internal coordination mechanisms

Related Links

  • JIRA Ticket: NEXUS-50170
  • Customer: Hyundai
  • Labels: jira_escalated, support_reviewed

Generated with Claude Code

Problem:
The Nexus HA Helm chart was conditionally setting the StatefulSet
updateStrategy to "OnDelete" when zeroDowntimeEnabled was false (default).
This prevented customers from performing standard Kubernetes rolling updates
and administrative activities, as reported by Hyundai.

Root Cause:
Lines 23-26 in statefulset.yaml contained conditional logic that set
updateStrategy.type to "OnDelete" when zeroDowntimeEnabled was false.
When zeroDowntimeEnabled was true, the updateStrategy block was omitted
entirely (defaulting to RollingUpdate).

Fix:
- Removed the conditional logic checking zeroDowntimeEnabled
- Changed updateStrategy to always use "RollingUpdate" type
- Updated tests to expect RollingUpdate in all scenarios

Impact:
- Customers can now perform normal Kubernetes rolling updates without
  enabling Zero Downtime Upgrade workaround
- StatefulSet pods will be automatically updated in rolling fashion
  when Helm chart is upgraded
- Zero Downtime Upgrade functionality remains unaffected as it operates
  at the application level via NEXUS_ZERO_DOWNTIME_ENABLED env var

Testing:
- Updated test "should set zdu env to true and rollingUpgrades when
  zeroDowntimeEnabled is true" to expect RollingUpdate
- Updated test "should create nxrm-app container with dynamic nexusdata
  volume" to expect RollingUpdate instead of OnDelete

JIRA: https://sonatype.atlassian.net/browse/NEXUS-50170

Co-Authored-By: Claude <noreply@anthropic.com>
@SraavanChevireddy SraavanChevireddy requested a review from a team as a code owner January 28, 2026 11:06
Copy link
Copy Markdown
Contributor

@bobotimi bobotimi left a comment

Choose a reason for hiding this comment

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

This was done on purpose. Rolling upgrades should not be attempted unless ZDU is enabled to prevent database corruption.

It was intentionally done this way as we don't want rolling upgrades unless Zero downtime flag is enabled. Doing so will mean you can have two different versions of nexus (i.e., current version and new version being upgraded to) connected to the same postgres instance without the checks we have in place for the zero downtime feature.

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