operator-sdk icon indicating copy to clipboard operation
operator-sdk copied to clipboard

New Variables values are not passing to controller after upgrading V1alpha1 to V4

Open psaini79 opened this issue 9 months ago • 3 comments
trafficstars

Bug Report

What did you do?

We have controller which we upgraded from v1alpha1 to v4 and everything works fine. We changed storageversion in _types.go and now it is in V4.

Everything is working fine but when we are adding new field in _types.go present in v4 and after compilation when we are passing values through yaml to these new field, the value sin controller are coming as empty or null.

What did you expect to see?

Values of the newly added variable must pass to controller.

What did you see instead? Under which circumstances?

Values are not getting passed to controller.

Environment

Operator type:

/language go

Kubernetes cluster type:

$ operator-sdk version

operator-sdk version operator-sdk version: "v1.37.0", commit: "819984d4c1a51c8ff2ef6c23944554148ace0752", kubernetes version: "1.29.0", go version: "go1.21.13", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.23.2 linux/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"29", GitVersion:"v1.29.3+2.el8", GitCommit:"5052cd42d1115a389d3fbbc1105dd36c7e4d1cb7", GitTreeState:"clean", BuildDate:"2024-05-15T16:08:37Z", GoVersion:"go1.21.8", Compiler:"gc", Platform:"linux/amd64"} WARNING: version difference between client (1.21) and server (1.29) exceeds the supported minor version skew of +/-1

psaini79 avatar Feb 12 '25 06:02 psaini79

Please let me know if you need any file or logfile for the review.

psaini79 avatar Feb 12 '25 17:02 psaini79

Any pointer or update on this?

psaini79 avatar Apr 03 '25 16:04 psaini79

I debugged this issue and found that webhook was causing the problem. We had v1apha1 api version and we added the support for apiversion V4. We also had the webhooks for v1alpha1 and v4 but when we are running controllers and created the app object for api version v4, we observed that v1alpha1 webhook is passing the crd instance and somehow the values of the new fields are becoming null.

We now completely switched to the V4 webhooks and removed the default/validation/update/delete webhook from v1alpha1. I am wondering what is the best strategy when users upgrade the api version to handle the webhooks? Is there any documentation in operator-sdk for the same?

psaini79 avatar Apr 09 '25 16:04 psaini79

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-bot avatar Jul 09 '25 01:07 openshift-bot

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-bot avatar Aug 08 '25 08:08 openshift-bot

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-bot avatar Sep 08 '25 00:09 openshift-bot

@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-sigs/prow repository.

openshift-ci[bot] avatar Sep 08 '25 00:09 openshift-ci[bot]