Skip to content

Commit 53b3d58

Browse files
committed
Add V1 version of TaskRun CRD
This commit adds a v1 version of the TaskRun CRD, and support to the webhook. Since this version is not served, it will not be available to users.
1 parent 0617163 commit 53b3d58

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

cmd/webhook/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
6060
// v1
6161
v1.SchemeGroupVersion.WithKind("Task"): &v1.Task{},
6262
v1.SchemeGroupVersion.WithKind("Pipeline"): &v1.Pipeline{},
63+
v1.SchemeGroupVersion.WithKind("TaskRun"): &v1.TaskRun{},
6364

6465
// resolution
6566
// v1alpha1
@@ -164,6 +165,14 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro
164165
v1GroupVersion: &v1.Pipeline{},
165166
},
166167
},
168+
v1.Kind("TaskRun"): {
169+
DefinitionName: pipeline.TaskRunResource.String(),
170+
HubVersion: v1beta1GroupVersion,
171+
Zygotes: map[string]conversion.ConvertibleObject{
172+
v1beta1GroupVersion: &v1beta1.TaskRun{},
173+
v1GroupVersion: &v1.TaskRun{},
174+
},
175+
},
167176
},
168177

169178
// A function that infuses the context passed to ConvertTo/ConvertFrom/SetDefaults with custom metadata

config/300-taskrun.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,37 @@ spec:
5656
# starts to increment
5757
subresources:
5858
status: {}
59+
- name: v1
60+
served: false
61+
storage: false
62+
schema:
63+
openAPIV3Schema:
64+
type: object
65+
# One can use x-kubernetes-preserve-unknown-fields: true
66+
# at the root of the schema (and inside any properties, additionalProperties)
67+
# to get the traditional CRD behaviour that nothing is pruned, despite
68+
# setting spec.preserveUnknownProperties: false.
69+
#
70+
# See https://kubernetes.io/blog/2019/06/20/crd-structural-schema/
71+
# See issue: https://github.com/knative/serving/issues/912
72+
x-kubernetes-preserve-unknown-fields: true
73+
additionalPrinterColumns:
74+
- name: Succeeded
75+
type: string
76+
jsonPath: ".status.conditions[?(@.type==\"Succeeded\")].status"
77+
- name: Reason
78+
type: string
79+
jsonPath: ".status.conditions[?(@.type==\"Succeeded\")].reason"
80+
- name: StartTime
81+
type: date
82+
jsonPath: .status.startTime
83+
- name: CompletionTime
84+
type: date
85+
jsonPath: .status.completionTime
86+
# Opt into the status subresource so metadata.generation
87+
# starts to increment
88+
subresources:
89+
status: {}
5990
names:
6091
kind: TaskRun
6192
plural: taskruns
@@ -70,7 +101,7 @@ spec:
70101
conversion:
71102
strategy: Webhook
72103
webhook:
73-
conversionReviewVersions: ["v1beta1"]
104+
conversionReviewVersions: ["v1beta1", "v1"]
74105
clientConfig:
75106
service:
76107
name: tekton-pipelines-webhook

0 commit comments

Comments
 (0)