operator-framework / operator-framework/operator-sdk

`+operator-sdk:csv:customresourcedefinitions:order` does not change order in bundle

Open
#6,771 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language/go lifecycle/frozen
Dominant language
Go
Stars
7.7k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

What did you do?

Created new structure with operator-sdk version v1.34.2. I ran the following commands:

mkdir 1_34_2
cd 1_34_2
operator-sdk init --project-name=oadp-operator --repo=github.com/openshift/oadp-operator --domain=openshift.io
# manually changed CONTROLLER_TOOLS_VERSION to v0.14.0 in Makefile because I am using go1.22.3 
operator-sdk create api --group oadp --version v1alpha1 --kind DataProtectionApplication --resource --controller
operator-sdk create api --group oadp --version v1alpha1 --kind CloudStorage --resource --controller
make bundle
# fill inputs with "test"

Then checked that in 1_34_2/config/manifests/bases/oadp-operator.clusterserviceversion.yaml and 1_34_2/bundle/manifests/oadp-operator.clusterserviceversion.yaml files, CloudStorage appears first then DataProtectionApplication (sorted alphabetically by default?) in spec.customresourcedefinitions.owned list.

Then, I manually added // +operator-sdk:csv:customresourcedefinitions:order=1 in 1_34_2/api/v1alpha1/dataprotectionapplication_types.go and ran make bunble again. In 1_34_2/config/manifests/bases/oadp-operator.clusterserviceversion.yaml the order changes, and DataProtectionApplication appears first, but not in 1_34_2/bundle/manifests/oadp-operator.clusterserviceversion.yaml.

What did you expect to see?

CRDs appearing in the order I desire in bundle CSV file.

What did you see instead? Under which circumstances?

CRDs appearing sorted alphabetically in bundle CSV file.

Environment

Operator type:

/language go

Kubernetes cluster type:

Not releated

$ operator-sdk version

operator-sdk version: "v1.34.2", commit: "81dd3cb24b8744de03d312c1ba23bfc617044005", kubernetes version: "1.28.0", go version: "go1.21.10", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.22.3 linux/amd64

$ kubectl version

Not related

Possible Solution

Not at the moment. (Manual workaround is changing order after running make bundle)

Additional context

This is important in my opinion, because UIs (like https://operatorhub.io/ and OpenShift) use the order the CRD appear in spec.customresourcedefinitions.owned list to render them. This way, developers can use the order to show priority of CRDs to users.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with make bundle and compare config/manifests/bases/oadp-operator.clusterserviceversion.yaml with bundle/manifests/oadp-operator.clusterserviceversion.yaml. Trace how the +operator-sdk:csv:customresourcedefinitions:order marker affects the generated CSV, then ensure the requested order is preserved in the bundle CSV and verify both files.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.