|
| 1 | +# CDIDataImportCronOutdated |
| 2 | + |
| 3 | +## Meaning |
| 4 | + |
| 5 | +This alert fires when `DataImportCron` cannot poll or import the latest disk |
| 6 | +image versions. |
| 7 | + |
| 8 | +`DataImportCron` polls disk images, checking for the latest versions, and |
| 9 | +imports the images into persistent volume claims (PVCs) or VolumeSnapshots. This |
| 10 | +process ensures that these sources are updated to the latest version so that |
| 11 | +they can be used as reliable clone sources or golden images for virtual machines |
| 12 | +(VMs). |
| 13 | + |
| 14 | +For golden images, _latest_ refers to the latest operating system of the |
| 15 | +distribution. For other disk images, _latest_ refers to the latest hash of the |
| 16 | +image that is available. |
| 17 | + |
| 18 | +**Note:** If the status of a `DataImportCron` PVC is `Pending` because there is no |
| 19 | +default storage class, the `CDIDataImportCronOutdated` alert is suppressed and the |
| 20 | +`CDINoDefaultStorageClass` alert is triggered. |
| 21 | + |
| 22 | +## Impact |
| 23 | + |
| 24 | +VMs might be created from outdated disk images. |
| 25 | + |
| 26 | +VMs might fail to start because no boot source is available for cloning. |
| 27 | + |
| 28 | +## Diagnosis |
| 29 | + |
| 30 | +1. Check the cluster for a default Kubernetes storage class: |
| 31 | + ```bash |
| 32 | + $ kubectl get sc -o jsonpath='{.items[?(.metadata.annotations.storageclass\.kubernetes\.io\/is-default-class=="true")].metadata.name}' |
| 33 | + ``` |
| 34 | + |
| 35 | + Check the cluster for a default virtualization storage class: |
| 36 | + ```bash |
| 37 | + $ kubectl get sc -o jsonpath='{.items[?(.metadata.annotations.storageclass\.kubevirt\.io\/is-default-virt-class=="true")].metadata.name}' |
| 38 | + ``` |
| 39 | + |
| 40 | + The output displays the default (Kubernetes and/or virtualization) storage |
| 41 | + class. You must either set a default storage class on the cluster, or ask for |
| 42 | + a specific storage class in the `DataImportCron` specification, in order for |
| 43 | + the `DataImportCron` to poll and import golden images. If the default |
| 44 | + storage class does not exist, the created import DataVolume and PVC will be |
| 45 | + in `Pending` phase. |
| 46 | + |
| 47 | +2. List the `DataImportCron` objects that are not up-to-date: |
| 48 | + |
| 49 | + ```bash |
| 50 | + $ kubectl get dataimportcron -A -o jsonpath='{range .items[*]}{.status.conditions[?(@.type=="UpToDate")].status}{"\t"}{.metadata.namespace}{"/"}{.metadata.name}{"\n"}{end}' | grep False |
| 51 | + ``` |
| 52 | + |
| 53 | +3. If a default storage class is not defined on the cluster, check the |
| 54 | +`DataImportCron` specification for a `DataVolume` template storage class: |
| 55 | + |
| 56 | + ```bash |
| 57 | + $ kubectl -n <namespace> get dataimportcron <dataimportcron> -o jsonpath='{.spec.template.spec.storage.storageClassName}{"\n"}' |
| 58 | + ``` |
| 59 | + |
| 60 | +4. Obtain the name of the `DataVolume` associated with the `DataImportCron` |
| 61 | +object: |
| 62 | + |
| 63 | + ```bash |
| 64 | + $ kubectl -n <namespace> get dataimportcron <dataimportcron> -o jsonpath='{.status.lastImportedPVC.name}{"\n"}' |
| 65 | + ``` |
| 66 | + |
| 67 | +5. Check the `DataVolume` status: |
| 68 | + |
| 69 | + ```bash |
| 70 | + $ kubectl -n <namespace> get dv <datavolume> -o jsonpath-as-json='{.status}' |
| 71 | + ``` |
| 72 | + |
| 73 | +6. Set the `CDI_NAMESPACE` environment variable: |
| 74 | + |
| 75 | + ```bash |
| 76 | + $ export CDI_NAMESPACE="$(kubectl get deployment -A -o jsonpath='{.items[?(.metadata.name=="cdi-operator")].metadata.namespace}')" |
| 77 | + ``` |
| 78 | + |
| 79 | +7. Check the `cdi-deployment` log for error messages: |
| 80 | + |
| 81 | + ```bash |
| 82 | + $ kubectl logs -n $CDI_NAMESPACE deployment/cdi-deployment |
| 83 | + ``` |
| 84 | + |
| 85 | +## Mitigation |
| 86 | + |
| 87 | +1. Set a default storage class, either on the cluster or in the `DataImportCron` |
| 88 | +specification, to poll and import golden images. The updated Containerized Data |
| 89 | +Importer (CDI) should resolve the issue within a few seconds. |
| 90 | + |
| 91 | +2. If the issue does not resolve itself, or, if you have changed the default |
| 92 | +storage class in the cluster, you must delete the existing boot sources |
| 93 | +(data volumes or volume snapshots) in the cluster namespace that are configured |
| 94 | +with the previous default storage class. The CDI will recreate the data volumes |
| 95 | +with the newly configured default storage class. |
| 96 | + |
| 97 | +3. If your cluster is installed in a restricted network environment, disable the |
| 98 | +`enableCommonBootImageImport` feature gate in order to opt out of automatic |
| 99 | +updates: |
| 100 | + |
| 101 | + ```bash |
| 102 | + $ kubectl patch hco kubevirt-hyperconverged -n $CDI_NAMESPACE --type json -p '[{"op": "replace", "path": "/spec/featureGates/enableCommonBootImageImport", "value": false}]' |
| 103 | + ``` |
| 104 | + |
| 105 | +<!--DS: If you cannot resolve the issue, log in to the |
| 106 | +link:https://access.redhat.com[Customer Portal] and open a support case, |
| 107 | +attaching the artifacts gathered during the diagnosis procedure.--> |
| 108 | +<!--USstart--> |
| 109 | +See the [HCO cluster configuration documentation](https://github.com/kubevirt/hyperconverged-cluster-operator/blob/main/docs/cluster-configuration.md#enablecommonbootimageimport-feature-gate) |
| 110 | +for more information. |
| 111 | + |
| 112 | +If you cannot resolve the issue, see the following resources: |
| 113 | + |
| 114 | +- [OKD Help](https://okd.io/docs/community/help/) |
| 115 | +- [#virtualization Slack channel](https://kubernetes.slack.com/channels/virtualization) |
| 116 | +<!--USend--> |
0 commit comments