-
Notifications
You must be signed in to change notification settings - Fork 37
[SDK] - Proposal for samples generation via GO and in the SDK repo #47
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
Conversation
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.
A few problems with this PR:
- It mostly follows the EP template, but the
Proposal
section does not in a detrimental manner. Where are the implementation notes/details? - The EP is very light on technical detail. How are code changes to be made, ex. we update part of the reconcile loop? What is a
SampleContext
(there is a good example of one, but no discussion about its semantics in English). - There is no discussion as to how this will be tied into the SDK's release process, which is tangential to the generator's implementation but still relevant to this EP.
Hi @estroz, Really thank you for your time and input. I will ping you when I finish it. |
Hi @estroz, Please, feel free to re-check it. really thank you for your time. |
|
||
## Open Questions | ||
|
||
1. Should not the project has a Memcached GO Sample with webhooks and other without using webhooks since it shows an advanced feature and it used is not mandatory? Note the Go tutorial do not use webhooks. |
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.
Would we be having 2 samples. One for using web hooks with cert-manager (which is already present upstream), and WH implementation with OLM ?
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.
Yes, we would have 2 samples. However, in upstream/kb we have none similar testdata. The idea is we have samples with the steps/implementation suggested to users in the tutorials. The Go Memcached tutorial has none webhooks and we ought to have an advanced tutorial with the additional steps to use webhooks. So, in the end, it would be:
// The Memcached sample without webhooks
// The Memcached sample with webhooks
Note that we can re-use the first sample steps as we will do in the e2e test to build the second one.
Also, both should be integrated with OLM since it is a key feature of the tool.
|
||
### Implementation Details/Notes/Constraints | ||
|
||
- The samples should be build inside of `./testdata/<type>/` path |
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 quick doubt. Im not sure how KB does this. But, if we have different plugins for same type of operator, would we scaffold the project with default plugin version which is set.
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.
At the moment we have only one version of the plugin. To create the samples we use the SDK binary and run the commands at the same way that users will do that. So, in the future, if we wish we can create samples for diff plugins versions since it means operator-sdk --plugins="plugin 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.
@varshaprasad96 @camilamacedo86 I would NOT scaffold out samples with multiple plugins. I would create the samples for our default use case only. And possibly for any complex use cases like we are talking about with webhooks. Honestly I can see 2 samples: 1) default easy peasy project. 2) one with all the options enabled to show the complex features.
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.
@jmrodri it is not in the scope of the EP anyway. However, the stack allows us to do that if we wish in the future. I mean, has no limitation for that if we wish to do that. But I agree 100% with you.
|
||
#### Generate samples via Go | ||
|
||
- I am a maintainer/contributor, I want to be able to troubleshoot the code used to create the samples, so that I can easily fix the issues. |
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.
If we are going to scaffold the operator from scratch and test all the functionalities, then would we be removing the existing e2e tests for go/ansible/helm? I see that you have mentioned e2e tests would invoke this, but wouldn't we be doing the same testing twice if we have both.
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.
Using the samples for the e2e tests is an idea on the table, but when we talked about this initially we thought that the e2e tests should be out of scope for this proposal to keep it from becoming a huge task.
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.
We will not remove the e2e tests. We will just replace the same/identical steps to mock the project by the call. The additional mock data and checks still as it is now.
To call in the e2e test
By("running samples steps")
ctx, err := samplespkg.NewSampleContextWith(&tc)
Expect(err).Should(Succeed())
sample := sampleshelm.NewMemcachedHelm(&ctx)
sample.Run()
See the above example in the EP : https://github.com/operator-framework/enhancements/pull/47/files#diff-3c2574643214da41adcb10b9a5b8bcd2R336-R344:
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Hi @varshaprasad96 and @asmacdo, Really thank you for your review. The typo suggestions are all accepted and the questions raised answered. |
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.
/lgtm
**Description of the change:** - Implementation for we are able to auto generated samples with its utils cleanup - Memcached Helm sample generate (NOTE): The usage of the sample in the e2e tests will be made in a follow-up and are not part of the context of this PR. We need just the e2e tests since the samples have been gen using the chart when in the e2e tests are done with another scenario where no chart is informed. **Motivation for the change:** operator-framework/enhancements#47
**Description of the change:** Add Memcached Ansible sample **Motivation for the change:** operator-framework/enhancements#47
**Description of the change:** Add Memcached Go sample **Motivation for the change:** operator-framework/enhancements#47
**Description of the change:** Use Memcached sample instead of re-generate the project. **Motivation for the change:** operator-framework/enhancements#47
**Description of the change:** - Use Memcached sample instead of re-generate the project. - Fix/Adjust the e2e tests to work with the sample. **Motivation for the change:** operator-framework/enhancements#47
**Description of the change:** Use Memcached sample instead of re-generate the project. **Motivation for the change:** operator-framework/enhancements#47 Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
**Description of the change:** - Use Memcached sample instead of re-generate the project. - Fix/Adjust the e2e tests to work with the sample. **Motivation for the change:** operator-framework/enhancements#47 Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
NOTE: It has images and code example, so I'd suggest doing the review by seen the preview