Skip to content

Commit

Permalink
Add V1 version of Pipeline CRD
Browse files Browse the repository at this point in the history
This commit adds a v1 version of the Pipeline CRD, and support to the webhook.
Since this version is not served, it will not be available to users.
  • Loading branch information
JeromeJu authored and tekton-robot committed Aug 24, 2022
1 parent 7843f99 commit 472f51c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 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.PipelineResource.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
22 changes: 19 additions & 3 deletions config/300-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ spec:
- name: v1beta1
served: true
storage: true
# Opt into the status subresource so metadata.generation
# starts to increment
subresources:
status: {}
schema:
Expand All @@ -43,6 +41,24 @@ 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
- name: v1
served: false
storage: false
schema:
openAPIV3Schema:
type: object
# OpenAPIV3 schema allows Kubernetes to perform validation on the schema fields
# and use the schema in tooling such as `kubectl explain`.
# Using "x-kubernetes-preserve-unknown-fields: true"
# at the root of the schema (or within it) allows arbitrary fields.
# We currently perform our own validation separately.
# See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema
# for more info.
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 +70,7 @@ spec:
conversion:
strategy: Webhook
webhook:
conversionReviewVersions: ["v1beta1"]
conversionReviewVersions: ["v1beta1", "v1"]
clientConfig:
service:
name: tekton-pipelines-webhook
Expand Down

0 comments on commit 472f51c

Please sign in to comment.