Skip to content

Order of generated webhooks is not stable #5022

@amisevsk

Description

@amisevsk

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.

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.language/goIssue is related to a Go operator projectolm-integrationIssue relates to the OLM integrationrelease-blockerThis issue blocks the parent release milestone

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions