-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
init: Add default config name #2668
init: Add default config name #2668
Conversation
Codecov Report
|
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.
LGTM, thank you!
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 wonder if the allowed filenames is a larger set than the allowed names in metadata.name
? In which case should we escape the folder name?
@balopat That's a good point. At the moment, we don't have any restrictions for config names. But usual kubernetes resources have some constraints (from https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names):
Even though we don't validate that right now, I think it's a good idea to follow this pattern. What do you think about |
@corneliusweig seems reasonable to me, better safe than sorry. |
@corneliusweig bump 👍 |
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 feel the changes in the integration/examples are independent of this.
Can you break this in 2 PR
- Added metadata.name in examples.
- Actually edits the init flow.
pkg/skaffold/initializer/init.go
Outdated
@@ -372,9 +374,15 @@ func generateSkaffoldConfig(k Initializer, buildConfigPairs []builderImagePair) | |||
// if the user doesn't have any k8s yamls, generate one for each dockerfile | |||
logrus.Info("generating skaffold config") | |||
|
|||
name, err := suggestConfigName() | |||
if err != nil { | |||
return nil, errors.Wrap(err, "generating default config name") |
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.
should this be an error ? since its a optional field, we should log this as error and continue
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.
Yes, I agree.
@tejal29 I'm wondering if it even was a good idea to add the field in our examples. So far, they have been quite minimal and this breaks with that rationale. Please let me know if you have the same doubts. If you think this is a good idea, I'll create the separate PR, but I'll drop the commit from here. |
Defaults to the basename of the current workdir. Signed-off-by: Cornelius Weig <[email protected]>
See https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names for details. Signed-off-by: Cornelius Weig <[email protected]>
d854410
to
3693b15
Compare
@corneliusweig I actually don't think we need to edit our examples. |
As discussed in #2556
skaffold init
could populate themetadata.name
field inskaffold.yaml
. This PR adds the logic to populate the field with the basename of the currect working dir. I thought about adding tests, but I decided against adding some, because the test-cases could only test the trivial happy path of the added function.Also, I have added the config name to all examples. This may be a controversial change..
Even though this field is optional in Skaffold, I think it makes the yaml files easier to navigate, because every example
skaffold.yaml
states what example it is.Close #2556