-
Notifications
You must be signed in to change notification settings - Fork 7
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 name flag to scaffold Command #92
base: main
Are you sure you want to change the base?
Add name flag to scaffold Command #92
Conversation
Signed-off-by: Thorsten Hans <thorsten.hans@fermyon.com>
pkg/cmd/scaffold.go
Outdated
name, err := getNameFromImageReference(opts.from) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if len(opts.name) > 0 { | ||
if !validateName(opts.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.
I am wondering if we should add this validation to the name parsed from docker image ref as well.
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.
Hmm 🤔 In that case, I would move everything into the getNameFromImageReference
function, rename it to getSpinAppName
to streamline the code
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 that should be good. My only reason for that was to keep the validation for name
consistent irrespective of source of that string.
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.
@rajatjindal I've updated the PR according to the discussion we had here. As part of that, I've also added the name
flag to the deploy
sub command
Signed-off-by: Thorsten Hans <thorsten.hans@fermyon.com>
This PR adds an optional
name
flag to thescaffold
command.Motivation
As a user I want to specify a custom name when scaffolding a Kubernetes Deployment manifest for my Spin App.
Behavior
The
name
flag is optional. By default the name of the Spin App is generated using the provided OCI artifact reference (as it was before). If the--name
flag is specified, its value is validated and used for scaffolding.Validation
Only valid DNS subdomain names with less than 254 chars are considered valid. If an invalid value is provided, execution is terminated and a corresponding error message is presented to the user