-
Notifications
You must be signed in to change notification settings - Fork 3
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: add support for Argo Rollouts resource #166
Conversation
d25b0ad
to
fa28ec9
Compare
Pull Request Test Coverage Report for Build 5904758774
💛 - Coveralls |
e43a79f
to
d1c044a
Compare
@@ -0,0 +1,3630 @@ | |||
apiVersion: apiextensions.k8s.io/v1 | |||
kind: CustomResourceDefinition |
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 wasn't sure how to add this CRD via kustomize. Wondering if there was a way to autogenerate this into bases folder?
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.
This directory is managed by the operator code and should only ever have auto-generated code. I believe you want to modify the test framework itself: https://v0-18-x.sdk.operatorframework.io/docs/golang/unit-testing/#testing-with-3rd-party-resources
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 tried to write test to create a Rollout object and then create a PodAccessTemplate pointing to the Rollout and PodAccessRequest.
failed to get API group resources: unable to retrieve the complete list of server APIs: argoproj.io/v1alpha1: the server could not find the requested resource
I read through the docs for this and tried to apply this but it seems that the cluster itself does not know what a Rollout object is when the client attempts to create it.
A workaround was to manually add the crd to the crd base path or maybe add the crd through a e2e test suite ?
https://github.com/diranged/oz/blob/main/internal/builders/podaccessbuilder/suite_test.go#L62.
I wasnt sure if theres other options ?
@@ -0,0 +1,3630 @@ | |||
apiVersion: apiextensions.k8s.io/v1 | |||
kind: CustomResourceDefinition |
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.
This directory is managed by the operator code and should only ever have auto-generated code. I believe you want to modify the test framework itself: https://v0-18-x.sdk.operatorframework.io/docs/golang/unit-testing/#testing-with-3rd-party-resources
d1c044a
to
b222805
Compare
@dnguy078 Can you add tests? |
Not necessarily, this would require using Go's old vendoring folder and referencing the crd yaml file through there. This implies that crd.yaml is placed in a folder that has an exportable go package. Argo Rollout places their crds into a folder that has no go files https://github.com/argoproj/argo-rollouts/tree/master/manifests so we can't simply vendor this in as well. |
7a4a1d9
to
7e19a25
Compare
I ended up using I ended up using a mixture the approach of adding the CRD into the envtest.Environment in https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/using_an_external_type.md#prepare-for-testing. Unable to find much documentations on standards to test with third party operators beyond this. also referenced. It would be nice if operators exposed a CustomResourceDefinition struct like this. |
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.
one comment, then i think it looks good
var err error | ||
|
||
// grab go mod directory with Argo rollout CRD to be installed into test environment cluster | ||
argoCRDPath, err := extractCRDPath("github.com/argoproj/argo-rollouts", "manifests/crds") |
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.
Let's add this direectory to .gitignore
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.
this directory is outside of the repo project and its installed as part of the $GOPATH/pkg
via the go mod
@diranged
No description provided.