Skip to content

Commit

Permalink
Merge pull request #381 from Akrog/more-fixing-conditions
Browse files Browse the repository at this point in the history
Fixing conditions
  • Loading branch information
openshift-merge-bot[bot] authored Apr 29, 2024
2 parents 03880bc + 7aba2b7 commit 029754e
Show file tree
Hide file tree
Showing 20 changed files with 292 additions and 64 deletions.
7 changes: 7 additions & 0 deletions api/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -986,13 +986,20 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
serviceIDs:
additionalProperties:
type: string
type: object
required:
- readyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions api/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
10 changes: 10 additions & 0 deletions api/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1152,13 +1152,19 @@ spec:
type: object
type: object
cinderAPIReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderBackupReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderSchedulerReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderVolumesReadyCounts:
additionalProperties:
Expand Down Expand Up @@ -1202,6 +1208,10 @@ spec:
type: object
transportURLSecret:
type: string
required:
- cinderAPIReadyCount
- cinderBackupReadyCount
- cinderSchedulerReadyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions api/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions api/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
20 changes: 15 additions & 5 deletions api/v1beta1/cinder_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,27 @@ type CinderStatus struct {
ServiceIDs map[string]string `json:"serviceIDs,omitempty"`

// ReadyCount of Cinder API instance
CinderAPIReadyCount int32 `json:"cinderAPIReadyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
CinderAPIReadyCount int32 `json:"cinderAPIReadyCount"`

// ReadyCount of Cinder Backup instance
CinderBackupReadyCount int32 `json:"cinderBackupReadyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
CinderBackupReadyCount int32 `json:"cinderBackupReadyCount"`

// ReadyCount of Cinder Scheduler instance
CinderSchedulerReadyCount int32 `json:"cinderSchedulerReadyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
CinderSchedulerReadyCount int32 `json:"cinderSchedulerReadyCount"`

// ReadyCounts of Cinder Volume instances
CinderVolumesReadyCounts map[string]int32 `json:"cinderVolumesReadyCounts,omitempty"`

//ObservedGeneration - the most recent generation observed for this service. If the observed generation is less than the spec generation, then the controller has not processed the latest changes.
// ObservedGeneration - the most recent generation observed for this service.
// If the observed generation is different than the spec generation, then the
// controller has not started processing the latest changes, and the status
// and its conditions are likely stale.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

Expand Down Expand Up @@ -217,7 +226,8 @@ func init() {

// IsReady - returns true if all subresources Ready condition is true
func (instance Cinder) IsReady() bool {
return instance.Status.Conditions.IsTrue(CinderAPIReadyCondition) &&
return instance.Generation == instance.Status.ObservedGeneration &&
instance.Status.Conditions.IsTrue(CinderAPIReadyCondition) &&
instance.Status.Conditions.IsTrue(CinderBackupReadyCondition) &&
instance.Status.Conditions.IsTrue(CinderSchedulerReadyCondition) &&
instance.Status.Conditions.IsTrue(CinderVolumeReadyCondition)
Expand Down
15 changes: 13 additions & 2 deletions api/v1beta1/cinderapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ type CinderAPIStatus struct {
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// ReadyCount of Cinder API instances
ReadyCount int32 `json:"readyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
ReadyCount int32 `json:"readyCount"`

// ServiceIDs
ServiceIDs map[string]string `json:"serviceIDs,omitempty"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// ObservedGeneration - the most recent generation observed for this service.
// If the observed generation is different than the spec generation, then the
// controller has not started processing the latest changes, and the status
// and its conditions are likely stale.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -136,5 +144,8 @@ func init() {

// IsReady - returns true if service is ready to serve requests
func (instance CinderAPI) IsReady() bool {
return instance.Status.ReadyCount == *instance.Spec.Replicas
return instance.Generation == instance.Status.ObservedGeneration &&
instance.Status.ReadyCount == *instance.Spec.Replicas &&
(instance.Status.Conditions.IsTrue(condition.DeploymentReadyCondition) ||
(instance.Status.Conditions.IsFalse(condition.DeploymentReadyCondition) && *instance.Spec.Replicas == 0))
}
15 changes: 13 additions & 2 deletions api/v1beta1/cinderbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ type CinderBackupStatus struct {
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// ReadyCount of Cinder Backup instances
ReadyCount int32 `json:"readyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
ReadyCount int32 `json:"readyCount"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// ObservedGeneration - the most recent generation observed for this service.
// If the observed generation is different than the spec generation, then the
// controller has not started processing the latest changes, and the status
// and its conditions are likely stale.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -118,5 +126,8 @@ func init() {

// IsReady - returns true if service is ready to serve requests
func (instance CinderBackup) IsReady() bool {
return instance.Status.ReadyCount == *instance.Spec.Replicas
return instance.Generation == instance.Status.ObservedGeneration &&
instance.Status.ReadyCount == *instance.Spec.Replicas &&
(instance.Status.Conditions.IsTrue(condition.DeploymentReadyCondition) ||
(instance.Status.Conditions.IsFalse(condition.DeploymentReadyCondition) && *instance.Spec.Replicas == 0))
}
15 changes: 13 additions & 2 deletions api/v1beta1/cinderscheduler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ type CinderSchedulerStatus struct {
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// ReadyCount of Cinder Scheduler instances
ReadyCount int32 `json:"readyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
ReadyCount int32 `json:"readyCount"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// ObservedGeneration - the most recent generation observed for this service.
// If the observed generation is different than the spec generation, then the
// controller has not started processing the latest changes, and the status
// and its conditions are likely stale.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -118,5 +126,8 @@ func init() {

// IsReady - returns true if service is ready to serve requests
func (instance CinderScheduler) IsReady() bool {
return instance.Status.ReadyCount == *instance.Spec.Replicas
return instance.Generation == instance.Status.ObservedGeneration &&
instance.Status.ReadyCount == *instance.Spec.Replicas &&
(instance.Status.Conditions.IsTrue(condition.DeploymentReadyCondition) ||
(instance.Status.Conditions.IsFalse(condition.DeploymentReadyCondition) && *instance.Spec.Replicas == 0))
}
15 changes: 13 additions & 2 deletions api/v1beta1/cindervolume_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ type CinderVolumeStatus struct {
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// ReadyCount of Cinder Volume instances
ReadyCount int32 `json:"readyCount,omitempty"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=0
ReadyCount int32 `json:"readyCount"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// ObservedGeneration - the most recent generation observed for this service.
// If the observed generation is different than the spec generation, then the
// controller has not started processing the latest changes, and the status
// and its conditions are likely stale.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -119,5 +127,8 @@ func init() {

// IsReady - returns true if service is ready to serve requests
func (instance CinderVolume) IsReady() bool {
return instance.Status.ReadyCount == *instance.Spec.Replicas
return instance.Generation == instance.Status.ObservedGeneration &&
instance.Status.ReadyCount == *instance.Spec.Replicas &&
(instance.Status.Conditions.IsTrue(condition.DeploymentReadyCondition) ||
(instance.Status.Conditions.IsFalse(condition.DeploymentReadyCondition) && *instance.Spec.Replicas == 0))
}
7 changes: 7 additions & 0 deletions config/crd/bases/cinder.openstack.org_cinderapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -986,13 +986,20 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
serviceIDs:
additionalProperties:
type: string
type: object
required:
- readyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/cinder.openstack.org_cinderbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/cinder.openstack.org_cinders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1152,13 +1152,19 @@ spec:
type: object
type: object
cinderAPIReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderBackupReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderSchedulerReadyCount:
default: 0
format: int32
minimum: 0
type: integer
cinderVolumesReadyCounts:
additionalProperties:
Expand Down Expand Up @@ -1202,6 +1208,10 @@ spec:
type: object
transportURLSecret:
type: string
required:
- cinderAPIReadyCount
- cinderBackupReadyCount
- cinderSchedulerReadyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/cinder.openstack.org_cinderschedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/cinder.openstack.org_cindervolumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,16 @@ spec:
type: string
type: array
type: object
observedGeneration:
format: int64
type: integer
readyCount:
default: 0
format: int32
minimum: 0
type: integer
required:
- readyCount
type: object
type: object
served: true
Expand Down
Loading

0 comments on commit 029754e

Please sign in to comment.