Skip to content

Commit

Permalink
enforce rfc1123 compatibility for olm.package.name
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
  • Loading branch information
grokspawn committed May 13, 2024
1 parent 9fdedc2 commit 8a21a0a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alpha/declcfg/declcfg_to_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/blang/semver/v4"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation"

"github.com/operator-framework/operator-registry/alpha/model"
"github.com/operator-framework/operator-registry/alpha/property"
Expand All @@ -22,6 +23,10 @@ func ConvertToModel(cfg DeclarativeConfig) (model.Model, error) {
return nil, fmt.Errorf("duplicate package %q", p.Name)
}

if errs := validation.IsDNS1123Label(p.Name); len(errs) > 0 {
return nil, fmt.Errorf("invalid package name %q: %v", p.Name, errs)
}

mpkg := &model.Package{
Name: p.Name,
Description: p.Description,
Expand Down

0 comments on commit 8a21a0a

Please sign in to comment.