Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#970 from slagle/osprh-8923
Browse files Browse the repository at this point in the history
Revert "Remove the deployed attribute from deployment"
  • Loading branch information
openshift-merge-bot[bot] authored Jul 24, 2024
2 parents 803a50a + 4f117a0 commit e569d04
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ spec:
additionalProperties:
type: string
type: object
deployed:
type: boolean
deployedVersion:
type: string
nodeSetConditions:
Expand Down
6 changes: 6 additions & 0 deletions apis/dataplane/v1beta1/openstackdataplanedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ type OpenStackDataPlaneDeploymentStatus struct {

// DeployedVersion
DeployedVersion string `json:"deployedVersion,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// Deployed
Deployed bool `json:"deployed,omitempty" optional:"true"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -147,6 +151,8 @@ func (instance *OpenStackDataPlaneDeployment) InitConditions() {

}
}

instance.Status.Deployed = false
}

// InitHashesAndImages - Initialize ConfigHashes and Images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ spec:
additionalProperties:
type: string
type: object
deployed:
type: boolean
deployedVersion:
type: string
nodeSetConditions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
Log,
)

// If the deploy is already done, return immediately.
if instance.Status.Deployed {
Log.Info("Already deployed", "instance.Status.Deployed", instance.Status.Deployed)
return ctrl.Result{}, nil
}

// initialize status if Conditions is nil, but do not reset if it already
// exists
isNewInstance := instance.Status.Conditions == nil
Expand Down Expand Up @@ -274,6 +280,8 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
for _, nodeSet := range nodeSets.Items {

Log.Info(fmt.Sprintf("Deploying NodeSet: %s", nodeSet.Name))
Log.Info("Set Status.Deployed to false", "instance", instance)
instance.Status.Deployed = false
Log.Info("Set DeploymentReadyCondition false")
instance.Status.Conditions.MarkFalse(
condition.DeploymentReadyCondition, condition.RequestedReason,
Expand Down Expand Up @@ -366,6 +374,7 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
Log.Info("Set DeploymentReadyCondition true")
instance.Status.Conditions.MarkTrue(condition.DeploymentReadyCondition, condition.DeploymentReadyMessage)
Log.Info("Set Status.Deployed to true", "instance", instance)
instance.Status.Deployed = true
if version != nil {
instance.Status.DeployedVersion = version.Spec.TargetVersion
}
Expand Down
5 changes: 5 additions & 0 deletions docs/assemblies/dataplane_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ OpenStackDataPlaneDeploymentStatus defines the observed state of OpenStackDataPl
| DeployedVersion
| string
| false
| deployed
| Deployed
| bool
| false
|===
<<custom-resources,Back to Custom Resources>>
Expand Down

0 comments on commit e569d04

Please sign in to comment.