Skip to content

Commit

Permalink
Add V1 version of PipelineRun CRD
Browse files Browse the repository at this point in the history
This commit adds a v1 version of the PipelineRun CRD, and support to the
webhook. Since the version is not served, it will not be available to
users at the moment.
  • Loading branch information
JeromeJu committed Sep 9, 2022
1 parent e1fd727 commit d26556b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
v1beta1.SchemeGroupVersion.WithKind("TaskRun"): &v1beta1.TaskRun{},
v1beta1.SchemeGroupVersion.WithKind("PipelineRun"): &v1beta1.PipelineRun{},
// v1
v1.SchemeGroupVersion.WithKind("Task"): &v1.Task{},
v1.SchemeGroupVersion.WithKind("Pipeline"): &v1.Pipeline{},
v1.SchemeGroupVersion.WithKind("TaskRun"): &v1.TaskRun{},
v1.SchemeGroupVersion.WithKind("Task"): &v1.Task{},
v1.SchemeGroupVersion.WithKind("Pipeline"): &v1.Pipeline{},
v1.SchemeGroupVersion.WithKind("TaskRun"): &v1.TaskRun{},
v1.SchemeGroupVersion.WithKind("PipelineRun"): &v1.PipelineRun{},

// resolution
// v1alpha1
Expand Down Expand Up @@ -173,6 +174,14 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro
v1GroupVersion: &v1.TaskRun{},
},
},
v1.Kind("PipelineRun"): {
DefinitionName: pipeline.PipelineRunResource.String(),
HubVersion: v1beta1GroupVersion,
Zygotes: map[string]conversion.ConvertibleObject{
v1beta1GroupVersion: &v1beta1.PipelineRun{},
v1GroupVersion: &v1.PipelineRun{},
},
},
},

// A function that infuses the context passed to ConvertTo/ConvertFrom/SetDefaults with custom metadata
Expand Down
31 changes: 31 additions & 0 deletions config/300-pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: PipelineRun
plural: pipelineruns
Expand Down

0 comments on commit d26556b

Please sign in to comment.