Skip to content

Commit

Permalink
Remove the deployed attribute from deployment
Browse files Browse the repository at this point in the history
We reset the conditions and `deployed: false` for every reconcile
now and code to check the deployed flag during reconcile is not
relevant and dead code.

We have also made the deployment spec immutable which won't allow
for any changes to the spec.

Signed-off-by: rabi <[email protected]>
  • Loading branch information
rabi committed Jun 18, 2024
1 parent 334a6ae commit 5a55c47
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ spec:
additionalProperties:
type: string
type: object
deployed:
type: boolean
deployedVersion:
type: string
nodeSetConditions:
Expand Down
6 changes: 0 additions & 6 deletions apis/dataplane/v1beta1/openstackdataplanedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ 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 @@ -151,6 +147,4 @@ func (instance *OpenStackDataPlaneDeployment) InitConditions() {

}
}

instance.Status.Deployed = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ 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 @@ -98,12 +98,6 @@ 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 @@ -293,8 +287,6 @@ 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 @@ -387,7 +379,6 @@ 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: 0 additions & 5 deletions docs/assemblies/dataplane_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,6 @@ 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 5a55c47

Please sign in to comment.