Skip to content

Commit

Permalink
Introducing the StepAction CRD
Browse files Browse the repository at this point in the history
This PR introduces the StepAction CRD in `v1alpha1`. This is not the complete CRD. As we add support for `params`, `results` etc. we will introduce in follow-up PRs.

It is the first of many implementation PRs as described in issue:  tektoncd#7259
  • Loading branch information
chitrangpatel committed Oct 23, 2023
1 parent 5066b40 commit d944cbb
Show file tree
Hide file tree
Showing 37 changed files with 3,852 additions and 3 deletions.
9 changes: 9 additions & 0 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions config/200-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
61 changes: 61 additions & 0 deletions config/300-stepaction.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions config/clusterrole-aggregate-edit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rules:
- pipelineruns
- runs
- customruns
- stepactions
verbs:
- create
- delete
Expand Down
1 change: 1 addition & 0 deletions config/clusterrole-aggregate-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ rules:
- pipelineruns
- runs
- customruns
- stepactions
verbs:
- get
- list
Expand Down
Loading

0 comments on commit d944cbb

Please sign in to comment.