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

Create operator-sdk update guidelines #1540

Open
mateusoliveira43 opened this issue Oct 2, 2024 · 1 comment
Open

Create operator-sdk update guidelines #1540

mateusoliveira43 opened this issue Oct 2, 2024 · 1 comment
Assignees

Comments

@mateusoliveira43
Copy link
Contributor

Problem

Currently, we do not have any strategy to update operator-sdk version used by the project. Last time we updated it, for example, was to fix problem fixed in newer releases. Reference #1398

But we only updated the executable version, without any updates to project structure, which can cause operator-sdk commands and functionalities not work properly.

Currently, some of operator-sdk functionalities are broken in the project.

Example

These lines are wrong, pointing to an object that does not exist (buckets.oadp.openshift.io)

//+kubebuilder:rbac:groups=oadp.openshift.io,resources=buckets,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=corev1,resources=secrets,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=oadp.openshift.io,resources=buckets/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=oadp.openshift.io,resources=buckets/finalizers,verbs=update

If we update it and run make bundle, config/rbac/role.yaml is not updated.

operator-sdk uses kubebuilder under the hood

Solution

As proposed previously in #1250 and already being applied in NAC project (references https://github.com/migtools/oadp-non-admin/blob/master/docs/CONTRIBUTING.md#upgrade-kubebuilder-version https://github.com/migtools/oadp-non-admin/blob/master/docs/architecture.md#kubebuilde), we should update all necessary places when updating operator-sdk version.

To avoid human mistakes of forgetting to apply a change describe in operator-sdk documentation, we should do this update following these instructions:

Download both current and new version of operator-sdk from https://github.com/operator-framework/operator-sdk/releases and run

mkdir current
mkdir new
cd current
# Run operator-sdk commands pointing to operator-sdk executable with the current version
cd ..
cd new
# Run operator-sdk commands pointing to operator-sdk executable with the new version
cd ..
diff -ruN current new > operator-sdk-upgrade.diff
patch -p1 --verbose -d ./ -i operator-sdk-upgrade.diff
# Resolve possible conflicts

Because last step can fail, needing human intervention, do not know if it is necessary to create a script

Pros

  • Ensures each update does not break any operator-sdk commands or functionalities
  • Get updates from newer versions (Example: if we already followed these steps, we could change between docker and podman in Makefile)
  • Avoid things getting (very) outdated
    image: quay.io/operator-framework/scorecard-test:v1.10.0

Cons

  • Not just a string change
@kaovilai
Copy link
Member

kaovilai commented Oct 2, 2024

diff -ruN current new > operator-sdk-upgrade.diff
patch -p1 --verbose -d ./ -i operator-sdk-upgrade.diff

This is a blind patch albeit still better than before.

The full steps for each new operator-sdk upgrade is already outlined in docs at https://sdk.operatorframework.io/docs/upgrading-sdk-version/

The intent by operator-sdk authors per my understanding is for you to follow every step there.

For example, when upgrading to https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.34.0/ you are expected to make changes to your makefile.

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

2 participants