Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: janiskemper <63146658+janiskemper@users.noreply.github.com>
Signed-off-by: Matej Feder <matej.feder@dnation.cloud>
  • Loading branch information
matofeder and janiskemper committed Jan 11, 2024
1 parent 0a9e95c commit 63bfb51
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Get the latest CSPO release version and apply CSPO manifests to the management c
# Get the latest CSPO release version
CSPO_VERSION=$(curl https://api.github.com/repos/SovereignCloudStack/cluster-stack-provider-openstack/releases/latest -s | jq .name -r)
# Apply CSPO manifests
curl -sSL https://github.com/sovereignCloudStack/cluster-stack-provider-openstack/releases/download/${CSPO_VERSION}/cspo-infrastructure-components.yaml | /tmp/envsubst | kubectl apply -f -
curl -sSL https://github.com/SovereignCloudStack/cluster-stack-provider-openstack/releases/download/${CSPO_VERSION}/cspo-infrastructure-components.yaml | /tmp/envsubst | kubectl apply -f -
```

## Create the workload cluster
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/conditions_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

const (
// ClusterStackReleaseAssetsReadyCondition reports on whether the download of cluster stack release assets is complete.
ClusterStackReleaseAssetsReadyCondition clusterv1beta1.ConditionType = "ClusterStackReleaseDownloaded"
ClusterStackReleaseAssetsReadyCondition clusterv1beta1.ConditionType = "ClusterStackReleaseAssetsReady"

// ReleaseAssetsNotDownloadedYetReason is used when release assets are not yet downloaded.
ReleaseAssetsNotDownloadedYetReason = "ReleaseAssetsNotDownloadedYet"
Expand Down Expand Up @@ -64,8 +64,8 @@ const (
)

const (
// OpenStackImageImportStartCondition reports the image import start.
OpenStackImageImportStartCondition = "OpenStackImageImportStart"
// OpenStackImageImportStartedCondition reports the image import starts.
OpenStackImageImportStartedCondition = "OpenStackImageImportStarted"

// OpenStackImageImportNotStartReason is used when image import does not start yet.
OpenStackImageImportNotStartReason = "OpenStackImageImportNotStartReason"
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/openstackclusterstackrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

// OpenStackClusterStackReleaseSpec defines the desired state of OpenStackClusterStackRelease.
type OpenStackClusterStackReleaseSpec struct {
// The name of the cloud to use from the clouds secret
// CloudName is the name of the cloud to use from the cloud's secret.
CloudName string `json:"cloudName"`
// IdentityRef is a reference to a identity to be used when reconciling this cluster
IdentityRef *apiv1alpha7.OpenStackIdentityReference `json:"identityRef"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/openstacknodeimagerelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

// OpenStackNodeImageReleaseSpec defines the desired state of OpenStackNodeImageRelease.
type OpenStackNodeImageReleaseSpec struct {
// The name of the cloud to use from the clouds secret
// CloudName is the name of the cloud to use from the cloud's secret.
CloudName string `json:"cloudName"`
// IdentityRef is a reference to a identity to be used when reconciling this cluster
IdentityRef *apiv1alpha7.OpenStackIdentityReference `json:"identityRef"`
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/openstacknodeimagerelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (r *OpenStackNodeImageReleaseReconciler) Reconcile(ctx context.Context, req

if imageID == "" {
conditions.MarkFalse(openstacknodeimagerelease, apiv1alpha1.OpenStackImageReadyCondition, apiv1alpha1.OpenStackImageNotCreatedYetReason, clusterv1beta1.ConditionSeverityInfo, "image is not created yet")
conditions.MarkFalse(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartCondition, apiv1alpha1.OpenStackImageImportNotStartReason, clusterv1beta1.ConditionSeverityInfo, "image import not start yet")
conditions.MarkFalse(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartedCondition, apiv1alpha1.OpenStackImageImportNotStartReason, clusterv1beta1.ConditionSeverityInfo, "image import not start yet")
openstacknodeimagerelease.Status.Ready = false

imageCreateOpts := openstacknodeimagerelease.Spec.Image.CreateOpts
Expand Down Expand Up @@ -174,8 +174,8 @@ func (r *OpenStackNodeImageReleaseReconciler) Reconcile(ctx context.Context, req
return ctrl.Result{}, fmt.Errorf("failed to import an image: %w", err)
}

conditions.MarkTrue(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartCondition)
// requeue to make sure that image ID can be find by image name
conditions.MarkTrue(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartedCondition)
// requeue to make sure that image ID can be found via image name
return ctrl.Result{Requeue: true}, nil
}

Expand All @@ -192,9 +192,9 @@ func (r *OpenStackNodeImageReleaseReconciler) Reconcile(ctx context.Context, req
}

// Check wait for image ACTIVE status duration
if r.WaitForImageBecomeActiveMinutes > 0 && conditions.IsTrue(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartCondition) {
if r.WaitForImageBecomeActiveMinutes > 0 && conditions.IsTrue(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartedCondition) {
// Calculate elapsed time since the OpenStackImageImportStartCondition is true
startTime := conditions.GetLastTransitionTime(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartCondition)
startTime := conditions.GetLastTransitionTime(openstacknodeimagerelease, apiv1alpha1.OpenStackImageImportStartedCondition)
elapsedTime := time.Since(startTime.Time)

waitForImageBecomeActiveTimeout := time.Duration(r.WaitForImageBecomeActiveMinutes) * time.Minute
Expand Down

0 comments on commit 63bfb51

Please sign in to comment.