Skip to content

Commit

Permalink
Add V1 version of Pipeline CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeJu committed Aug 19, 2022
1 parent 7dfe4ed commit 7ec61c5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ 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("Task"): &v1.Task{},
v1.SchemeGroupVersion.WithKind("Pipeline"): &v1.Pipeline{},
}

func newDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
Expand Down Expand Up @@ -150,6 +151,14 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro
v1GroupVersion: &v1.Task{},
},
},
v1.Kind("Pipeline"): {
DefinitionName: pipeline.TaskResource.String(),
HubVersion: v1beta1GroupVersion,
Zygotes: map[string]conversion.ConvertibleObject{
v1beta1GroupVersion: &v1beta1.Pipeline{},
v1GroupVersion: &v1.Pipeline{},
},
},
},

// A function that infuses the context passed to ConvertTo/ConvertFrom/SetDefaults with custom metadata
Expand Down
20 changes: 19 additions & 1 deletion config/300-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ spec:
# starts to increment
subresources:
status: {}
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
- name: v1
served: false
storage: false
schema:
openAPIV3Schema:
type: object
Expand All @@ -43,6 +57,10 @@ spec:
# 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
# Opt into the status subresource so metadata.generation
# starts to increment
subresources:
status: {}
names:
kind: Pipeline
plural: pipelines
Expand All @@ -54,7 +72,7 @@ spec:
conversion:
strategy: Webhook
webhook:
conversionReviewVersions: ["v1beta1"]
conversionReviewVersions: ["v1beta1", "v1"]
clientConfig:
service:
name: tekton-pipelines-webhook
Expand Down

0 comments on commit 7ec61c5

Please sign in to comment.