Skip to content

Commit

Permalink
Merge pull request #343 from Ajpantuso/apantuso/fix_permit_channel_up…
Browse files Browse the repository at this point in the history
…dates

[MTSRE-847] fix: allow channel updates to pass validation webhooks
  • Loading branch information
openshift-ci[bot] authored Apr 24, 2023
2 parents e1b983b + 2989136 commit 9e53ac8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/webhooks/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ func validateAddonImmutability(addon, oldAddon *addonsv1alpha1.Addon) error {
oldSpecInstall.OLMAllNamespaces.Config = nil
oldSpecInstall.OLMAllNamespaces.PullSecretName = ""
oldSpecInstall.OLMAllNamespaces.AdditionalCatalogSources = nil
oldSpecInstall.OLMAllNamespaces.Channel = ""
}
if oldSpecInstall.OLMOwnNamespace != nil {
oldSpecInstall.OLMOwnNamespace.CatalogSourceImage = ""
oldSpecInstall.OLMOwnNamespace.Config = nil
oldSpecInstall.OLMOwnNamespace.PullSecretName = ""
oldSpecInstall.OLMOwnNamespace.AdditionalCatalogSources = nil
oldSpecInstall.OLMOwnNamespace.Channel = ""
}

specInstall := addon.Spec.Install.DeepCopy()
Expand All @@ -131,12 +133,14 @@ func validateAddonImmutability(addon, oldAddon *addonsv1alpha1.Addon) error {
specInstall.OLMAllNamespaces.Config = nil
specInstall.OLMAllNamespaces.PullSecretName = ""
specInstall.OLMAllNamespaces.AdditionalCatalogSources = nil
specInstall.OLMAllNamespaces.Channel = ""
}
if specInstall.OLMOwnNamespace != nil {
specInstall.OLMOwnNamespace.CatalogSourceImage = ""
specInstall.OLMOwnNamespace.Config = nil
specInstall.OLMOwnNamespace.PullSecretName = ""
specInstall.OLMOwnNamespace.AdditionalCatalogSources = nil
specInstall.OLMOwnNamespace.Channel = ""
}

// Do semantic DeepEqual instead of reflect.DeepEqual
Expand Down
2 changes: 1 addition & 1 deletion internal/webhooks/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestValidateAddonInstallImmutability(t *testing.T) {
},
},
}, addonName),
expectedErr: errInstallImmutable,
expectedErr: nil,
},
{
baseAddon: baseAddon,
Expand Down

0 comments on commit 9e53ac8

Please sign in to comment.