Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore upgrade tekton pipelines #1621

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ verify-code-unchanged:

CONTROLLER_GEN := $(GOPATH)/bin/controller-gen
$(CONTROLLER_GEN):
$(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.0
$(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5

crd-manifests: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) crd:maxDescLen=0 paths="./pkg/apis/lighthouse/v1alpha1/..." output:crd:artifacts:config=crds
Expand Down
1 change: 1 addition & 0 deletions charts/lighthouse/templates/tekton-controller-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rules:
- tekton.dev
resources:
- pipelines
- taskruns
verbs:
- get
- apiGroups:
Expand Down
17 changes: 15 additions & 2 deletions cmd/foghorn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import (
"github.com/jenkins-x/lighthouse/pkg/foghorn"
"github.com/jenkins-x/lighthouse/pkg/logrusutil"
"github.com/sirupsen/logrus"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
)

type options struct {
Expand Down Expand Up @@ -38,7 +41,10 @@ func main() {

scheme := runtime.NewScheme()
if err := lighthousev1alpha1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
logrus.WithError(err).Fatal("Failed to register lighthousev1alpha1 scheme")
}
if err := pipelinev1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register tektoncd-pipelinev1 scheme")
}

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
Expand All @@ -51,7 +57,14 @@ func main() {
logrus.WithError(err).Fatal("Could not create kubeconfig")
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme, Namespace: o.namespace})
mgr, err := ctrl.NewManager(cfg, manager.Options{
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
o.namespace: {},
},
},
Scheme: scheme,
})
if err != nil {
logrus.WithError(err).Fatal("Unable to start manager")
}
Expand Down
26 changes: 20 additions & 6 deletions cmd/tektoncontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
"github.com/jenkins-x/lighthouse/pkg/interrupts"
"github.com/jenkins-x/lighthouse/pkg/logrusutil"
"github.com/sirupsen/logrus"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
)

type options struct {
Expand Down Expand Up @@ -45,10 +47,10 @@ func main() {

scheme := runtime.NewScheme()
if err := lighthousev1alpha1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
logrus.WithError(err).Fatal("Failed to register lighthousev1alpha1 scheme")
}
if err := pipelinev1beta1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
if err := pipelinev1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register tektoncd-pipelinev1 scheme")
}

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
Expand All @@ -61,12 +63,24 @@ func main() {
logrus.WithError(err).Fatal("Could not create kubeconfig")
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme, Namespace: o.namespace})
mgr, err := ctrl.NewManager(cfg, manager.Options{
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
o.namespace: {},
},
},
Scheme: scheme,
})
if err != nil {
logrus.WithError(err).Fatal("Unable to start manager")
}

lhJobReconciler := tektonengine.NewLighthouseJobReconciler(mgr.GetClient(), mgr.GetAPIReader(), mgr.GetScheme(), o.dashboardURL, o.dashboardTemplate, o.namespace)
tektonclient, _, _, _, err := clients.GetAPIClients()
if err != nil {
logrus.WithError(err).Fatal(err, "failed to get api clients")
}

lhJobReconciler := tektonengine.NewLighthouseJobReconciler(mgr.GetClient(), mgr.GetAPIReader(), mgr.GetScheme(), tektonclient, o.dashboardURL, o.dashboardTemplate, o.namespace)
if err = lhJobReconciler.SetupWithManager(mgr); err != nil {
logrus.WithError(err).Fatal("Unable to create controller")
}
Expand Down
24 changes: 11 additions & 13 deletions crds/lighthouse.jenkins.io_lighthousebreakpoints.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.16.5
name: lighthousebreakpoints.lighthouse.jenkins.io
spec:
group: lighthouse.jenkins.io
Expand All @@ -32,10 +30,16 @@ spec:
properties:
debug:
properties:
breakpoint:
items:
type: string
type: array
breakpoints:
properties:
beforeSteps:
items:
type: string
type: array
x-kubernetes-list-type: atomic
onFailure:
type: string
type: object
type: object
filter:
properties:
Expand All @@ -56,9 +60,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading
Loading