-
Notifications
You must be signed in to change notification settings - Fork 102
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
Verify that the api-server serves the correct CRDs that this client expects #1664
Conversation
…xpects Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> # Conflicts: # pkg/kudoctl/kudoinit/crd/crds.go
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
# Conflicts: # pkg/kudoctl/util/kudo/kudo_test.go
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 left a few nits so PTAL but otherwise LGTM 🚢
@@ -102,6 +91,20 @@ func NewClientFromK8s(kudo versioned.Interface, kube kubernetes.Interface) *Clie | |||
return &result | |||
} | |||
|
|||
func (c *Client) VerifyServedCRDs(kubeClient *kube.Client) error { | |||
result := verifier.NewResult() | |||
err := crd.NewInitializer().VerifyServedVersion(kubeClient, v1beta1.SchemeGroupVersion.Version, &result) |
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 v1beta1.SchemeGroupVersion.Version
parameter sort of hard-codes support for the v1beta1
version. Once we introduce a new version, we should not forget to update this method with the check with the new version?
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.
Yeah, that's true. Sadly there's no way to get the GV from the generated client - that would make it a bit easier.
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann aneumann@mesosphere.com
What this PR does / why we need it:
When planning the structured parameters, I thought about client/api-server compatibility.
The CLI currently checks if the CRDs are correctly installed, which is not really what we want - we want to make sure that the API server understands the CRD version that we speak. This PR ensures this behaviour.
This PR:
version
field of the CRDs and uses the newversions
field.crdInitializer.verifyInstallation
now verifies that the installed CRD is the same as this CLI would installcrdInitializer.verifyServedVersion
that ensures that the k8s api-server understands the CRD version that we use to read/write our O, OV and I resources. This func is used when we initialise our kudo client.If the API server does not server the CRD version that we support, the user has to update the CLI version.
Fixes #