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

Discuss the behavior of operator-sdk new #83

Closed
fanminshi opened this issue Mar 2, 2018 · 6 comments
Closed

Discuss the behavior of operator-sdk new #83

fanminshi opened this issue Mar 2, 2018 · 6 comments

Comments

@fanminshi
Copy link
Contributor

fanminshi commented Mar 2, 2018

Current runoperator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=AppService creates a new folder called app-operator. If I call operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=AppService, the command overrides everything there is in the app-operator folder. I don't think that's behavior we want. In rails, the new command skips any files that have been created and generates the ones that aren't there. The rails behavior seems great but might complicate the current operator-sdk new code base to support that. I think the simpler way is to check if app-operator folder has been created already; if not, create it; if created, then skip the files and dirs creation.

cc/ @hasbro17 @hongchaodeng

@hongchaodeng
Copy link
Contributor

It depends.
For the behavior, if the input is deterministic, and output is deterministic, then it is safe to skip anything that already exists.

if app-operator folder has been created already

IMHO, this is not enough to determine if the output is what we want to generate.

@hasbro17
Copy link
Contributor

hasbro17 commented Mar 2, 2018

this is not enough to determine if the output is what we want to generate

@hongchaodeng Can you explain your concern a bit more.

I was thinking that the expected behavior from operator-sdk new <project-name> is to simply create a new project if it does not exist.
So there are two cases:

  • If a directory with <project-name> already exists in the current working directory then the command should output an error saying it already exists. Doesn't matter are the contents of that directory.
  • If there is no directory, then create a new project.

@hongchaodeng
Copy link
Contributor

I think the solution @hasbro17 mentioned above is good enough.

Can you explain your concern a bit more.

Not really a concern. As mentioned above, in order to skip some files and generate the rest, it needs both the input and output to be deterministic. Just checking the folder exists not enough.

@hasbro17
Copy link
Contributor

hasbro17 commented Mar 2, 2018

Sounds good. @fanminshi We'll proceed with the above mentioned behavior for now.

@fanminshi
Copy link
Contributor Author

yep!

@fanminshi
Copy link
Contributor Author

fixed via #85

m1kola pushed a commit to m1kola/operator-sdk that referenced this issue Jun 7, 2024
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

No branches or pull requests

3 participants