I'll Eat My Hat
I'll Eat My Hat

Reputation: 1344

Operator-SDK Error, "CRD is present in bundle but not defined in CSV"

I get the error "CRD is present in bundle but not defined in CSV" when I run make bundle.

The full output is

/Users/foobar/Documents/my-operator/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
operator-sdk generate kustomize manifests -q
cd config/manager && /Users/foobar/Documents/my-operator/bin/kustomize edit set image controller=registry.io/my-operator:latest
/Users/foobar/Documents/my-operator/bin/kustomize build config/manifests | operator-sdk generate bundle -q --overwrite --version 0.0.5  
Error: accumulating resources: 2 errors occurred:
        * accumulateFile error: "accumulating resources from '../samples': '/Users/foobar/Documents/my-operator/config/samples' must resolve to a file"
        * accumulateDirector error: "recursed accumulation of path '/Users/foobar/Documents/my-operator/config/samples': accumulating resources: 2 errors occurred:\n\t* accumulateFile error: \"accumulating resources from 'myapplicationui.yaml': evalsymlink failure on '/Users/foobar/Documents/my-operator/config/samples/myapplicationui.yaml' : lstat /Users/foobar/Documents/my-operator/config/samples/myapplicationui.yaml: no such file or directory\"\n\t* loader.New error: \"error loading myapplicationui.yaml with git: url lacks orgRepo: myapplicationui.yaml, dir: evalsymlink failure on '/Users/foobar/Documents/my-operator/config/samples/myapplicationui.yaml' : lstat /Users/foobar/Documents/my-operator/config/samples/myapplicationui.yaml: no such file or directory, get: invalid source string: myapplicationui.yaml\"\n\n"


INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /Users/foobar/Documents/my-operator/bundle/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /Users/foobar/Documents/my-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: Value myapplication.example.com/v1alpha1, Kind=MyApplication: CRD "myapplication.example.com/v1alpha1, Kind=MyApplication" is present in bundle "my-operator.v0.0.5" but not defined in CSV 
ERRO[0000] Error: Value myapplication.example.com/v1alpha1, Kind=MyApplicationUI: CRD "myapplication.example.com/v1alpha1, Kind=MyApplicationUI" is present in bundle "my-operator.v0.0.5" but not defined in CSV

What is the cause of this error?

Upvotes: 0

Views: 619

Answers (1)

I'll Eat My Hat
I'll Eat My Hat

Reputation: 1344

The error on the bottom is a red herring. The actual error is further up and uncolored when you experience it in person. Specifically, a Kustomize yaml is expecting an myapplicationui.yaml but can't find it.

This can easily happen when someone in your team attempts to rename files (e.g. to myapplicationui_sample.yaml) without checking all of the references.

Upvotes: 1

Related Questions