Skip to content

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Sep 4, 2020

NOTE: It has images and code example, so I'd suggest doing the review by seen the preview

Copy link
Member

@estroz estroz left a 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:

  1. It mostly follows the EP template, but the Proposal section does not in a detrimental manner. Where are the implementation notes/details?
  2. 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).
  3. 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.

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Sep 5, 2020

Hi @estroz,

Really thank you for your time and input. I will ping you when I finish it.

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Sep 5, 2020

Hi @estroz,

Please, feel free to re-check it. really thank you for your time.

@camilamacedo86 camilamacedo86 changed the title Proposal for samples generation via GO and in the SDK repo [SDK] - Proposal for samples generation via GO and in the SDK repo Sep 6, 2020
@camilamacedo86 camilamacedo86 changed the title [SDK] - Proposal for samples generation via GO and in the SDK repo WIP : [SDK] - Proposal for samples generation via GO and in the SDK repo Sep 11, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 11, 2020
@camilamacedo86 camilamacedo86 changed the title WIP : [SDK] - Proposal for samples generation via GO and in the SDK repo [SDK] - Proposal for samples generation via GO and in the SDK repo Sep 15, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2020

## 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.
Copy link
Member

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 ?

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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"

Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link
Member

@varshaprasad96 varshaprasad96 Oct 1, 2020

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.

Copy link
Member

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.

Copy link
Contributor Author

@camilamacedo86 camilamacedo86 Oct 2, 2020

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:

camilamacedo86 and others added 4 commits October 2, 2020 15:14
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>
camilamacedo86 and others added 3 commits October 2, 2020 15:15
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
Co-authored-by: Austin Macdonald <austin@redhat.com>
@camilamacedo86
Copy link
Contributor Author

Hi @varshaprasad96 and @asmacdo,

Really thank you for your review. The typo suggestions are all accepted and the questions raised answered.
Please, let me know if you have anything else that could be addressed here for we get it merged.

Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 2, 2020
@jmrodri jmrodri merged commit 43d07a4 into operator-framework:master Oct 2, 2020
@camilamacedo86 camilamacedo86 deleted the samples branch October 2, 2020 18:29
camilamacedo86 added a commit to operator-framework/operator-sdk that referenced this pull request Oct 2, 2020
**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
camilamacedo86 added a commit to operator-framework/operator-sdk that referenced this pull request Oct 7, 2020
**Description of the change:**
Add Memcached Ansible sample

**Motivation for the change:**
operator-framework/enhancements#47
camilamacedo86 added a commit to operator-framework/operator-sdk that referenced this pull request Oct 7, 2020
**Description of the change:**
Add Memcached Go sample

**Motivation for the change:**

operator-framework/enhancements#47
camilamacedo86 added a commit to operator-framework/operator-sdk that referenced this pull request Nov 5, 2020
**Description of the change:**
 Use Memcached sample instead of re-generate the project.

**Motivation for the change:**

operator-framework/enhancements#47
camilamacedo86 added a commit to operator-framework/operator-sdk that referenced this pull request Dec 8, 2020
**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
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
**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>
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
**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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants