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

unable to build kubernetes objects from release manifest: BuildConfig / ImageStream #7073

Closed
Andrei-Stepanov opened this issue Nov 25, 2019 · 8 comments

Comments

@Andrei-Stepanov
Copy link

Hello, please help to deploy templates with OpenShift resources:

helm install -g --debug --dry-run  ./kai 
install.go:148: [debug] Original chart version: ""
install.go:165: [debug] CHART PATH: /home/astepano/shared/osci/ocp/kai/kai

Error: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "BuildConfig" in version "v1", unable to recognize "": no matches for kind "ImageStream" in version "v1"]
helm.go:76: [debug] [unable to recognize "": no matches for kind "BuildConfig" in version "v1", unable to recognize "": no matches for kind "ImageStream" in version "v1"]
unable to build kubernetes objects from release manifest
helm.sh/helm/v3/pkg/action.(*Install).Run
	/home/circleci/helm.sh/helm/pkg/action/install.go:231
main.runInstall
	/home/circleci/helm.sh/helm/cmd/helm/install.go:209
main.newInstallCmd.func1
	/home/circleci/helm.sh/helm/cmd/helm/install.go:115
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
	/home/circleci/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357
 helm install -g --debug --dry-run  ./kai --validate=false
Error: unknown flag: --validate
helm.go:76: [debug] unknown flag: --validate
helm version                   
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
kubectl version       
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.1+5115d708d7", GitCommit:"fff65cf", GitTreeState:"clean", BuildDate:"2017-11-03T15:44:55Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2019-10-31T21:06:55Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
@mattfarina
Copy link
Collaborator

Does this only happen on a dry run or does it also happen on a normal install? Resources that are not core resources need to be pulled down and cached. I am curious helm has talked with the kuberentes API prior to performing this operation.

@Andrei-Stepanov
Copy link
Author

@mattfarina hi. This happens in both cases:

helm install -g --debug   ./kai                 
install.go:148: [debug] Original chart version: ""
install.go:165: [debug] CHART PATH: /home/astepano/shared/osci/ocp/kai/kai

Error: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "BuildConfig" in version "v1", unable to recognize "": no matches for kind "ImageStream" in version "v1"]
helm.go:76: [debug] [unable to recognize "": no matches for kind "BuildConfig" in version "v1", unable to recognize "": no matches for kind "ImageStream" in version "v1"]
unable to build kubernetes objects from release manifest
helm.sh/helm/v3/pkg/action.(*Install).Run
	/home/circleci/helm.sh/helm/pkg/action/install.go:231

@danielefranceschi
Copy link

BuildConfig is an OpenShift-specific resource, maybe you have to specify
apiVersion: build.openshift.io/v1 in the yaml template. (at least in OpenShift v4.x, but seems that you are using v3.x)

@Andrei-Stepanov
Copy link
Author

@danielefranceschi hello! Thank you for your help.

It works in this way:

apiVersion: image.openshift.io/v1
kind: ImageStream
apiVersion: build.openshift.io/v1
kind: BuildConfig

The ticket can be closed! I would add this documentation. But, I do not know where.

@danielefranceschi thank you!

@danielefranceschi
Copy link

Glad to help :)

I'm not a go+k8s-api expert (yet), but I'd like to make an hypotesis:

IMHO the cause is that the implementation of Interface.Build

// Validates against OpenAPI schema if validate is true.
Build(reader io.Reader, validate bool) (ResourceList, error)
verifies the yaml on the server API, as it's called this way
resources, err := i.cfg.KubeClient.Build(bytes.NewBufferString(rel.Manifest), true)

OpenShift client oc does some magic1 hiding you the apiVersion stuff, but helm (via the k8s client) calls the k8s-api directly, so validation happens "server-side" just like all CRDs.

1 RH, I hate you and your backward-compatibility policy with legacy stuff

@hickeyma
Copy link
Contributor

Closing as issue answered.

@younes0925
Copy link

Hey @Andrei-Stepanov ,

I tested with your configuration and I am still getting the same exception.

client.go:87: [debug] creating 8 resource(s)
install.go:312: [debug] Install failed and atomic is set, uninstalling release
uninstall.go:91: [debug] uninstall: Deleting cl
client.go:220: [debug] Starting delete for "claim-frontend" Service
client.go:220: [debug] Starting delete for "claim-backend" Service
client.go:220: [debug] Starting delete for "claim-frontend" Deployment
client.go:220: [debug] Starting delete for "claim-backend" Deployment
client.go:220: [debug] Starting delete for "claim-ng-frontend" ConfigMap
client.go:220: [debug] Starting delete for "claim-ng-backend" ConfigMap
client.go:220: [debug] Starting delete for "php_fpm_buildConfig_1" BuildConfig
client.go:245: [debug] buildconfigs.build.openshift.io "php_fpm_buildConfig_1" not found
client.go:220: [debug] Starting delete for "php-fpm-1" ImageStream
uninstall.go:124: [debug] purge requested for cl
Error: release cl failed, and has been uninstalled due to atomic being set: BuildConfig in version "v1" cannot be handled as a BuildConfig: v1.BuildConfig.Spec: v1.BuildConfigSpec.CommonSpec: NodeSelector: ReadString: expects " or n, but found t, error found in #10 byte of ...|anbuild":true},"outp|..., bigger context ...|BuildsHistoryLimit":3,"nodeSelector":{"canbuild":true},"output":{"to":{"kind":"ImageStreamTag","name|...
helm.go:76: [debug] BuildConfig in version "v1" cannot be handled as a BuildConfig: v1.BuildConfig.Spec: v1.BuildConfigSpec.CommonSpec: NodeSelector: ReadString: expects " or n, but found t, error found in #10 byte of ...|anbuild":true},"outp|..., bigger context ...|BuildsHistoryLimit":3,"nodeSelector":{"canbuild":true},"output":{"to":{"kind":"ImageStreamTag","name|...
release cl failed, and has been uninstalled due to atomic being set
helm.sh/helm/v3/pkg/action.(*Install).failRelease
	/home/circleci/helm.sh/helm/pkg/action/install.go:320
helm.sh/helm/v3/pkg/action.(*Install).Run
	/home/circleci/helm.sh/helm/pkg/action/install.go:279
main.runInstall
	/home/circleci/helm.sh/helm/cmd/helm/install.go:209
main.newInstallCmd.func1
	/home/circleci/helm.sh/helm/cmd/helm/install.go:115
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
	/home/circleci/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357

BuildConfig template:

apiVersion: build.openshift.io/v1
kind: BuildConfig

ImageStream template:

apiVersion: image.openshift.io/v1
kind: ImageStream

Can you please advice on this ?, otherways reopen this issue.

Thanks.

@Andrei-Stepanov
Copy link
Author

@younes0925 hello. You have different error message than I had. Sounds like you have something wrong in template. You can post your template. Or look at my :

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: jenkins-osci-slave
spec:
  nodeSelector: {}
  output:
    to:
      kind: ImageStreamTag
      name: jenkins-osci-slave:latest
  resources: {}
  source:
    contextDir: ''
    git:
      ref: ''
      uri: ''
    type: Git
  strategy:
    dockerStrategy:
      env:
        - name: GIT_SSL_NO_VERIFY
          value: 'true'
    type: Docker
  triggers:
  - type: ConfigChange
status:
  lastVersion: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants