diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index be3ee80255a..9c7f34bdeb8 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -60,6 +60,7 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ // v1 v1.SchemeGroupVersion.WithKind("Task"): &v1.Task{}, v1.SchemeGroupVersion.WithKind("Pipeline"): &v1.Pipeline{}, + v1.SchemeGroupVersion.WithKind("TaskRun"): &v1.TaskRun{}, // resolution // v1alpha1 @@ -164,6 +165,14 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro v1GroupVersion: &v1.Pipeline{}, }, }, + v1.Kind("TaskRun"): { + DefinitionName: pipeline.TaskRunResource.String(), + HubVersion: v1beta1GroupVersion, + Zygotes: map[string]conversion.ConvertibleObject{ + v1beta1GroupVersion: &v1beta1.TaskRun{}, + v1GroupVersion: &v1.TaskRun{}, + }, + }, }, // A function that infuses the context passed to ConvertTo/ConvertFrom/SetDefaults with custom metadata diff --git a/config/300-taskrun.yaml b/config/300-taskrun.yaml index b816af48de6..9f31a766463 100644 --- a/config/300-taskrun.yaml +++ b/config/300-taskrun.yaml @@ -56,6 +56,37 @@ spec: # starts to increment subresources: status: {} + - name: v1 + served: false + storage: false + schema: + openAPIV3Schema: + type: object + # One can use x-kubernetes-preserve-unknown-fields: true + # at the root of the schema (and inside any properties, additionalProperties) + # to get the traditional CRD behaviour that nothing is pruned, despite + # setting spec.preserveUnknownProperties: false. + # + # See https://kubernetes.io/blog/2019/06/20/crd-structural-schema/ + # See issue: https://github.com/knative/serving/issues/912 + x-kubernetes-preserve-unknown-fields: true + additionalPrinterColumns: + - name: Succeeded + type: string + jsonPath: ".status.conditions[?(@.type==\"Succeeded\")].status" + - name: Reason + type: string + jsonPath: ".status.conditions[?(@.type==\"Succeeded\")].reason" + - name: StartTime + type: date + jsonPath: .status.startTime + - name: CompletionTime + type: date + jsonPath: .status.completionTime + # Opt into the status subresource so metadata.generation + # starts to increment + subresources: + status: {} names: kind: TaskRun plural: taskruns @@ -70,7 +101,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1beta1"] + conversionReviewVersions: ["v1beta1", "v1"] clientConfig: service: name: tekton-pipelines-webhook