forked from tektoncd/triggers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tekton.go
28 lines (25 loc) · 799 Bytes
/
tekton.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package tekton
import (
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/triggers/pkg/client/dynamic/clientset"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
)
var allowedTektonTypes = map[string][]string{
"v1alpha1": {"pipelineresources", "pipelineruns", "taskruns", "pipelines", "clustertasks", "tasks", "conditions"},
}
// WithClient adds Tekton related clients to the Dynamic client.
func WithClient(client dynamic.Interface) clientset.Option {
return func(cs *clientset.Clientset) {
for version, resources := range allowedTektonTypes {
for _, resource := range resources {
r := schema.GroupVersionResource{
Group: pipeline.GroupName,
Version: version,
Resource: resource,
}
cs.Add(r, client)
}
}
}
}