Skip to content

Add minor update target-stage gate annotation#1913

Open
ciecierski wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
ciecierski:staged-update
Open

Add minor update target-stage gate annotation#1913
ciecierski wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
ciecierski:staged-update

Conversation

@ciecierski
Copy link
Copy Markdown
Contributor

Introduce the core.openstack.org/minor-update-target-stage annotation on OpenStackVersion. When set, the minor update controller completes all stages up to and including the named stage, marks the next stage as blocked (FalseCondition/RequestedReason), and pauses reconciliation. Removing the annotation or advancing it to a later stage resumes the update. Includes stage-name constants, the gated-message format string, controller logic for all seven stages, functional tests for block/resume/ advance scenarios, and updated operator documentation.

AI-assisted: Cursor (Claude Sonnet 4.6 by Anthropic)

Introduce the core.openstack.org/minor-update-target-stage annotation on
OpenStackVersion. When set, the minor update controller completes all
stages up to and including the named stage, marks the next stage as
blocked (FalseCondition/RequestedReason), and pauses reconciliation.
Removing the annotation or advancing it to a later stage resumes the
update. Includes stage-name constants, the gated-message format string,
controller logic for all seven stages, functional tests for block/resume/
advance scenarios, and updated operator documentation.

AI-assisted: Cursor (Claude Sonnet 4.6 by Anthropic)
@ciecierski ciecierski requested a review from stuggi May 5, 2026 06:48
@openshift-ci openshift-ci Bot requested review from rabi and rebtoor May 5, 2026 06:48
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ciecierski
Once this PR has been reviewed and has the lgtm label, please assign stuggi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

OpenStackControlPlane CRD Size Report

Metric Value
CRD JSON size 322464 bytes (315KB)
Base branch size 322464 bytes
Change +0.00%
Status yellow — growing
Threshold reference
Color Range Meaning
🟢 green < 300KB Comfortable
🟡 yellow 300–400KB Growing
🟠 orange 400–750KB Concerning
🔴 red > 750KB Approaching 1.5MB etcd limit (cut in half to allow space for update)

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 2026

@ciecierski: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/functional 4a18938 link true /test functional
ci/prow/precommit-check 4a18938 link true /test precommit-check
ci/prow/openstack-operator-build-deploy-kuttl-4-18 4a18938 link true /test openstack-operator-build-deploy-kuttl-4-18

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

OpenStackVersionMinorUpdateAvailableMessage = "update available"

// OpenStackVersionMinorUpdateReadyGatedMessage - format string; arg is the target stage name
OpenStackVersionMinorUpdateReadyGatedMessage = "Minor update progression stopped after stage: %s . Set annotation to next stage after %s to resume OpenStack update"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
OpenStackVersionMinorUpdateReadyGatedMessage = "Minor update progression stopped after stage: %s . Set annotation to next stage after %s to resume OpenStack update"
OpenStackVersionMinorUpdateReadyGatedMessage = "Minor update progression stopped after stage: %s . Set annotation to any stage after %s to resume OpenStack update"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't have to be the next stage only, right? Can be any of the stages that follow?

cond := osversion.Status.Conditions.Get(corev1.OpenStackVersionMinorUpdateOVNDataplane)
g.Expect(cond).ShouldNot(BeNil())
g.Expect(cond.Status).Should(Equal(k8s_corev1.ConditionFalse))
g.Expect(cond.Reason).Should(Equal(condition.RequestedReason))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
g.Expect(cond.Reason).Should(Equal(condition.RequestedReason))
g.Expect(cond.Reason).Should(Equal(condition.Reason(condition.RequestedReason)))

cond := osversion.Status.Conditions.Get(corev1.OpenStackVersionMinorUpdateRabbitMQ)
g.Expect(cond).ShouldNot(BeNil())
g.Expect(cond.Status).Should(Equal(k8s_corev1.ConditionFalse))
g.Expect(cond.Reason).Should(Equal(condition.RequestedReason))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
g.Expect(cond.Reason).Should(Equal(condition.RequestedReason))
g.Expect(cond.Reason).Should(Equal(condition.Reason(condition.RequestedReason)))

Copy link
Copy Markdown
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

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

I think we might want to add webhook validation for the annotation values, like validating the annotation value in the ValidateUpdate webhook on OpenStackVersion . If someone sets target-stage=tyop, the webhook rejects the update immediately with a clear error, rather than silently ignoring it and not would run a full update.

The OpenStackVersion already has a webhook. Adding a check like:

  if stage, ok := r.Annotations[MinorUpdateTargetStageAnnotation]; ok {
      validStages := map[string]bool{...}
      if !validStages[stage] {
          return Forbidden("invalid target stage")
      }
  }

OpenStackVersionMinorUpdateAvailableMessage = "update available"

// OpenStackVersionMinorUpdateReadyGatedMessage - format string; arg is the target stage name
OpenStackVersionMinorUpdateReadyGatedMessage = "Minor update progression stopped after stage: %s . Set annotation to next stage after %s to resume OpenStack update"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could also remove the annotation entirely, so I think the message should be something like

Update paused after stage: %s. To resume, advance the annotation to the next stage or remove it to run to completion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what we also could do is to name the next possible stages, like if one did set it to rabbitmq, it would show

Update paused after stage: rabbitmq. To resume, set annotation to one of: mariadb, memcached, keystone, controlplane — or remove the annotation to run to completion.

// stages will be blocked until the annotation is removed or updated to a later stage.
// Valid values: "ovn-controlplane", "ovn-dataplane", "rabbitmq", "mariadb", "memcached",
// "keystone", "controlplane". Remove the annotation to let the update proceed to completion.
MinorUpdateTargetStageAnnotation string = "core.openstack.org/minor-update-target-stage"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering if we could shorten it to core.openstack.org/update-target-stage

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.

3 participants