Skip to content

Conversation

@ThorstenHans
Copy link

This PR adds an optional name flag to the scaffold 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

return nil, err
}
if len(opts.name) > 0 {
if !validateName(opts.name) {
Copy link
Member

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.

Copy link
Author

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

Copy link
Member

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.

Copy link
Author

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

@Mossaka
Copy link
Member

Mossaka commented Mar 7, 2025

Hey! Happy to merge this one if this is still what we want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants