Skip to content

Commit

Permalink
Merge pull request #502 from fmount/init_rc
Browse files Browse the repository at this point in the history
Always initialize `ReadyCount` to 0
  • Loading branch information
openshift-merge-bot[bot] authored Apr 9, 2024
2 parents 89788e9 + bb3849c commit b65521a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions api/bases/glance.openstack.org_glanceapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,12 @@ spec:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
4 changes: 3 additions & 1 deletion api/v1beta1/glanceapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ type GlanceAPISpec struct {

// GlanceAPIStatus defines the observed state of GlanceAPI
type GlanceAPIStatus struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
// ReadyCount of glance API instances
ReadyCount int32 `json:"readyCount,omitempty"`
ReadyCount int32 `json:"readyCount"`

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/glance.openstack.org_glanceapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,12 @@ spec:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
3 changes: 1 addition & 2 deletions controllers/glanceapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func (r *GlanceAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// Register overall status immediately to have an early feedback e.g. in the cli
return ctrl.Result{}, nil
}

if instance.Status.Hash == nil {
instance.Status.Hash = map[string]string{}
}
Expand Down Expand Up @@ -810,7 +809,7 @@ func (r *GlanceAPIReconciler) reconcileNormal(ctx context.Context, instance *gla
// to the Deployed instances (ReadyCount), but mark it as True is Replicas
// is zero. In addition, make sure the controller sees the last Generation
// by comparing it with the ObservedGeneration set in the StateFulSet.
if (instance.Status.ReadyCount == *instance.Spec.Replicas || *instance.Spec.Replicas == 0) &&
if (instance.Status.ReadyCount == *instance.Spec.Replicas) &&
(depl.GetStatefulSet().Generation == depl.GetStatefulSet().Status.ObservedGeneration) {
instance.Status.Conditions.MarkTrue(
condition.DeploymentReadyCondition,
Expand Down

0 comments on commit b65521a

Please sign in to comment.