Skip to content

Commit

Permalink
allow dot character in resource names
Browse files Browse the repository at this point in the history
  • Loading branch information
psschwei committed Apr 19, 2021
1 parent 879ba4f commit d297d22
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 31 deletions.
9 changes: 0 additions & 9 deletions pkg/apis/pipeline/v1alpha1/condition_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ func TestCondition_Invalid(t *testing.T) {
cond *v1alpha1.Condition
expectedError apis.FieldError
}{{
name: "invalid meta",
cond: &v1alpha1.Condition{
ObjectMeta: metav1.ObjectMeta{Name: "invalid.,name"},
},
expectedError: apis.FieldError{
Message: "Invalid resource name: special character . must not be present",
Paths: []string{"metadata.name"},
},
}, {
name: "no image",
cond: &v1alpha1.Condition{
ObjectMeta: metav1.ObjectMeta{Name: "condname"},
Expand Down
12 changes: 0 additions & 12 deletions pkg/apis/pipeline/v1beta1/pipeline_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,6 @@ func TestPipeline_Validate_Failure(t *testing.T) {
expectedError apis.FieldError
wc func(context.Context) context.Context
}{{
name: "period in name",
p: &Pipeline{
ObjectMeta: metav1.ObjectMeta{Name: "pipe.line"},
Spec: PipelineSpec{
Tasks: []PipelineTask{{Name: "foo", TaskRef: &TaskRef{Name: "foo-task"}}},
},
},
expectedError: apis.FieldError{
Message: `Invalid resource name: special character . must not be present`,
Paths: []string{"metadata.name"},
},
}, {
name: "pipeline name too long",
p: &Pipeline{
ObjectMeta: metav1.ObjectMeta{Name: "asdf123456789012345678901234567890123456789012345678901234567890"},
Expand Down
9 changes: 0 additions & 9 deletions pkg/apis/validate/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package validate

import (
"strings"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
)
Expand All @@ -28,13 +26,6 @@ const MaxLength = 63
func ObjectMetadata(meta metav1.Object) *apis.FieldError {
name := meta.GetName()

if strings.Contains(name, ".") {
return &apis.FieldError{
Message: "Invalid resource name: special character . must not be present",
Paths: []string{"name"},
}
}

if len(name) > MaxLength {
return &apis.FieldError{
Message: "Invalid resource name: length must be no more than 63 characters",
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/validate/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func TestMetadataInvalidLongName(t *testing.T) {

invalidMetas := []*metav1.ObjectMeta{
{Name: strings.Repeat("s", validate.MaxLength+1)},
{Name: "bad.name"},
}
for _, invalidMeta := range invalidMetas {
if err := validate.ObjectMetadata(invalidMeta); err == nil {
Expand Down

0 comments on commit d297d22

Please sign in to comment.