@@ -23,6 +23,8 @@ import (
2323 "os"
2424
2525 defaultconfig "github.com/tektoncd/pipeline/pkg/apis/config"
26+ "github.com/tektoncd/pipeline/pkg/apis/pipeline"
27+ v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
2628 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
2729 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
2830 resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
@@ -54,6 +56,8 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
5456 v1beta1 .SchemeGroupVersion .WithKind ("ClusterTask" ): & v1beta1.ClusterTask {},
5557 v1beta1 .SchemeGroupVersion .WithKind ("TaskRun" ): & v1beta1.TaskRun {},
5658 v1beta1 .SchemeGroupVersion .WithKind ("PipelineRun" ): & v1beta1.PipelineRun {},
59+ // v1
60+ v1 .SchemeGroupVersion .WithKind ("Task" ): & v1.Task {},
5761}
5862
5963func newDefaultingAdmissionController (ctx context.Context , cmw configmap.Watcher ) * controller.Impl {
@@ -126,12 +130,27 @@ func newConfigValidationController(ctx context.Context, cmw configmap.Watcher) *
126130}
127131
128132func newConversionController (ctx context.Context , cmw configmap.Watcher ) * controller.Impl {
133+ // nolint: revive
134+ var (
135+ v1beta1GroupVersion = v1beta1 .SchemeGroupVersion .Version
136+ v1GroupVersion = v1 .SchemeGroupVersion .Version
137+ )
129138 return conversion .NewConversionController (ctx ,
130139 // The path on which to serve the webhook
131140 "/resource-conversion" ,
132141
133142 // Specify the types of custom resource definitions that should be converted
134- map [schema.GroupKind ]conversion.GroupKindConversion {},
143+ // "HubVersion" is the stored version, and "Zygotes" are the supported versions
144+ map [schema.GroupKind ]conversion.GroupKindConversion {
145+ v1 .Kind ("Task" ): {
146+ DefinitionName : pipeline .TaskResource .String (),
147+ HubVersion : v1beta1GroupVersion ,
148+ Zygotes : map [string ]conversion.ConvertibleObject {
149+ v1beta1GroupVersion : & v1beta1.Task {},
150+ v1GroupVersion : & v1.Task {},
151+ },
152+ },
153+ },
135154
136155 // A function that infuses the context passed to ConvertTo/ConvertFrom/SetDefaults with custom metadata
137156 func (ctx context.Context ) context.Context {
0 commit comments