Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9a202ca63f62
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160
k8s.io/api v0.29.14
k8s.io/apimachinery v0.29.14
k8s.io/client-go v0.29.14
Expand Down
4 changes: 2 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9a202ca63f62 h1:0NgCmg03wFjZEltZyHLWalTsUxOg1b7WFNlOZ4APPek=
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9a202ca63f62/go.mod h1:JgcmYJyyMKfArK8ulZnbls0L01qt8Dq6s5LH8TZH63A=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97 h1:3LC66vrXJzGMV/eCdvImosOEL2Cgc2KFJIm2YhfTG3w=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97/go.mod h1:rgpcv2tLD+/vudXx/gpIQSTuRpk4GOxHx84xwfvQalM=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160 h1:7l70xtCoyyz6kjMTSBdL4+4yUhZBrAVWLLzB7w+yhD4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160/go.mod h1:rgpcv2tLD+/vudXx/gpIQSTuRpk4GOxHx84xwfvQalM=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
17 changes: 14 additions & 3 deletions controllers/ironicapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,9 @@ func (r *IronicAPIReconciler) reconcileNormal(ctx context.Context, instance *iro
}

// Only check readiness if controller sees the last version of the CR
if depl.GetDeployment().Generation == depl.GetDeployment().Status.ObservedGeneration {
instance.Status.ReadyCount = depl.GetDeployment().Status.ReadyReplicas
deploy := depl.GetDeployment()
if deploy.Generation == deploy.Status.ObservedGeneration {
instance.Status.ReadyCount = deploy.Status.ReadyReplicas

// verify if network attachment matches expectations
networkReady, networkAttachmentStatus, err := nad.VerifyNetworkStatusFromAnnotation(ctx, helper, instance.Spec.NetworkAttachments, serviceLabels, instance.Status.ReadyCount)
Expand All @@ -960,8 +961,18 @@ func (r *IronicAPIReconciler) reconcileNormal(ctx context.Context, instance *iro
return ctrl.Result{}, err
}

if instance.Status.ReadyCount == *instance.Spec.Replicas {
// Mark the Deployment as Ready only if the number of Replicas is equals
// to the Deployed instances (ReadyCount), and the the Status.Replicas
// match Status.ReadyReplicas. If a deployment update is in progress,
// Replicas > ReadyReplicas.
if deployment.IsReady(deploy) {
instance.Status.Conditions.MarkTrue(condition.DeploymentReadyCondition, condition.DeploymentReadyMessage)
} else {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.DeploymentReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.DeploymentReadyRunningMessage))
}
}
// create Deployment - end
Expand Down
17 changes: 14 additions & 3 deletions controllers/ironicconductor_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,9 @@ func (r *IronicConductorReconciler) reconcileNormal(ctx context.Context, instanc
}

// Only check readiness if controller sees the last version of the CR
if ss.GetStatefulSet().Generation == ss.GetStatefulSet().Status.ObservedGeneration {
instance.Status.ReadyCount = ss.GetStatefulSet().Status.ReadyReplicas
deploy := ss.GetStatefulSet()
if deploy.Generation == deploy.Status.ObservedGeneration {
instance.Status.ReadyCount = deploy.Status.ReadyReplicas

// verify if network attachment matches expectations
networkReady, networkAttachmentStatus, err := nad.VerifyNetworkStatusFromAnnotation(ctx, helper, instance.Spec.NetworkAttachments, serviceLabels, instance.Status.ReadyCount)
Expand All @@ -779,8 +780,18 @@ func (r *IronicConductorReconciler) reconcileNormal(ctx context.Context, instanc
return ctrl.Result{}, err
}

if instance.Status.ReadyCount == *instance.Spec.Replicas {
// Mark the Deployment as Ready only if the number of Replicas is equals
// to the Deployed instances (ReadyCount), and the the Status.Replicas
// match Status.ReadyReplicas. If a deployment update is in progress,
// Replicas > ReadyReplicas.
if statefulset.IsReady(deploy) {
instance.Status.Conditions.MarkTrue(condition.DeploymentReadyCondition, condition.DeploymentReadyMessage)
} else {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.DeploymentReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.DeploymentReadyRunningMessage))
}
}

Expand Down
22 changes: 16 additions & 6 deletions controllers/ironicinspector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,9 @@ func (r *IronicInspectorReconciler) reconcileStatefulSet(
}

// Only check readiness if controller sees the last version of the CR
if ss.GetStatefulSet().Generation == ss.GetStatefulSet().Status.ObservedGeneration {
instance.Status.ReadyCount = ss.GetStatefulSet().Status.ReadyReplicas
deploy := ss.GetStatefulSet()
if deploy.Generation == deploy.Status.ObservedGeneration {
instance.Status.ReadyCount = deploy.Status.ReadyReplicas

// verify if network attachment matches expectations
networkReady, networkAttachmentStatus, err := nad.VerifyNetworkStatusFromAnnotation(ctx, helper, instance.Spec.NetworkAttachments, serviceLabels, instance.Status.ReadyCount)
Expand All @@ -733,11 +734,20 @@ func (r *IronicInspectorReconciler) reconcileStatefulSet(

return ctrl.Result{}, err
}
if instance.Status.ReadyCount == *instance.Spec.Replicas {
instance.Status.Conditions.MarkTrue(
condition.DeploymentReadyCondition,
condition.DeploymentReadyMessage)

// Mark the Deployment as Ready only if the number of Replicas is equals
// to the Deployed instances (ReadyCount), and the the Status.Replicas
// match Status.ReadyReplicas. If a deployment update is in progress,
// Replicas > ReadyReplicas.
if statefulset.IsReady(deploy) {
instance.Status.Conditions.MarkTrue(condition.DeploymentReadyCondition, condition.DeploymentReadyMessage)
} else {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.DeploymentReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.DeploymentReadyRunningMessage))

return ctrl.Result{RequeueAfter: time.Second * 10}, nil
}
}
Expand Down
23 changes: 17 additions & 6 deletions controllers/ironicneutronagent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ func (r *IronicNeutronAgentReconciler) reconcileDeployment(
serviceLabels,
topology,
)
deployment := deployment.NewDeployment(deplomentDef, 5)
ctrlResult, err := deployment.CreateOrPatch(ctx, helper)
depl := deployment.NewDeployment(deplomentDef, 5)
ctrlResult, err := depl.CreateOrPatch(ctx, helper)
if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.DeploymentReadyCondition,
Expand All @@ -537,11 +537,22 @@ func (r *IronicNeutronAgentReconciler) reconcileDeployment(
}

// Only check ReadyCount if controller sees the last version of the CR
if deployment.GetDeployment().Generation == deployment.GetDeployment().Status.ObservedGeneration {
instance.Status.ReadyCount = deployment.GetDeployment().Status.ReadyReplicas

if instance.Status.ReadyCount == *instance.Spec.Replicas {
deploy := depl.GetDeployment()
if deploy.Generation == deploy.Status.ObservedGeneration {
instance.Status.ReadyCount = deploy.Status.ReadyReplicas

// Mark the Deployment as Ready only if the number of Replicas is equals
// to the Deployed instances (ReadyCount), and the the Status.Replicas
// match Status.ReadyReplicas. If a deployment update is in progress,
// Replicas > ReadyReplicas.
if deployment.IsReady(deploy) {
instance.Status.Conditions.MarkTrue(condition.DeploymentReadyCondition, condition.DeploymentReadyMessage)
} else {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.DeploymentReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.DeploymentReadyRunningMessage))
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9a202ca63f62
github.com/openstack-k8s-operators/ironic-operator/api v0.0.0-00010101000000-000000000000
github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20250302110733-25e75aecd56f
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160
github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20250228124213-cd63da392f97
github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20250227120618-381cb0be1059
k8s.io/api v0.29.14
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9
github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20250301104950-9a202ca63f62/go.mod h1:JgcmYJyyMKfArK8ulZnbls0L01qt8Dq6s5LH8TZH63A=
github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20250302110733-25e75aecd56f h1:t5cA25n+Y53dgWAOObgWRwC5ABdi++u82mjAFCRMFKo=
github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20250302110733-25e75aecd56f/go.mod h1:5eUEjRPFyDhyJTdKz9xfeNP1OMFiJWy4ejb4tidD6ds=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97 h1:3LC66vrXJzGMV/eCdvImosOEL2Cgc2KFJIm2YhfTG3w=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250228124213-cd63da392f97/go.mod h1:rgpcv2tLD+/vudXx/gpIQSTuRpk4GOxHx84xwfvQalM=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160 h1:7l70xtCoyyz6kjMTSBdL4+4yUhZBrAVWLLzB7w+yhD4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20250414142358-93cd2db6b160/go.mod h1:rgpcv2tLD+/vudXx/gpIQSTuRpk4GOxHx84xwfvQalM=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20250228124213-cd63da392f97 h1:2m8xt9k3FWcnzmq5SxplT0t6v8vvH7LZq3UWK17ygak=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.5.1-0.20250228124213-cd63da392f97/go.mod h1:tfMa+ochq7Dyilq9hQr2CEPfPtsj6IUgMmMqi4CWDmo=
github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20250228124213-cd63da392f97 h1:2f6Fl2chkacLkElCtEtCFygtuVhEq3YuUvZbfiEBDZ8=
Expand Down
Loading