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

add oc create dc #8712

Merged
merged 1 commit into from May 6, 2016
Merged

add oc create dc #8712

merged 1 commit into from May 6, 2016

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented May 2, 2016

Adds oc create dc so I can do oc create dc my-nginx --image=nginx -- nginx -t -c /path/to/mynginx.conf so I can easily write the service serving cert test for clayton.

@Kargakis @stevekuznetsov

@0xmichalis
Copy link
Contributor

Can't you use oc run?

@deads2k
Copy link
Contributor Author

deads2k commented May 2, 2016

Can't you use oc run?

Counting on the output of an intent-like command like oc run doesn't make a lot of sense. I want to create a DC and I want to be sure that I get a DC. I don't want to be trying to find the right generator or trying to pin to various versions to avoid getting broken the next time it changes.

@0xmichalis
Copy link
Contributor

to avoid getting broken the next time it changes.

That's the concept of pinning down to a generator. I haven't seen anyone complaining about the current state with respect to creating deployments (not saying that it's optimal). Also, why do you need a dc for your test? Can't you run a pod or rc? Will you test deployments?

@fabianofranz @smarterclayton what's your opinion on this? Do we want to support duplicate commands? We agreed that we don't want to continue adding to oc expose so we created oc create route for generating secured routes which is fine. I don't see any difference though between oc run --generator=deploymentconfig/v1 and oc create dc. Are we planning on moving anything that generates resources under oc create?

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

Do we want to support duplicate commands?

These aren't duplicate commands.

One is oc run that means (from a user perspective): run this image somehow with all these flags that I'm not likely to understand and have different affects on different generators (what's a generator again?) and thus always have broken documentation. I think when a CLI command passes 30 local flags (not even considering generator variation), its time to rethink your strategy and your expectations about users actually using it.

The other is oc create dc that means: I want a DC for this image and command, I'll sort out the rest using oc set if I have to, but I don't want to be authoring yaml, make it for me.

@0xmichalis 0xmichalis self-assigned this May 3, 2016
cmd := &cobra.Command{
Use: name + " NAME --image=IMAGE -- [COMMAND] [args...]",
Short: "Create deployment config with default options that uses a given image.",
Long: policyBindingLong,
Copy link
Contributor

Choose a reason for hiding this comment

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

deploymentConfigLong

@stevekuznetsov
Copy link
Contributor

With only one flag and lots of defaulting, are we sure this is going to be useful? Maybe it would be better to have a "default" target on the generator?

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

With only one flag and lots of defaulting, are we sure this is going to be useful? Maybe it would be better to have a "default" target on the generator?

There are no generators for origin resources. Turns out that most of the time you're starting with this, you don't care about the vast majority of things we can set. Even just getting the yaml skeleton so oc edit works has significant value.

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

comments addressed.

o := &CreateDeploymentConfigOptions{Out: out}

cmd := &cobra.Command{
Use: name + " NAME --image=IMAGE -- [COMMAND] [args...]",
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any special handling of dashes. You may want to have a look at kubernetes/kubernetes#13917

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see any special handling of dashes. You may want to have a look at kubernetes/kubernetes#13917

Added the check to make sure that you only have one arg before the dash.

@0xmichalis
Copy link
Contributor

cc: @fabianofranz @ironcladlou

@smarterclayton
Copy link
Contributor

Please concretely explain why this is not oc run.

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

Please concretely explain why this is not oc run.

I know that I want a DC. I will always want a DC. I will never want this command to decide to make a job or a pod or an RC or a D or any of the other things that have broken what it does in the past. I the simplest possible command with options that I can understand that always behave predictably to get me started without having to know yaml and allow easy composition with oc set.

This is exactly the command that I wanted to start the nginx stuff because I knew what I wanted and couldn't figure out how to use oc run.

@smarterclayton
Copy link
Contributor

If the args for your command look like run, you should be using run. If you don't trust run, that's reasonable, but the answer is to use run and we should fix your worries. I do not want to add a create deploymentconfig command that offers nothing outside of run. We already have plans to add something that is focused on deploying images, I'd prefer not to add a third way.

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

If the args for your command look like run, you should be using run. If you don't trust run, that's reasonable, but the answer is to use run and we should fix your worries. I do not want to add a create deploymentconfig command that offers nothing outside of run. We already have plans to add something that is focused on deploying images, I'd prefer not to add a third way.

Unless we undo 90% of what oc run is doing, its never going to be the "you know what resource you want, but can't author the yaml, start here" command. As we continue have more easy oc create commands, this problem is going to get worse and the fact that DCs will be missing is going to look like a glaring oversight. Pointing someone at a giant command that isn't focused on what they're doing and can't realistically be fixed is a terrible way to try to get started doing something more tailored than oc new-app. It makes the gulf from "I know nothing" to "I know a little bit" a giant impassible chasm that I can't cross.

@deads2k
Copy link
Contributor Author

deads2k commented May 3, 2016

So I can find this in the future, all you need to do is alias 'oc-create-dc'="oc run --restart=Always --expose=false --attach=false --generator=deploymentconfig/v1 --record=false --save-config=false" and you'll have enough stability in oc run to use it, probably. Can't imagine why I didn't think of that first.

@deads2k deads2k closed this May 3, 2016
@smarterclayton
Copy link
Contributor

Such snark. As we talked about in person I'm ok with this if you can describe the boundaries clearly in doc about why these exist, and what the limit is on what people can add to them (probably in kubectl conventions upstream).

@smarterclayton smarterclayton reopened this May 3, 2016
@smarterclayton
Copy link
Contributor

Or: alias 'oc-create-dc'="oc run ', which is the same.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 4, 2016
DeploymentConfigRecommendedName = "deploymentconfig"

deploymentConfigLong = `
Create a deployment config that uses a given image.`
Copy link
Contributor

Choose a reason for hiding this comment

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

Describe what deployment configs are and why I want them. Crib from the API doc if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Describe what deployment configs are and why I want them. Crib from the API doc if necessary.

added.

@deads2k
Copy link
Contributor Author

deads2k commented May 4, 2016

Upstream pull got agreement in principle for kubectl create <subcommand>

I think I got all the comments.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 4, 2016

func (o *CreateDeploymentConfigOptions) Complete(cmd *cobra.Command, f *clientcmd.Factory, args []string) error {
argsLenAtDash := cmd.ArgsLenAtDash()
if argsLenAtDash != 1 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note to self, handle the case of no dashes

@deads2k
Copy link
Contributor Author

deads2k commented May 5, 2016

any other comments?

@0xmichalis
Copy link
Contributor

lgtm [merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented May 5, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5827/) (Image: devenv-rhel7_4118)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 0bde6e5

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 0bde6e5

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3629/)

@openshift-bot openshift-bot merged commit 2bce3bd into openshift:master May 6, 2016
@fabianofranz
Copy link
Member

LGTM, pretty much what I meant here.

@deads2k deads2k deleted the create-dc branch September 6, 2016 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants