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

relax restrictions on workload name #275

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions control-api/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ type HostServicesConfiguration struct {
NatsUserSeed string `json:"nats_user_seed"`
}

const (
workloadRegex = `^[a-zA-Z0-9_-]+$`
)

var (
validWorkloadName = regexp.MustCompile(`^[a-z]+$`)
validWorkloadName = regexp.MustCompile(workloadRegex)
)

// Creates a new deploy request based on the supplied options. Note that there is a fluent API function
Expand Down Expand Up @@ -102,7 +106,7 @@ func (request *DeployRequest) Validate() (*jwt.GenericClaims, error) {

request.DecodedClaims = *claims
if !validWorkloadName.MatchString(claims.Subject) {
return nil, fmt.Errorf("workload name claim ('%s') does not match requirements of all lowercase letters", claims.Subject)
return nil, fmt.Errorf("workload name claim ('%s') does not match requirements (%s)", claims.Subject, workloadRegex)
}

var vr jwt.ValidationResults
Expand Down
Loading