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

oc create doesn't honour -o json in same way that oc new-app does. #11242

Closed
GrahamDumpleton opened this issue Oct 6, 2016 · 10 comments
Closed
Assignees
Labels
component/cli lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/P2

Comments

@GrahamDumpleton
Copy link

When you run oc new-app and use the -o json option it will run checks to see if the application creation might work, but doesn't actually do it, instead outputting what would be created in the format requested by the -o option, JSON in this case.

If you use oc create, qualifying it with the type of resource you want to create, such as a route and use -o json, then it goes off and creates the resource anyway and doesn't output anything.

I would expect, and I believe it would be much more useful, if -o json worked the same was as oc new-app when when using oc create to create specific resources. Thus for example, running:

oc create route edge myapp-ssl --service myapp --hostname example.com -o json 

should do nothing except output the JSON definition of what would be created.

This would be useful for validating what gets created is what you intend to be created before you do it, but also that it provides a good way of creating definitions for specific scenarios, which you could then cut and paste what would be created, into a template.

I use route here as an example but expect that this could be applied to all resources oc create can explicitly create.

I can't see that this would conflict with existing usage of -o option and in fact -o on oc new-app already seems to be overloaded in that can be name for succinct output of what would be created, and json or yaml to give definition of what would be created but don't do anything.

@fabianofranz
Copy link
Member

So, this is an important issue because we are very inconsistent today.

The way upstream commands (like run, create, and others) work (and how everything should work in my opinion) is

  • --output flag only specifies how the output of the running command will look like, but it doesn't affect in executing the action on not.
  • --dry-run is what must be used to not really execute the action and it can be used with --output, a very common use case is --dry-run --output=json to check what would be created, copy and paste into template, etc.

Problem is, we have a number of commands where --output=<mode> does not execute but behaves like --dry-run --output=<mode>. To name a few, new-app, new-build, rollback, set env, set volumes (but not set image, set deployment-hook), and others.

But there's backwards compatibility.

@juanvallejo can you link the --dry-run work you are doing?
@bparees @csrwng @smarterclayton

@juanvallejo
Copy link
Contributor

juanvallejo commented Oct 6, 2016

@fabianofranz

@juanvallejo can you link the --dry-run work you are doing?

Sure:

@smarterclayton
Copy link
Contributor

smarterclayton commented Oct 7, 2016 via email

@GrahamDumpleton
Copy link
Author

The only way to avoid backward compatibility issues would be to keep that if -o json or -o yaml is used that it implies --dry-run. The --dry-run option wouldn't be redundant as still may want that just to check things if not explicitly asking for json/yaml of resources created to be output.

@juanvallejo
Copy link
Contributor

Also related PR (adds oc create support for output formats other than name): #12015

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 8, 2018
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 12, 2018
@GrahamDumpleton
Copy link
Author

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Mar 12, 2018
@soltysh
Copy link
Contributor

soltysh commented Oct 1, 2020

This should be fixed by now
/remove-lifecycle frozen
/close

@openshift-ci-robot
Copy link

@soltysh: Closing this issue.

In response to this:

This should be fixed by now
/remove-lifecycle frozen
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot removed the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cli lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/P2
Projects
None yet
Development

No branches or pull requests

8 participants