diff --git a/pkg/apis/pipeline/v1alpha1/cluster_resource.go b/pkg/apis/pipeline/v1alpha1/cluster_resource.go index bd379f6cc61..eba532489f9 100644 --- a/pkg/apis/pipeline/v1alpha1/cluster_resource.go +++ b/pkg/apis/pipeline/v1alpha1/cluster_resource.go @@ -66,8 +66,6 @@ func NewClusterResource(kubeconfigWriterImage string, r *PipelineResource) (*Clu } for _, param := range r.Spec.Params { switch { - case strings.EqualFold(param.Name, "Name"): - clusterResource.Name = param.Value case strings.EqualFold(param.Name, "URL"): clusterResource.URL = param.Value case strings.EqualFold(param.Name, "Revision"): diff --git a/pkg/apis/pipeline/v1alpha1/cluster_resource_test.go b/pkg/apis/pipeline/v1alpha1/cluster_resource_test.go index de16aa83134..cfbd54c080b 100644 --- a/pkg/apis/pipeline/v1alpha1/cluster_resource_test.go +++ b/pkg/apis/pipeline/v1alpha1/cluster_resource_test.go @@ -35,13 +35,12 @@ func TestNewClusterResource(t *testing.T) { desc: "basic cluster resource", resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( v1alpha1.PipelineResourceTypeCluster, - tb.PipelineResourceSpecParam("name", "test_cluster_resource"), tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), tb.PipelineResourceSpecParam("token", "my-token"), )), want: &v1alpha1.ClusterResource{ - Name: "test_cluster_resource", + Name: "test-cluster-resource", Type: v1alpha1.PipelineResourceTypeCluster, URL: "http://10.10.10.10", CAData: []byte("my-cluster-cert"), @@ -52,14 +51,13 @@ func TestNewClusterResource(t *testing.T) { desc: "resource with password instead of token", resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( v1alpha1.PipelineResourceTypeCluster, - tb.PipelineResourceSpecParam("name", "test_cluster_resource"), tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), tb.PipelineResourceSpecParam("username", "user"), tb.PipelineResourceSpecParam("password", "pass"), )), want: &v1alpha1.ClusterResource{ - Name: "test_cluster_resource", + Name: "test-cluster-resource", Type: v1alpha1.PipelineResourceTypeCluster, URL: "http://10.10.10.10", CAData: []byte("my-cluster-cert"), @@ -71,12 +69,11 @@ func TestNewClusterResource(t *testing.T) { desc: "set insecure flag to true when there is no cert", resource: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( v1alpha1.PipelineResourceTypeCluster, - tb.PipelineResourceSpecParam("name", "test.cluster.resource"), tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), tb.PipelineResourceSpecParam("token", "my-token"), )), want: &v1alpha1.ClusterResource{ - Name: "test.cluster.resource", + Name: "test-cluster-resource", Type: v1alpha1.PipelineResourceTypeCluster, URL: "http://10.10.10.10", Token: "my-token", @@ -87,14 +84,13 @@ func TestNewClusterResource(t *testing.T) { desc: "basic cluster resource with namespace", resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( v1alpha1.PipelineResourceTypeCluster, - tb.PipelineResourceSpecParam("name", "test_cluster_resource"), tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), tb.PipelineResourceSpecParam("token", "my-token"), tb.PipelineResourceSpecParam("namespace", "my-namespace"), )), want: &v1alpha1.ClusterResource{ - Name: "test_cluster_resource", + Name: "test-cluster-resource", Type: v1alpha1.PipelineResourceTypeCluster, URL: "http://10.10.10.10", CAData: []byte("my-cluster-cert"), @@ -106,7 +102,6 @@ func TestNewClusterResource(t *testing.T) { desc: "basic resource with secrets", resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( v1alpha1.PipelineResourceTypeCluster, - tb.PipelineResourceSpecParam("name", "test-cluster-resource"), tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), tb.PipelineResourceSpecSecretParam("cadata", "secret1", "cadatakey"), tb.PipelineResourceSpecSecretParam("token", "secret1", "tokenkey"), diff --git a/pkg/apis/pipeline/v1alpha1/pipelineresource_validation.go b/pkg/apis/pipeline/v1alpha1/pipelineresource_validation.go index 883fb050da4..31a3867c884 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelineresource_validation.go +++ b/pkg/apis/pipeline/v1alpha1/pipelineresource_validation.go @@ -25,7 +25,6 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/validate" "k8s.io/apimachinery/pkg/api/equality" "knative.dev/pkg/apis" - logging "knative.dev/pkg/logging" ) var _ apis.Validatable = (*PipelineResource)(nil) @@ -43,7 +42,7 @@ func (rs *PipelineResourceSpec) Validate(ctx context.Context) *apis.FieldError { return apis.ErrMissingField(apis.CurrentField) } if rs.Type == PipelineResourceTypeCluster { - var authFound, cadataFound, nameFound, isInsecure bool + var authFound, cadataFound, isInsecure bool for _, param := range rs.Params { switch { case strings.EqualFold(param.Name, "URL"): @@ -57,8 +56,6 @@ func (rs *PipelineResourceSpec) Validate(ctx context.Context) *apis.FieldError { cadataFound = true case strings.EqualFold(param.Name, "Token"): authFound = true - case strings.EqualFold(param.Name, "name"): - nameFound = true case strings.EqualFold(param.Name, "insecure"): b, _ := strconv.ParseBool(param.Value) isInsecure = b @@ -75,10 +72,6 @@ func (rs *PipelineResourceSpec) Validate(ctx context.Context) *apis.FieldError { } } - if nameFound { - logging.FromContext(ctx).Warn( - "The name parameter on the cluster resource is deprecated. Support will be removed in a future release") - } // One auth method must be supplied if !(authFound) { return apis.ErrMissingField("username or CAData or token param")