-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use appropriate CRD API during readiness check #4015
Use appropriate CRD API during readiness check #4015
Conversation
753d1ba
to
5f0cd04
Compare
The readiness check for the Velero CRDs was still using the v1beta1 API. This would cause the readiness check to fail on 1.22 clusters as the v1beta1 API is no longer available. Previously, this error would be ignored and the installation would proceed, however with vmware-tanzu#4002, we are no longer ignoring errors from this check. This change modifies the CRD readiness check to check the CRDs using the same API version that was used when submitting the CRDs to the cluster. It also introduces a new CRD builder using the V1 API for testing. This change also fixes a bug that was identified in the polling code where if the CRDs were not ready on the first polling iteration, they would be added again to the list of CRDs to check resulting in duplicates. This would cause the length check to fail on all subsequent polls and the timeout would always be reached. Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
5f0cd04
to
ee9d63b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor comment on something in code comments before a func. Not a merge blocker, but the update would make things a bit clearer.
pkg/util/kube/utils.go
Outdated
@@ -161,8 +177,8 @@ func IsCRDReady(crd *apiextv1beta1.CustomResourceDefinition) bool { | |||
} | |||
|
|||
// IsUnstructuredCRDReady checks an unstructured CRD to see if it's ready, with both the Established and NamesAccepted conditions. | |||
// TODO: Delete this function and use IsCRDReady when the upstream runtime.FromUnstructured function properly handles int64 field conversions. | |||
// Duplicated function because the velero install package uses IsCRDReady with the beta types. | |||
// TODO: Delete this function and use Isv1beta1CRDReady when the upstream runtime.FromUnstructured function properly handles int64 field conversions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The restore code which uses IsUnstructuredCRDReady doesn't really need to deal with v1/v1beta1 issues right now. I'm guessing that by the time this code is refectored (if it is ever refactored) we'll no longer be supporting v1beta1, so the above (and below) lines should probably reference IsV1CRDReady
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that was a find/replace gone wrong :) I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked yesterday, and the upstream fix is available in the v0.20.0 version of the API libraries. Once we upgrade those, a unit test which checks for the upstream error will fail which might encourage the refactoring at that stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. OK. If we choose to do that soon we'll need to deal with v1 vs v1beta1 issues in the refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the comment, but I think there is quite a bit of history surrounding this issue which I'm not fully aware of. Let me know what you think and I can change it again if you think it could be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fine. The issue was that the typed checks were failing with CRDs which included int64 fields. Velero CRDs don't use those, so the installer wasn't hitting the problem, but restoring backups which included CRDs with these fields was failing. The workaround was to use the unstructured fields. I don't know whether it really matters enough at this point to go back and refactor the restore CRD ready checks to use the v1/v1beta1 functions, but if we do we just need to make sure that the int64 issue is gone by testing backup/restore with a CRD which uses this sort of field.
Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
* Use appropriate CRD API during readiness check The readiness check for the Velero CRDs was still using the v1beta1 API. This would cause the readiness check to fail on 1.22 clusters as the v1beta1 API is no longer available. Previously, this error would be ignored and the installation would proceed, however with vmware-tanzu#4002, we are no longer ignoring errors from this check. This change modifies the CRD readiness check to check the CRDs using the same API version that was used when submitting the CRDs to the cluster. It also introduces a new CRD builder using the V1 API for testing. This change also fixes a bug that was identified in the polling code where if the CRDs were not ready on the first polling iteration, they would be added again to the list of CRDs to check resulting in duplicates. This would cause the length check to fail on all subsequent polls and the timeout would always be reached. Signed-off-by: Bridget McErlean <bmcerlean@vmware.com> * Remove duplicate V1 CRD builder and update comment Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
* Use appropriate CRD API during readiness check (#4015) * Use appropriate CRD API during readiness check The readiness check for the Velero CRDs was still using the v1beta1 API. This would cause the readiness check to fail on 1.22 clusters as the v1beta1 API is no longer available. Previously, this error would be ignored and the installation would proceed, however with #4002, we are no longer ignoring errors from this check. This change modifies the CRD readiness check to check the CRDs using the same API version that was used when submitting the CRDs to the cluster. It also introduces a new CRD builder using the V1 API for testing. This change also fixes a bug that was identified in the polling code where if the CRDs were not ready on the first polling iteration, they would be added again to the list of CRDs to check resulting in duplicates. This would cause the length check to fail on all subsequent polls and the timeout would always be reached. Signed-off-by: Bridget McErlean <bmcerlean@vmware.com> * Remove duplicate V1 CRD builder and update comment Signed-off-by: Bridget McErlean <bmcerlean@vmware.com> * Merge pull request #4012 from jenting/add-k8s-1.22-ci-test Add Kubernetes v1.22 CI test * Update changelog for v1.6.3 Signed-off-by: Bridget McErlean <bmcerlean@vmware.com> Co-authored-by: Scott Seago <sseago@redhat.com>
* Use appropriate CRD API during readiness check The readiness check for the Velero CRDs was still using the v1beta1 API. This would cause the readiness check to fail on 1.22 clusters as the v1beta1 API is no longer available. Previously, this error would be ignored and the installation would proceed, however with vmware-tanzu#4002, we are no longer ignoring errors from this check. This change modifies the CRD readiness check to check the CRDs using the same API version that was used when submitting the CRDs to the cluster. It also introduces a new CRD builder using the V1 API for testing. This change also fixes a bug that was identified in the polling code where if the CRDs were not ready on the first polling iteration, they would be added again to the list of CRDs to check resulting in duplicates. This would cause the length check to fail on all subsequent polls and the timeout would always be reached. Signed-off-by: Bridget McErlean <bmcerlean@vmware.com> * Remove duplicate V1 CRD builder and update comment Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
Please add a summary of your change
The readiness check for the Velero CRDs was still using the v1beta1 API.
This would cause the readiness check to fail on 1.22 clusters as the
v1beta1 API is no longer available. Previously, this error would be
ignored and the installation would proceed, however with #4002, we are
no longer ignoring errors from this check.
This change modifies the CRD readiness check to check the CRDs using the
same API version that was used when submitting the CRDs to the cluster.
It also introduces a new CRD builder using the V1 API for testing.
This change also fixes a bug that was identified in the polling code
where if the CRDs were not ready on the first polling iteration, they
would be added again to the list of CRDs to check resulting in
duplicates. This would cause the length check to fail on all subsequent
polls and the timeout would always be reached.
Signed-off-by: Bridget McErlean bmcerlean@vmware.com
Please indicate you've done the following:
/kind changelog-not-required
.site/content/docs/main
.