Skip to content

Commit 20ab5c6

Browse files
authored
fix(api): make user-facing condition messages clearer (#2558)
Status conditions on virtualization resources sometimes described a problem in terms the user cannot see or act on — launcher and migration pods, storage volume claims, internal virtualization objects, image-registry internals — or used awkward, sometimes ungrammatical wording. This reworks the .status.conditions[].message texts across VirtualMachine, VirtualMachineBlockDeviceAttachment, VirtualDisk, VirtualImage, ClusterVirtualImage, VirtualDiskSnapshot and VirtualMachineSnapshot so each message describes the current state in terms of the resources a user actually works with. Only the message wording changes. Condition types, reasons, statuses and all reconcile behaviour stay the same. This PR covers the text-only changes; messages that still relay a raw internal error will be cleaned up separately. --------- Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
1 parent 98b1f02 commit 20ab5c6

65 files changed

Lines changed: 189 additions & 190 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

images/virtualization-artifact/pkg/controller/cvi/internal/image_presence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (h *ImagePresenceHandler) Handle(ctx context.Context, cvi *v1alpha2.Cluster
6161
Generation(cvi.Generation).
6262
Status(metav1.ConditionFalse).
6363
Reason(cvicondition.ImageLost).
64-
Message(fmt.Sprintf("Image %q not found in DVCR.", registryURL))
64+
Message("The image data is no longer available and needs to be recreated.")
6565

6666
conditions.SetCondition(cb, &cvi.Status.Conditions)
6767
}

images/virtualization-artifact/pkg/controller/cvi/internal/source/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (ds HTTPDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirtualI
136136
cvi.Status.Phase = v1alpha2.ImageProvisioning
137137
cb.Status(metav1.ConditionFalse).
138138
Reason(cvicondition.Provisioning).
139-
Message("DVCR Provisioner not found: create the new one.")
139+
Message("Preparing to import the image.")
140140

141141
log.Info("Create importer pod...", "progress", cvi.Status.Progress, "pod.phase", "nil")
142142

@@ -207,7 +207,7 @@ func (ds HTTPDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirtualI
207207

208208
cb.Status(metav1.ConditionFalse).
209209
Reason(cvicondition.Provisioning).
210-
Message("Import is in the process of provisioning to DVCR.")
210+
Message("The image is being imported.")
211211

212212
cvi.Status.Phase = v1alpha2.ImageProvisioning
213213
cvi.Status.Progress = ds.statService.GetProgress(cvi.GetUID(), pod, cvi.Status.Progress)

images/virtualization-artifact/pkg/controller/cvi/internal/source/object_ref.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (ds ObjectRefDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVir
205205
cb.
206206
Status(metav1.ConditionFalse).
207207
Reason(cvicondition.Provisioning).
208-
Message("DVCR Provisioner not found: create the new one.")
208+
Message("Preparing to import the image.")
209209

210210
log.Info("Ready", "progress", cvi.Status.Progress, "pod.phase", "nil")
211211

@@ -245,7 +245,7 @@ func (ds ObjectRefDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVir
245245
cb.
246246
Status(metav1.ConditionFalse).
247247
Reason(cvicondition.ProvisioningFailed).
248-
Message("Failed to get stats from non-ready datasource: waiting for the DataSource to be ready.")
248+
Message("Waiting for the source data to become ready.")
249249
return reconcile.Result{}, nil
250250
}
251251

@@ -283,7 +283,7 @@ func (ds ObjectRefDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVir
283283
cb.
284284
Status(metav1.ConditionFalse).
285285
Reason(cvicondition.Provisioning).
286-
Message("Import is in the process of provisioning to DVCR.")
286+
Message("The image is being imported.")
287287

288288
cvi.Status.Phase = v1alpha2.ImageProvisioning
289289
cvi.Status.Target.RegistryURL = ds.statService.GetDVCRImageName(pod)

images/virtualization-artifact/pkg/controller/cvi/internal/source/object_ref_vd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (ds ObjectRefVirtualDisk) Sync(ctx context.Context, cvi *v1alpha2.ClusterVi
136136
cb.
137137
Status(metav1.ConditionFalse).
138138
Reason(cvicondition.Provisioning).
139-
Message("DVCR Provisioner not found: create the new one.")
139+
Message("Preparing to import the image.")
140140

141141
log.Info("Create importer pod...", "progress", cvi.Status.Progress, "pod.phase", "nil")
142142

@@ -204,7 +204,7 @@ func (ds ObjectRefVirtualDisk) Sync(ctx context.Context, cvi *v1alpha2.ClusterVi
204204
cb.
205205
Status(metav1.ConditionFalse).
206206
Reason(cvicondition.Provisioning).
207-
Message("Import is in the process of provisioning to DVCR.")
207+
Message("The image is being imported.")
208208

209209
cvi.Status.Phase = v1alpha2.ImageProvisioning
210210
cvi.Status.Progress = ds.statService.GetProgress(cvi.GetUID(), pod, cvi.Status.Progress)

images/virtualization-artifact/pkg/controller/cvi/internal/source/object_ref_vdsnapshot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (ds ObjectRefVirtualDiskSnapshot) Sync(ctx context.Context, cvi *v1alpha2.C
196196
cb.
197197
Status(metav1.ConditionFalse).
198198
Reason(vicondition.Provisioning).
199-
Message("PVC has created: waiting to be Bound.")
199+
Message("Restoring data from the snapshot. Waiting for the PersistentVolumeClaim to be Bound.")
200200

201201
cvi.Status.Progress = "0%"
202202
cvi.Status.SourceUID = ptr.To(vs.UID)
@@ -226,7 +226,7 @@ func (ds ObjectRefVirtualDiskSnapshot) Sync(ctx context.Context, cvi *v1alpha2.C
226226
cb.
227227
Status(metav1.ConditionFalse).
228228
Reason(vicondition.Provisioning).
229-
Message("DVCR Provisioner not found: create the new one.")
229+
Message("Preparing to import the image.")
230230

231231
log.Info("Create importer pod...", "progress", cvi.Status.Progress, "pod.phase", "nil")
232232

@@ -274,7 +274,7 @@ func (ds ObjectRefVirtualDiskSnapshot) Sync(ctx context.Context, cvi *v1alpha2.C
274274
cb.
275275
Status(metav1.ConditionFalse).
276276
Reason(vicondition.Provisioning).
277-
Message("Waiting for PVC to be bound")
277+
Message("Restoring data from the snapshot. Waiting for the PersistentVolumeClaim to be Bound.")
278278

279279
return reconcile.Result{RequeueAfter: time.Second}, nil
280280
}
@@ -304,7 +304,7 @@ func (ds ObjectRefVirtualDiskSnapshot) Sync(ctx context.Context, cvi *v1alpha2.C
304304
cb.
305305
Status(metav1.ConditionFalse).
306306
Reason(vicondition.Provisioning).
307-
Message("Import is in the process of provisioning to DVCR.")
307+
Message("The image is being imported.")
308308

309309
cvi.Status.Phase = v1alpha2.ImageProvisioning
310310
cvi.Status.Progress = ds.statService.GetProgress(cvi.GetUID(), pod, cvi.Status.Progress)

images/virtualization-artifact/pkg/controller/cvi/internal/source/object_ref_vi_on_pvc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (ds ObjectRefVirtualImageOnPvc) Sync(ctx context.Context, cvi *v1alpha2.Clu
125125
cb.
126126
Status(metav1.ConditionFalse).
127127
Reason(cvicondition.Provisioning).
128-
Message("DVCR Provisioner not found: create the new one.")
128+
Message("Preparing to import the image.")
129129

130130
log.Info("Create importer pod...", "progress", cvi.Status.Progress, "pod.phase", "nil")
131131

@@ -193,7 +193,7 @@ func (ds ObjectRefVirtualImageOnPvc) Sync(ctx context.Context, cvi *v1alpha2.Clu
193193
cb.
194194
Status(metav1.ConditionFalse).
195195
Reason(cvicondition.Provisioning).
196-
Message("Import is in the process of provisioning to DVCR.")
196+
Message("The image is being imported.")
197197

198198
cvi.Status.Phase = v1alpha2.ImageProvisioning
199199
cvi.Status.Progress = ds.statService.GetProgress(cvi.GetUID(), pod, cvi.Status.Progress)

images/virtualization-artifact/pkg/controller/cvi/internal/source/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (ds RegistryDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirt
142142
cb.
143143
Status(metav1.ConditionFalse).
144144
Reason(cvicondition.Provisioning).
145-
Message("DVCR Provisioner not found: create the new one.")
145+
Message("Preparing to import the image.")
146146

147147
log.Info("Create importer pod...", "progress", cvi.Status.Progress, "pod.phase", "nil")
148148

@@ -212,7 +212,7 @@ func (ds RegistryDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirt
212212
cb.
213213
Status(metav1.ConditionFalse).
214214
Reason(cvicondition.Provisioning).
215-
Message("Import is in the process of provisioning to DVCR.")
215+
Message("The image is being imported.")
216216

217217
cvi.Status.Phase = v1alpha2.ImageProvisioning
218218
cvi.Status.Progress = "0%"

images/virtualization-artifact/pkg/controller/cvi/internal/source/upload.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (ds UploadDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirtua
167167
cb.
168168
Status(metav1.ConditionFalse).
169169
Reason(cvicondition.Provisioning).
170-
Message("DVCR Provisioner not found: create the new one.")
170+
Message("Preparing to import the image.")
171171

172172
log.Info("Create uploader pod...", "progress", cvi.Status.Progress, "pod.phase", nil)
173173

@@ -238,7 +238,7 @@ func (ds UploadDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirtua
238238
cb.
239239
Status(metav1.ConditionFalse).
240240
Reason(cvicondition.Provisioning).
241-
Message("Import is in the process of provisioning to DVCR.")
241+
Message("The image is being imported.")
242242

243243
cvi.Status.Phase = v1alpha2.ImageProvisioning
244244
cvi.Status.Progress = ds.statService.GetProgress(cvi.GetUID(), pod, cvi.Status.Progress)
@@ -255,7 +255,7 @@ func (ds UploadDataSource) Sync(ctx context.Context, cvi *v1alpha2.ClusterVirtua
255255
cb.
256256
Status(metav1.ConditionFalse).
257257
Reason(cvicondition.WaitForUserUpload).
258-
Message("Waiting for the user upload.")
258+
Message("Waiting for the user to upload image data.")
259259

260260
cvi.Status.Phase = v1alpha2.ImageWaitForUserUpload
261261
cvi.Status.Target.RegistryURL = ds.statService.GetDVCRImageName(pod)

images/virtualization-artifact/pkg/controller/dvcr-garbage-collection/postponeimporter/postpone_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (p *PostponeHandler[T]) Handle(ctx context.Context, obj T) (reconcile.Resul
102102
cb := conditions.NewConditionBuilder(getReadyType(obj)).Generation(obj.GetGeneration())
103103
cb.Status(metav1.ConditionFalse).
104104
Reason(ProvisioningPostponedReason).
105-
Message("DVCR is in garbage collection mode: wait until it finishes before creating provisioner.")
105+
Message("DVCR is performing garbage collection. The operation is postponed and will continue automatically once it completes.")
106106
conditions.SetCondition(cb, conditions.NewConditionsAccessor(obj).Conditions())
107107
}
108108
// Garbage collection enabled and resources are postponed: requeue to check garbage collection status later.

images/virtualization-artifact/pkg/controller/nodeusbdevice/internal/handler/attached.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (h *AttachedHandler) Handle(ctx context.Context, s state.NodeUSBDeviceState
7979

8080
attachedCondition := meta.FindStatusCondition(usbDevice.Status.Conditions, string(usbdevicecondition.AttachedType))
8181
if attachedCondition == nil {
82-
setAttachedCondition(current, &changed.Status.Conditions, metav1.ConditionFalse, nodeusbdevicecondition.AttachedAvailable, fmt.Sprintf("Attached condition not found in USBDevice %s/%s.", usbDevice.Namespace, usbDevice.Name))
82+
setAttachedCondition(current, &changed.Status.Conditions, metav1.ConditionFalse, nodeusbdevicecondition.AttachedAvailable, fmt.Sprintf("Waiting for the attachment status of USBDevice %s/%s.", usbDevice.Namespace, usbDevice.Name))
8383
return reconcile.Result{}, nil
8484
}
8585

0 commit comments

Comments
 (0)