diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 4aacc24148b..adfa1c68316 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -52,6 +52,7 @@ import ( var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ // v1alpha1 v1alpha1.SchemeGroupVersion.WithKind("VerificationPolicy"): &v1alpha1.VerificationPolicy{}, + v1alpha1.SchemeGroupVersion.WithKind("StepAction"): &v1alpha1.StepAction{}, // v1beta1 v1beta1.SchemeGroupVersion.WithKind("Pipeline"): &v1beta1.Pipeline{}, v1beta1.SchemeGroupVersion.WithKind("Task"): &v1beta1.Task{}, @@ -152,6 +153,7 @@ func newConfigValidationController(name string) func(context.Context, configmap. func newConversionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { var ( + v1alpha1GroupVersion = v1alpha1.SchemeGroupVersion.Version v1beta1GroupVersion = v1beta1.SchemeGroupVersion.Version v1GroupVersion = v1.SchemeGroupVersion.Version resolutionv1alpha1GroupVersion = resolutionv1alpha1.SchemeGroupVersion.Version @@ -169,6 +171,13 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro // conversions to and from all types. // "Zygotes" are the supported versions. map[schema.GroupKind]conversion.GroupKindConversion{ + v1alpha1.Kind("StepAction"): { + DefinitionName: pipeline.StepActionResource.String(), + HubVersion: v1alpha1GroupVersion, + Zygotes: map[string]conversion.ConvertibleObject{ + v1alpha1GroupVersion: &v1alpha1.StepAction{}, + }, + }, v1.Kind("Task"): { DefinitionName: pipeline.TaskResource.String(), HubVersion: v1beta1GroupVersion, diff --git a/config/200-clusterrole.yaml b/config/200-clusterrole.yaml index 4acffe6aa6a..2fd97b4a9f0 100644 --- a/config/200-clusterrole.yaml +++ b/config/200-clusterrole.yaml @@ -32,7 +32,7 @@ rules: # Controller needs cluster access to all of the CRDs that it is responsible for # managing. - apiGroups: ["tekton.dev"] - resources: ["tasks", "clustertasks", "taskruns", "pipelines", "pipelineruns", "customruns"] + resources: ["tasks", "clustertasks", "taskruns", "pipelines", "pipelineruns", "customruns", "stepactions"] verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] - apiGroups: ["tekton.dev"] resources: ["verificationpolicies"] @@ -41,7 +41,7 @@ rules: resources: ["taskruns/finalizers", "pipelineruns/finalizers", "customruns/finalizers"] verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] - apiGroups: ["tekton.dev"] - resources: ["tasks/status", "clustertasks/status", "taskruns/status", "pipelines/status", "pipelineruns/status", "customruns/status", "verificationpolicies/status"] + resources: ["tasks/status", "clustertasks/status", "taskruns/status", "pipelines/status", "pipelineruns/status", "customruns/status", "verificationpolicies/status", "stepactions/status"] verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] # resolution.tekton.dev - apiGroups: ["resolution.tekton.dev"] @@ -98,6 +98,7 @@ rules: - resolutionrequests.resolution.tekton.dev - customruns.tekton.dev - verificationpolicies.tekton.dev + - stepactions.tekton.dev # knative.dev/pkg needs list/watch permissions to set up informers for the webhook. - apiGroups: ["apiextensions.k8s.io"] resources: ["customresourcedefinitions"] diff --git a/config/300-stepaction.yaml b/config/300-stepaction.yaml new file mode 100644 index 00000000000..46b7a54a0c8 --- /dev/null +++ b/config/300-stepaction.yaml @@ -0,0 +1,61 @@ +# Copyright 2023 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: stepactions.tekton.dev + labels: + app.kubernetes.io/instance: default + app.kubernetes.io/part-of: tekton-pipelines + pipeline.tekton.dev/release: "devel" + version: "devel" +spec: + group: tekton.dev + preserveUnknownFields: false + versions: + - name: v1alpha1 + served: true + storage: true + 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 + # Opt into the status subresource so metadata.generation + # starts to increment + subresources: + status: {} + names: + kind: StepAction + plural: stepactions + singular: stepaction + categories: + - tekton + - tekton-pipelines + scope: Namespaced + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: ["v1beta1", "v1"] + clientConfig: + service: + name: tekton-pipelines-webhook + namespace: tekton-pipelines diff --git a/config/clusterrole-aggregate-edit.yaml b/config/clusterrole-aggregate-edit.yaml index 8f5b79b189e..fc67811f2c1 100644 --- a/config/clusterrole-aggregate-edit.yaml +++ b/config/clusterrole-aggregate-edit.yaml @@ -31,6 +31,7 @@ rules: - pipelineruns - runs - customruns + - stepactions verbs: - create - delete diff --git a/config/clusterrole-aggregate-view.yaml b/config/clusterrole-aggregate-view.yaml index 766d76bc16f..2edc274de56 100644 --- a/config/clusterrole-aggregate-view.yaml +++ b/config/clusterrole-aggregate-view.yaml @@ -30,6 +30,7 @@ rules: - pipelineruns - runs - customruns + - stepactions verbs: - get - list diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index 573745f4a61..bb7b1ea98ce 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -6120,6 +6120,8 @@ Resource Types: