Skip to content

Commit 7e6bc4e

Browse files
committed
Do not rm MinorUpdateAvailable condition
Instead of removing the condtion, let's set it to False, with severity Info and a message "AtLatestKnown". With the CLI it is not possible to wait for a condition to be removed, With this change we can do wait --for condition=OpenStackVersionMinorUpdateAvailable=True Patch the targetVersion and wait for: wait --for condition=OpenStackVersionMinorUpdateAvailable=False
1 parent c1cdd8c commit 7e6bc4e

6 files changed

Lines changed: 25 additions & 2 deletions

File tree

apis/bases/core.openstack.org_openstackversions.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ spec:
650650
glanceWsgi:
651651
type: string
652652
type: object
653+
state:
654+
type: string
653655
type: object
654656
type: object
655657
served: true

apis/core/v1beta1/conditions.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,4 +540,13 @@ const (
540540

541541
// OpenStackVersionMinorUpdateAvailableMessage
542542
OpenStackVersionMinorUpdateAvailableMessage = "update available"
543+
544+
// OpenStackVersionMinorUpdateAvailableMessage
545+
OpenStackVersionMinorUpdateAtLatestKnownMessage = "at latest known"
546+
)
547+
548+
// Reasons used for API objects.
549+
const (
550+
// OpenStackVersionMinorUpdateAtLatestKnownReason
551+
OpenStackVersionMinorUpdateAtLatestKnownReason = "AtLatestKnown"
543552
)

apis/core/v1beta1/openstackversion_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ type OpenStackVersionStatus struct {
195195

196196
//ObservedGeneration - the most recent generation observed for this object.
197197
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
198+
199+
// State - "UpdateAvailable" or "AtLatestKnown"
200+
State string `json:"state,omitempty"`
198201
}
199202

200203
// +kubebuilder:object:root=true

bindata/crds/crds.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20845,6 +20845,8 @@ spec:
2084520845
glanceWsgi:
2084620846
type: string
2084720847
type: object
20848+
state:
20849+
type: string
2084820850
type: object
2084920851
type: object
2085020852
served: true

config/crd/bases/core.openstack.org_openstackversions.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ spec:
650650
glanceWsgi:
651651
type: string
652652
type: object
653+
state:
654+
type: string
653655
type: object
654656
type: object
655657
served: true

controllers/core/openstackversion_controller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
172172
*condition.UnknownCondition(corev1beta1.OpenStackVersionMinorUpdateKeystone, condition.InitReason, string(corev1beta1.OpenStackVersionMinorUpdateInitMessage)),
173173
*condition.UnknownCondition(corev1beta1.OpenStackVersionMinorUpdateControlplane, condition.InitReason, string(corev1beta1.OpenStackVersionMinorUpdateInitMessage)),
174174
*condition.UnknownCondition(corev1beta1.OpenStackVersionMinorUpdateDataplane, condition.InitReason, string(corev1beta1.OpenStackVersionMinorUpdateInitMessage)),
175+
*condition.UnknownCondition(corev1beta1.OpenStackVersionMinorUpdateAvailable, condition.InitReason, string(corev1beta1.OpenStackVersionMinorUpdateInitMessage)),
175176
)
176177
}
177178
instance.Status.Conditions.Init(&cl)
@@ -397,8 +398,12 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
397398
instance.Status.Conditions.Set(condition.TrueCondition(
398399
corev1beta1.OpenStackVersionMinorUpdateAvailable,
399400
corev1beta1.OpenStackVersionMinorUpdateAvailableMessage))
400-
} else {
401-
instance.Status.Conditions.Remove(corev1beta1.OpenStackVersionMinorUpdateAvailable)
401+
} else if *instance.Status.AvailableVersion == *instance.Status.DeployedVersion {
402+
instance.Status.Conditions.Set(condition.FalseCondition(
403+
corev1beta1.OpenStackVersionMinorUpdateAvailable,
404+
corev1beta1.OpenStackVersionMinorUpdateAtLatestKnownReason,
405+
condition.SeverityInfo,
406+
corev1beta1.OpenStackVersionMinorUpdateAvailableMessage))
402407
}
403408

404409
return ctrl.Result{}, nil

0 commit comments

Comments
 (0)