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

operator-sdk generate kustomize manifests -q generates invalid config/manifests/kustomization.yaml #3979

Closed
mdbooth opened this issue Oct 6, 2020 · 7 comments
Assignees
Labels
language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/needs-information Indicates an issue needs more information in order to work on it.
Milestone

Comments

@mdbooth
Copy link

mdbooth commented Oct 6, 2020

Bug Report

Trying to work out why my generated CSV was incomplete after executing make bundle:

$ make bundle
/home/mbooth/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
operator-sdk generate kustomize manifests -q
cd config/manager && /usr/bin/kustomize edit set image controller=ovn-central-controller:latest
/usr/bin/kustomize build config/manifests | operator-sdk generate bundle -q --overwrite --version 0.0.1
Error: rawResources failed to read Resources: Load from path ../default failed: '../default' must be a file (got d='/home/mbooth/src/osp-k8s/ovn-central-operator/config/default')

INFO[0000] Building annotations.yaml
INFO[0000] Writing annotations.yaml in /home/mbooth/src/osp-k8s/ovn-central-operator/bundle/metadata
INFO[0000] Building Dockerfile
INFO[0000] Writing bundle.Dockerfile in /home/mbooth/src/osp-k8s/ovn-central-operator
operator-sdk bundle validate ./bundle
INFO[0000] Found annotations file                        bundle-dir=bundle container-tool=docker
INFO[0000] Could not find optional dependencies file     bundle-dir=bundle container-tool=docker
ERRO[0000] error validating content in bundle/manifests: error loading objs in directory: bundle manifests dir has hidden file: bundle/manifests/.ovn-central-operator.clusterserviceversion.yaml.swp
make: *** [Makefile:125: bundle] Error 1

From the above, failed to read Resources: Load from path ../default failed appears to be because the generated config/manifests/kustomization.yaml is invalid. The contents of this file are:

resources:
- ../default
- ../samples
- ../scorecard

This file is generated by operator-sdk generate kustomize manifests -q. Guessing resources should be bases there, but there's a secondary issue. I fixed the file manually to contain:

bases:
- ../default
- ../samples
- ../scorecard

but then I get:

$ kustomize build config/manifests
Error: AccumulateTarget: found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010168), options:(*types.GenArgs)(0xc0003bb700)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000102c0), options:(*types.GenArgs)(0xc0003bb700)}

AFAICT this is a limitation of kustomize: (kubernetes-sigs/kustomize#642)

To work round it I commented out scorecard:

bases:
- ../default
- ../samples
#- ../scorecard

And now it works and make bundle generates a complete CSV.

Environment

Operator type:

/language go

Kubernetes cluster type:

OpenShift

$ operator-sdk version

operator-sdk version: "v1.0.1", commit: "4169b318b578156ed56530f373d328276d040a1b", kubernetes version: "v1.18.2", go version: "go1.13.15 linux/amd64", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.13.15 linux/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.8-beta.0", GitCommit:"6c143d35bb11d74970e7bc0b6c45b6bfdffc0bd4", GitTreeState:"archive", BuildDate:"2020-01-02T00:00:00Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.3+b0068a8", GitCommit:"b0068a8", GitTreeState:"clean", BuildDate:"2020-09-11T20:03:06Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

@ukclivecox
Copy link

ukclivecox commented Oct 6, 2020

So this default is wrong? Missing bases ?

// kustomization.yaml file contents for manifests. this should always be written to
// config/manifests/kustomization.yaml since it only references files in config.
const manifestsKustomization = `resources:
- ../default
- ../samples
- ../scorecard

@ukclivecox
Copy link

ukclivecox commented Oct 7, 2020

Actually looks like the bases folder is just used in operator-sdk generate bundle where assumes the name of the csv file from the project name.

@estroz
Copy link
Member

estroz commented Oct 7, 2020

@mdbooth the kustomization.yaml file is not invalid; the bases directive has been deprecated since kustomize v2.1.0, and is superseded by resources. What kustomize version are you using? Can you try doing:

rm -f $(command -v kustomize)
make kustomize bundle

@estroz estroz added the triage/support Indicates an issue that is a support question. label Oct 7, 2020
@estroz estroz self-assigned this Oct 7, 2020
@jberkhahn jberkhahn added the language/go Issue is related to a Go operator project label Oct 12, 2020
@jberkhahn jberkhahn added this to the Backlog milestone Oct 12, 2020
@estroz estroz added triage/needs-information Indicates an issue needs more information in order to work on it. and removed triage/support Indicates an issue that is a support question. labels Dec 18, 2020
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 18, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 17, 2021
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this as completed May 17, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 17, 2021

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

6 participants