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

[BUG] failed to decode: no kind "Pipeline" is registered for version "tekton.dev/v1beta1" #606

Open
PascalTurbo opened this issue Aug 2, 2023 · 1 comment
Labels
decision pending Still deciding whether this is something we should do

Comments

@PascalTurbo
Copy link

System info:

  • OS: MacOS, also Docker Image

Describe the bug
kube-linter returns an error (see below) but the HelmChart is valid and installable

To Reproduce
Checkout this code https://github.com/PascalTurbo/stackrox-kube-linter-bug-example and run kube-linter lint -v chart

Output

kube-linter lint -v chart

Warning: failed to load object from chart/templates/pipeline.yaml: failed to decode: no kind "Pipeline" is registered for version "tekton.dev/v1beta1" in scheme "pkg/runtime/scheme.go:100"
Warning: no valid objects found.
@PascalTurbo PascalTurbo changed the title [BUG] [BUG] failed to decode: no kind "Pipeline" is registered for version "tekton.dev/v1beta1" Aug 2, 2023
@janisz
Copy link
Collaborator

janisz commented Aug 7, 2023

We do not registered tekton schema. Probably we should do that. We have an issue about this:

Below patch solves this issue but it adds new dependency and that will be hard to maintain. On the other hand we could add schemas for mature project that are part of CNCF or some other org (e.g. we already have exception for OpenShift)

diff --git a/go.mod b/go.mod
index 3d2db6e..4d36d51 100644
--- a/go.mod
+++ b/go.mod
@@ -18,17 +18,20 @@ require (
 	github.com/spf13/pflag v1.0.5
 	github.com/spf13/viper v1.16.0
 	github.com/stretchr/testify v1.8.4
+	github.com/tektoncd/pipeline v0.40.0
 	helm.sh/helm/v3 v3.12.2
 	k8s.io/api v0.27.4
 	k8s.io/apimachinery v0.27.4
 	k8s.io/cli-runtime v0.27.4
 	k8s.io/client-go v0.27.4
-	k8s.io/gengo v0.0.0-20220902162205-c0856e24416d
+	k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9
 )
 
diff --git a/pkg/lintcontext/parse_yaml.go b/pkg/lintcontext/parse_yaml.go
index 6a6b6f3..ce5b84e 100644
--- a/pkg/lintcontext/parse_yaml.go
+++ b/pkg/lintcontext/parse_yaml.go
@@ -13,6 +13,7 @@ import (
 	y "github.com/ghodss/yaml"
 	ocsAppsV1 "github.com/openshift/api/apps/v1"
 	"github.com/pkg/errors"
+	tekton "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
 	"golang.stackrox.io/kube-linter/pkg/k8sutil"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chart/loader"
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? y
@@ -41,7 +42,7 @@ func init() {
 	clientScheme := scheme.Scheme
 
 	// Add OpenShift and Autoscaling schema
-	schemeBuilder := runtime.NewSchemeBuilder(ocsAppsV1.AddToScheme, autoscalingV2Beta1.AddToScheme)
+	schemeBuilder := runtime.NewSchemeBuilder(ocsAppsV1.AddToScheme, autoscalingV2Beta1.AddToScheme, tekton.AddToScheme)
 	if err := schemeBuilder.AddToScheme(clientScheme); err != nil {
 		panic(fmt.Sprintf("Can not add OpenShift schema %v", err))
 	}

@janisz janisz added the decision pending Still deciding whether this is something we should do label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision pending Still deciding whether this is something we should do
Projects
None yet
Development

No branches or pull requests

2 participants