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 autocreate field to manifest #1289
Conversation
Signed-off-by: jLopezbarb <javier@okteto.com>
cmd/up/up.go
Outdated
if !autoDeploy && !up.Dev.Autocreate { | ||
err = errors.UserError{ | ||
E: fmt.Errorf("Can't autocreate deployment"), | ||
Hint: "Deploy your app first on okteto cloud or enable it using --deploy arg or setting autocreate variable to true in your manifest"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rlamana ^^ that's the error if running okteto up
and the deployment doesn't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here a few suggestions on how we should present this output:
-
Can we be more concise with the error? I wouldn't based it on the "autocreate" or at least I would make it clear that the deployment wasn't found first, and then maybe mention the possibility to add the autocreate in the hint. Maybe something like:
Deployment ${name} not found in namespace '$namespace'
-
Don't mention
Okteto Cloud
since this could be any cluster, right? -
In the hint show a clear list of options:
- Make sure your application is deployed and ready.
- Make sure your context is pointing to the right namespace.
- Set the `autocreate` property in your okteto.yml manifest if you want to automatically create a new development container.
- Maybe we could show a link to the docs (are we doing this in other parts of the cli?).
wdyt?
cmd/up/up.go
Outdated
if err := utils.AskIfDeploy(up.Dev.Name, up.Dev.Namespace); err != nil { | ||
return nil, false, err | ||
} | ||
if !autoDeploy && !up.Dev.Autocreate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set dev.Autocreate
to true
here:
https://github.com/okteto/okteto/blob/master/cmd/up/up.go#L180
and from there, we only care about dev.Autocreate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this interact with the CLI param? Will the CLI take precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments inline on the name of the key in the manifest.
pkg/model/dev.go
Outdated
@@ -144,6 +144,7 @@ type Dev struct { | |||
Resources ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` | |||
Services []*Dev `json:"services,omitempty" yaml:"services,omitempty"` | |||
PersistentVolumeInfo *PersistentVolumeInfo `json:"persistentVolume,omitempty" yaml:"persistentVolume,omitempty"` | |||
Autocreate bool `json:"autocreate,omitempty" yaml:"autocreate,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same as if the user passes the deploy
arg in the CLI? If so, can we use the same name in the manifest to keep it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deploy
sounds confusing? what about autodeploy
?
Also, we are keeping the deploy
arg, but it should be deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling the same thing two different ways is more confusing. People use the --deploy
param today, so renaming to autodeploy it'll be confusing to them.
Both terms are equally confusing to me TBH (from the perspective of a new user), the fact that we call it 'deploy' or 'autocreate' is leaking that fact that we need a deployment before doing the up
phase of the process. I'd rather stay with the current 'confusing' term rather than introduce yet another until we have a term we really like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rberrelleza do you have numbers on how many are using --deploy
? The idea is to deprecate the deploy
arg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if we are collecting that information, but people that ask questions in the slack channel tend to use it a lot.
maybe we can call it mode: standalone
? (with the idea that then having mode:swap
in the future so that users can be more explicit about how they want to use up?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are deprecating the deploy flag, maybe let's add a message to the help now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the idea of using a mode
was interesting for a long time. We even discussed this several times in the past, but the truth is that if we want to keep it simple that just adds a lot more complexity for a use case that is at its minimum:
According to the data:
- 95.59% of swap use.
- 4.41% of the "standalone" use. Of which we already know many happened by mistake.
Having a simple flag called autocreate: true
right now (or even standalone: true
) allows us to keep this feature for that small percentage who use it and avoids the current mistake of creating an unwanted deployment for some. I don't think we should be blocked by the naming convention for this, as long as is not as confusing as deploy
or autodeploy
, which is a term we use for something completely different.
I vote for autocreate: true
or standalone: true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jLopezbarb let's go with autocreate
then
cmd/up/up.go
Outdated
if err := utils.AskIfDeploy(up.Dev.Name, up.Dev.Namespace); err != nil { | ||
return nil, false, err | ||
} | ||
if !autoDeploy && !up.Dev.Autocreate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this interact with the CLI param? Will the CLI take precedence?
Signed-off-by: jLopezbarb <javier@okteto.com>
Signed-off-by: jLopezbarb <javier@okteto.com>
Codecov Report
@@ Coverage Diff @@
## master #1289 +/- ##
==========================================
- Coverage 34.01% 33.94% -0.08%
==========================================
Files 68 68
Lines 5780 5792 +12
==========================================
Hits 1966 1966
- Misses 3607 3619 +12
Partials 207 207
Continue to review full report at Codecov.
|
@@ -109,7 +109,7 @@ func Up() *cobra.Command { | |||
return err | |||
} | |||
|
|||
if err := loadDevOverrides(dev, namespace, k8sContext, forcePull, remote); err != nil { | |||
if err := loadDevOverrides(dev, namespace, k8sContext, forcePull, remote, autoDeploy); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an option (MarkHidden
) in cobra to not show an arg in the help command. Let add the hidden option to the autodeploy
flag and also remove autodeploy
from the docs, but keeping the flag hidden for now
cmd/up/up.go
Outdated
err = errors.UserError{ | ||
E: fmt.Errorf("Deployment %s not found in namespace '%s'", up.Dev.Name, up.Dev.Namespace), | ||
Hint: `Please: | ||
- Make sure your application is deployed and ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Make sure your application is deployed and ready. | |
- Make sure your application is deployed. |
cmd/up/up.go
Outdated
E: fmt.Errorf("Deployment %s not found in namespace '%s'", up.Dev.Name, up.Dev.Namespace), | ||
Hint: `Please: | ||
- Make sure your application is deployed and ready. | ||
- Make sure your context is pointing to the right namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Make sure your context is pointing to the right namespace. | |
- Make sure your context is pointing to the right namespace. |
cmd/up/up.go
Outdated
Hint: `Please: | ||
- Make sure your application is deployed and ready. | ||
- Make sure your context is pointing to the right namespace. | ||
- Set the 'autocreate' property in your okteto.yml manifest if you want to automatically create a new development container. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Set the 'autocreate' property in your okteto.yml manifest if you want to automatically create a new development container. | |
- Set the 'autocreate' field in your okteto manifest if you want to automatically create a new deployment in your current namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a shorten version:
- Set the 'autocreate' property in your okteto.yml manifest if you want to automatically create a new development container. | |
- To automatically create a new deployment, set the 'autocreate' field in your okteto manifest. |
- Make sure your application is deployed and ready. | ||
- Make sure your context is pointing to the right namespace. | ||
- Set the 'autocreate' property in your okteto.yml manifest if you want to automatically create a new development container. | ||
More information is available here: https://okteto.com/docs/reference/cli#up`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this link should point to the autocreate
field docs, and add it to the third bullet point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pchico83 I talked to @jLopezbarb about this. I'd like to start adding links to the full documentation of the commands in case of error. I suggested this so users can read about the general workings of the UP command (including a link to the autocreate
but from the docs themselves), instead of having many links on the same output.
We should then also add a paragraph explaining the 'autocreate' in general in the UP description and add a link to how to configure it in the manifest from there.
@jLopezbarb can you share a screenshot of how the output looks in the terminal? |
@rlamana this is how the output looks like with the url in the last bullet point. I think something like adding another line to show the url could be more readable for the user. |
I thought it was going to look worse :-P We should definitely shorten the last bullet point and take the URL to the next line. |
We should also only point to the UP docs. It will make all that shorter too. |
Signed-off-by: jLopezbarb <javier@okteto.com>
Signed-off-by: jLopezbarb <javier@okteto.com>
I would remove the "warning" word, it is already implied by the yellow color. @rlamana thoughts? |
cmd/up/up.go
Outdated
@@ -104,12 +104,18 @@ func Up() *cobra.Command { | |||
|
|||
checkLocalWatchesConfiguration() | |||
|
|||
if autoDeploy { | |||
log.Yellow(`Warning: The use of 'deploy' flag will be deprecated in a future release. | |||
Please set 'autocreate' in your okteto manifest to get the same behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set 'autocreate' in your okteto manifest to get the same behaviour. | |
Please set 'autocreate' in your okteto manifest to get the same behavior. |
|
@rlamana we don't but makes sense. Let's create an issue for it to keep the scope of this issue unaffected. |
Signed-off-by: jLopezbarb <javier@okteto.com>
Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our contributing guide. |
Signed-off-by: jLopezbarb javier@okteto.com
Fixes #1285
Proposed changes