Skip to content
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

feat: check pre-requisites on OSSM plugin init #7

Merged
merged 18 commits into from
Aug 8, 2023

Conversation

cam-garrison
Copy link

  • Checks that the authorino and SMCP CRDs are installed on the cluster before proceeding with plugin installation
  • Checks that the SMCP referenced in the plugin spec exists and is ready before proceeding
  • Adds rudimentary testing for the relevant functions that do the heavy lifting in these checks

Creating tests was a bit difficult for the SMCP specifically - please let me know if you see any ways that that process of simulating an SMCP install can be improved.

@cam-garrison
Copy link
Author

Also, I added the latest SMCP entire CRD - let me know if I should add a truncated one instead.

Copy link

@bartoszmajsak bartoszmajsak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! I added a few suggestions, but overall it's solid.

Comment on lines 218 to 219
// CreateSMCP uses dynamic client to create a dummy SMCP for testing
func (o *OssmInstaller) CreateSMCP(namespace string, smcpObj *unstructured.Unstructured) error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move it to test code as it's only used for testing purposes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

68bb271 done here

pkg/kfapp/ossm/ossm_installer.go Outdated Show resolved Hide resolved
err := ossmInstaller.CheckForCRD(crdGroup, crdVersion, crdResource)

// then
Expect(err).To(HaveOccurred())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be worth being more specific and also check for message or parts of it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, added here 06de003

tests/integration/ossm_installer_int_test.go Outdated Show resolved Hide resolved
pkg/kfapp/ossm/ossm_installer.go Outdated Show resolved Hide resolved
pkg/kfapp/ossm/k8s_resources.go Outdated Show resolved Hide resolved
pkg/kfapp/ossm/k8s_resources.go Show resolved Hide resolved
pkg/kfapp/ossm/k8s_resources.go Outdated Show resolved Hide resolved
pkg/kfapp/ossm/k8s_resources.go Outdated Show resolved Hide resolved
tests/integration/ossm_installer_int_test.go Outdated Show resolved Hide resolved
@bartoszmajsak
Copy link

Also, I added the latest SMCP entire CRD - let me know if I should add a truncated one instead.

In odh-project-controller, we fetch it as part of generate target. Something to consider.

@cam-garrison
Copy link
Author

I took a look at how CRDs are fetched for project-controller - thanks for linking that. Since I want to get the Dashboard Config patching fixed today I've created another issue to handle this in the future here. PTAL and let me know if that's ok.

Copy link

@bartoszmajsak bartoszmajsak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing and we are good to go :)

pkg/kfapp/ossm/k8s_resources.go Show resolved Hide resolved
pkg/kfapp/ossm/ossm_installer.go Outdated Show resolved Hide resolved
tests/integration/ossm_installer_int_test.go Outdated Show resolved Hide resolved
@cam-garrison cam-garrison merged commit f84e4d3 into kf_ossm_plugin Aug 8, 2023
@cam-garrison cam-garrison deleted the check-pre-reqs branch August 8, 2023 17:06
bartoszmajsak added a commit that referenced this pull request Sep 6, 2023
* add prereq checks to init, add tests
---------

Co-authored-by: Bartosz Majsak <[email protected]>
bartoszmajsak added a commit that referenced this pull request Sep 6, 2023
* add prereq checks to init, add tests
---------

Co-authored-by: Bartosz Majsak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants