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

Order of generated webhooks is not stable #5022

Closed
amisevsk opened this issue Jun 29, 2021 · 2 comments
Closed

Order of generated webhooks is not stable #5022

amisevsk opened this issue Jun 29, 2021 · 2 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/go Issue is related to a Go operator project olm-integration Issue relates to the OLM integration release-blocker This issue blocks the parent release milestone
Milestone

Comments

@amisevsk
Copy link

amisevsk commented Jun 29, 2021

Bug Report

What did you do?

Running operator-sdk generate bundle does not write CSV webhookDefinitions in a stable order. This is an issue because we commit the bundle files to our repo and want to use CI to validate that they are up to date on every commit.

What did you expect to see?

Webhook definitions are always in same order

What did you see instead? Under which circumstances?

Running operator-sdk generate bundle multiple times will make unnecessary changes to files.

Environment

Operator type:

/language go

Kubernetes cluster type:

OpenShift

$ operator-sdk version

v1.8.0

$ go version (if language is Go)

go version go1.16.4 linux/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0+5fbfd19", GitCommit:"5fbfd197c16d3c5facbaa1d7b9f3ea58cf6b36e9", GitTreeState:"clean", BuildDate:"2021-02-17T15:21:33Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

I suspect it's due to Go's random map iteration order

Additional context

To reproduce, clone https://github.com/amisevsk/devworkspace-operator/tree/conversion-webhooks-in-main and run make generate_olm_bundle_yaml a few times.

@openshift-ci openshift-ci bot added the language/go Issue is related to a Go operator project label Jun 29, 2021
@estroz
Copy link
Member

estroz commented Jul 1, 2021

All webhooks should be sorted by generate bundle for stability, so this is a bug.

/kind bug

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 1, 2021
@estroz estroz added the olm-integration Issue relates to the OLM integration label Jul 1, 2021
amisevsk added a commit to amisevsk/devworkspace-operator that referenced this issue Jul 6, 2021
Add workaround for issue [1] when generating webhookdefinitions in the
ClusterServiceVersion by using yq to directly sort the array. Also add
documentation explaining current workarounds, since they're strange at
first glance.

[1] - operator-framework/operator-sdk#5022

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
amisevsk added a commit to devfile/devworkspace-operator that referenced this issue Jul 8, 2021
Add workaround for issue [1] when generating webhookdefinitions in the
ClusterServiceVersion by using yq to directly sort the array. Also add
documentation explaining current workarounds, since they're strange at
first glance.

[1] - operator-framework/operator-sdk#5022

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@kensipe kensipe added this to the v1.11.0 milestone Jul 12, 2021
@jberkhahn jberkhahn modified the milestones: v1.11.0, v1.12.0 Aug 11, 2021
@kensipe kensipe added the release-blocker This issue blocks the parent release milestone label Sep 1, 2021
@jmrodri
Copy link
Member

jmrodri commented Sep 7, 2021

Fixed by PR #5177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. language/go Issue is related to a Go operator project olm-integration Issue relates to the OLM integration release-blocker This issue blocks the parent release milestone
Projects
None yet
Development

No branches or pull requests

5 participants