Skip to content

Commit

Permalink
Merge pull request #787 from dprince/missing_observed_generation_checks
Browse files Browse the repository at this point in the history
sub resource ready condition updates/fixes
  • Loading branch information
openshift-merge-bot[bot] authored May 22, 2024
2 parents d9a3921 + 2a3244e commit 84bbcef
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions apis/client/v1beta1/openstackclient_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func init() {
SchemeBuilder.Register(&OpenStackClient{}, &OpenStackClientList{})
}

// IsReady - returns true if OpenStackClient is reconciled successfully
func (instance OpenStackClient) IsReady() bool {
return instance.Status.Conditions.IsTrue(OpenStackClientReadyCondition)
}

// RbacConditionsSet - set the conditions for the rbac object
func (instance OpenStackClient) RbacConditionsSet(c *condition.Condition) {
instance.Status.Conditions.Set(c)
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/designate.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func ReconcileDesignate(ctx context.Context, instance *corev1beta1.OpenStackCont
helper.GetLogger().Info(fmt.Sprintf("Designate %s - %s", designate.Name, op))
}

if designate.IsReady() { //FIXME ObservedGeneration
if designate.Status.ObservedGeneration == designate.Generation && designate.IsReady() {
instance.Status.ContainerImages.DesignateAPIImage = version.Status.ContainerImages.DesignateAPIImage
instance.Status.ContainerImages.DesignateCentralImage = version.Status.ContainerImages.DesignateCentralImage
instance.Status.ContainerImages.DesignateMdnsImage = version.Status.ContainerImages.DesignateMdnsImage
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/dnsmasq.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ReconcileDNSMasqs(ctx context.Context, instance *corev1beta1.OpenStackContr
Log.Info(fmt.Sprintf("dnsmasq %s - %s", dnsmasq.Name, op))
}

if dnsmasq.IsReady() { // FIXME ObservedGeneration
if dnsmasq.Status.ObservedGeneration == dnsmasq.Generation && dnsmasq.IsReady() {
instance.Status.ContainerImages.InfraDnsmasqImage = version.Status.ContainerImages.InfraDnsmasqImage
instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlaneDNSReadyCondition, corev1beta1.OpenStackControlPlaneDNSReadyMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/galera.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func reconcileGalera(
Log.Info(fmt.Sprintf("Galera %s - %s", galera.Name, op))
}

if galera.IsReady() { //FIXME ObservedGeneration
if galera.Status.ObservedGeneration == galera.Generation && galera.IsReady() {
instance.Status.ContainerImages.MariadbImage = version.Status.ContainerImages.MariadbImage
return galeraReady, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/heat.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func ReconcileHeat(ctx context.Context, instance *corev1beta1.OpenStackControlPl
Log.Info(fmt.Sprintf("heat %s - %s", heat.Name, op))
}

if heat.IsReady() { //FIXME ObservedGeneration
if heat.Status.ObservedGeneration == heat.Generation && heat.IsReady() {
instance.Status.ContainerImages.HeatAPIImage = version.Status.ContainerImages.HeatAPIImage
instance.Status.ContainerImages.HeatCfnapiImage = version.Status.ContainerImages.HeatCfnapiImage
instance.Status.ContainerImages.HeatEngineImage = version.Status.ContainerImages.HeatEngineImage
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/horizon.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func ReconcileHorizon(ctx context.Context, instance *corev1beta1.OpenStackContro
Log.Info(fmt.Sprintf("Horizon %s - %s", horizon.Name, op))
}

if horizon.IsReady() { //FIXME ObservedGeneration
if horizon.Status.ObservedGeneration == horizon.Generation && horizon.IsReady() {
instance.Status.ContainerImages.HorizonImage = version.Status.ContainerImages.HorizonImage
instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlaneHorizonReadyCondition, corev1beta1.OpenStackControlPlaneHorizonReadyMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func ReconcileIronic(ctx context.Context, instance *corev1beta1.OpenStackControl
Log.Info(fmt.Sprintf("ironic %s - %s", ironic.Name, op))
}

if ironic.IsReady() { //FIXME ObservedGeneration
if ironic.Status.ObservedGeneration == ironic.Generation && ironic.IsReady() {
instance.Status.ContainerImages.IronicAPIImage = version.Status.ContainerImages.IronicAPIImage
instance.Status.ContainerImages.IronicConductorImage = version.Status.ContainerImages.IronicConductorImage
instance.Status.ContainerImages.IronicInspectorImage = version.Status.ContainerImages.IronicInspectorImage
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func reconcileMemcached(
Log.Info(fmt.Sprintf("Memcached %s - %s", memcached.Name, op))
}

if memcached.IsReady() { //FIXME ObservedGeneration
if memcached.Status.ObservedGeneration == memcached.Generation && memcached.IsReady() {
instance.Status.ContainerImages.InfraMemcachedImage = version.Status.ContainerImages.InfraMemcachedImage
return memcachedReady, ctrl.Result{}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/neutron.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro
Log.Info(fmt.Sprintf("neutronAPI %s - %s", neutronAPI.Name, op))
}

if neutronAPI.IsReady() { //FIXME ObservedGeneration
if neutronAPI.Status.ObservedGeneration == neutronAPI.Generation && neutronAPI.IsReady() {
instance.Status.ContainerImages.NeutronAPIImage = version.Status.ContainerImages.NeutronAPIImage
instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlaneNeutronReadyCondition, corev1beta1.OpenStackControlPlaneNeutronReadyMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/nova.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func ReconcileNova(ctx context.Context, instance *corev1beta1.OpenStackControlPl
Log.Info(fmt.Sprintf("Nova %s - %s", nova.Name, op))
}

if nova.IsReady() { //FIXME ObservedGeneration
if nova.Status.ObservedGeneration == nova.Generation && nova.IsReady() {
instance.Status.ContainerImages.NovaAPIImage = version.Status.ContainerImages.NovaAPIImage
instance.Status.ContainerImages.NovaComputeImage = version.Status.ContainerImages.NovaComputeImage
instance.Status.ContainerImages.NovaConductorImage = version.Status.ContainerImages.NovaConductorImage
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/octavia.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func ReconcileOctavia(ctx context.Context, instance *corev1beta1.OpenStackContro
helper.GetLogger().Info(fmt.Sprintf("Octavia %s - %s", octavia.Name, op))
}

if octavia.IsReady() { //FIXME ObservedGeneration
if octavia.Status.ObservedGeneration == octavia.Generation && octavia.IsReady() {
instance.Status.ContainerImages.OctaviaAPIImage = version.Status.ContainerImages.OctaviaAPIImage
instance.Status.ContainerImages.OctaviaWorkerImage = version.Status.ContainerImages.OctaviaWorkerImage
instance.Status.ContainerImages.OctaviaHealthmanagerImage = version.Status.ContainerImages.OctaviaHealthmanagerImage
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/openstackclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ReconcileOpenStackClient(ctx context.Context, instance *corev1.OpenStackCon
Log.Info(fmt.Sprintf("OpenStackClient %s - %s", openstackclient.Name, op))
}

if openstackclient.Status.Conditions.IsTrue(clientv1.OpenStackClientReadyCondition) { //FIXME ObservedGeneration
if openstackclient.Status.ObservedGeneration == openstackclient.Generation && openstackclient.IsReady() {
Log.Info("OpenStackClient ready condition is true")
instance.Status.ContainerImages.OpenstackClientImage = version.Status.ContainerImages.OpenstackClientImage
instance.Status.Conditions.MarkTrue(corev1.OpenStackControlPlaneClientReadyCondition, corev1.OpenStackControlPlaneClientReadyMessage)
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func ReconcilePlacementAPI(ctx context.Context, instance *corev1beta1.OpenStackC
Log.Info(fmt.Sprintf("placementAPI %s - %s", placementAPI.Name, op))
}

if placementAPI.IsReady() {
if placementAPI.Status.ObservedGeneration == placementAPI.Generation && placementAPI.IsReady() {
instance.Status.ContainerImages.PlacementAPIImage = version.Status.ContainerImages.PlacementAPIImage
instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlanePlacementAPIReadyCondition, corev1beta1.OpenStackControlPlanePlacementAPIReadyMessage)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/openstack/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont
helper.GetLogger().Info(fmt.Sprintf("%s %s - %s", telemetryName, telemetry.Name, op))
}

if telemetry.IsReady() { //FIXME ObservedGeneration
if telemetry.Status.ObservedGeneration == telemetry.Generation && telemetry.IsReady() {
instance.Status.ContainerImages.CeilometerCentralImage = version.Status.ContainerImages.CeilometerCentralImage
instance.Status.ContainerImages.CeilometerComputeImage = version.Status.ContainerImages.CeilometerComputeImage
instance.Status.ContainerImages.CeilometerIpmiImage = version.Status.ContainerImages.CeilometerIpmiImage
Expand Down

0 comments on commit 84bbcef

Please sign in to comment.