Skip to content

Commit 76c1a4a

Browse files
[webhook] Modify ordering of webhook based on name (#5301)
When there are multiple webhooks of the same type, the ordering is not fixed. This PR modifies the ordering of webhooks in a webhookdefinition based on the name, instead of the type. Signed-off-by: varshaprasad96 <[email protected]>
1 parent acbc148 commit 76c1a4a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: >
5+
The list of webhooks in `webhookdescription` was previously sorted based on `webhookType`. It is now being sorted
6+
based on webhook names.
7+
8+
# kind is one of:
9+
# - addition
10+
# - change
11+
# - deprecation
12+
# - removal
13+
# - bugfix
14+
kind: "bugfix"
15+
16+
# Is this a breaking change?
17+
breaking: false

internal/generate/clusterserviceversion/clusterserviceversion_updaters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func applyWebhooks(c *collector.Manifests, csv *operatorsv1alpha1.ClusterService
338338
}
339339
// Sorts the WebhookDescriptions based on natural order of webhookDescriptions Type
340340
sort.Slice(webhookDescriptions, func(i, j int) bool {
341-
return webhookDescriptions[i].Type < webhookDescriptions[j].Type
341+
return webhookDescriptions[i].GenerateName < webhookDescriptions[j].GenerateName
342342
})
343343
csv.Spec.WebhookDefinitions = webhookDescriptions
344344
}

0 commit comments

Comments
 (0)