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

Operator Skeleton Generators #1222

Merged
merged 24 commits into from
Jan 7, 2020
Merged

Operator Skeleton Generators #1222

merged 24 commits into from
Jan 7, 2020

Conversation

kensipe
Copy link
Member

@kensipe kensipe commented Dec 23, 2019

What this PR does / why we need it:

This PR provides skeleton generation for operator developers with the following capabilities.

Previously implemented but likely modified.
kudo package new foo -> creates a new operator from a relative location to the command. The default is to create an "operator" folder with operator and params files for an operator named foo.
kudo package new -i foo -> goes into interactive mode to create an operator, allowing for user input to the creation of the operator metadata.

This PR provides:

  • kudo package add maintainer which adds maintainers to the operator
  • kudo package add task which adds tasks and creates resources. It also guides the creation of pipe tasks.
  • kudo package add plan which adds plans, phases, steps and tasks to the operator.
  • kudo package add parameter which adds params to the params.yaml file.

Fixes #1087
Fixes #1081
Fixes #1083
Fixes #1084

@kensipe
Copy link
Member Author

kensipe commented Dec 23, 2019

needs testing but otherwise good to go!

@alenkacz
Copy link
Contributor

I watched the video for now https://drive.google.com/open?id=1R5flVq_rHBv3KipwqWOVDsISegmsLTsB I need to think about the feel of creating tree structure like plans/phases/tasks from CLI because it felt a bit hard to follow... I like that it tells you what are the options but other than that I find working directly with YAML a bit better.

@zen-dog
Copy link
Contributor

zen-dog commented Dec 30, 2019

I watched the video for now https://drive.google.com/open?id=1R5flVq_rHBv3KipwqWOVDsISegmsLTsB

First of all, nice video! 👏 I wish we would make more videos like this and post them on our blog. However, you could see that a purely CLI tool for generating nested plan/phase/step/task structures has limited usefulness - if I wouldn't know the underlying structure I would be lost there.

Questions:

  • how do we ensure that the generator and the package structure don't drift apart? I mean things like overall structure, available task kinds, fields names, available field values etc.
  • I saw that you're using custom validators for field values - is it worth revisiting the scheme-discussion?

@kensipe
Copy link
Member Author

kensipe commented Dec 30, 2019

when we get this landed... I plan to have a more polished video and will push it to our youtube chan.

Regarding questions
re: how do we ensure that the generator and the package structure don't drift apart - like we do for any other feature. I don't think this is a reason to hold it back... there are tests in place which will help.

I'm not sure what custom validators for fields you are referring to :( scheme discussion welcomed but seems separate from this PR.

package add maintainer working

Signed-off-by: Ken Sipe <kensipe@gmail.com>

notes

Signed-off-by: Ken Sipe <kensipe@gmail.com>

renaming of vars

Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
…in step already

Signed-off-by: Ken Sipe <kensipe@gmail.com>
… part of stdout

Signed-off-by: Ken Sipe <kensipe@gmail.com>
…confirm no duplicates for params

Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
@kensipe kensipe added this to the 0.10.0 milestone Dec 31, 2019
Signed-off-by: Ken Sipe <kensipe@gmail.com>
if err != nil {
return "", err
}
if exists {
Copy link
Member

Choose a reason for hiding this comment

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

stylistic, mind adding whitespace between each } and next statement?

Copy link
Member

@gerred gerred left a comment

Choose a reason for hiding this comment

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

approval with some stylistic nits, overall looks good. does promptui include a default selection when confirming? i.e. (Y/n) or (y/N). I didn't see it in godoc and haven't tested.

@gerred
Copy link
Member

gerred commented Jan 6, 2020

oh, @kensipe, can you also add a flag to auto-confirm (or skip confirmation) so this can be used in CI/CD or other automated environments? Then someone could use it with atomist, or wrap it, etc.

Signed-off-by: Ken Sipe <kensipe@gmail.com>
@gerred gerred added this to In Progress in KUDO Global Jan 6, 2020
@gerred
Copy link
Member

gerred commented Jan 6, 2020

@kensipe please open a tracking issue and link this PR as well as a checkbox for docs

pkg/kudoctl/cmd/generate/task.go Outdated Show resolved Hide resolved
}

// ForMaintainer prompts to gather information to add an operator maintainer
func ForMaintainer() (*v1beta1.Maintainer, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't mind having this file split into more than one, but that's just a nit.

kensipe and others added 3 commits January 7, 2020 10:22
Co-Authored-By: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
@kensipe kensipe merged commit 60b0f19 into master Jan 7, 2020
KUDO Global automation moved this from In Progress to Done Jan 7, 2020
@kensipe kensipe deleted the ken/skeleton-generators branch January 7, 2020 19:16
ANeumann82 added a commit that referenced this pull request Feb 13, 2020
Co-Authored-By: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
KUDO Global
  
Done
Development

Successfully merging this pull request may close these issues.

Skeleton: Add Maintainer Skeleton: Create Param Skeleton: Create Plan Skeleton: Create Task
5 participants