-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix(validation): Remove default channel validation from bundle lib #408
fix(validation): Remove default channel validation from bundle lib #408
Conversation
It is not possible to determine if the default channel value is valid or not given we can "infer" default channel by using an emptry string. Also, author can add a default channel that is not listed in the channel list in some cases. As a result, the default channel is subjective and there is no methodology to validate it. Therefore, removing this validation will avoid any false positve. Signed-off-by: Vu Dinh <[email protected]>
8bb774f
to
9228b2b
Compare
@@ -379,7 +343,7 @@ func GenerateDockerfile(mediaType, manifests, metadata, copyManifestDir, copyMet | |||
fileContent += fmt.Sprintf("LABEL %s=%s\n", MetadataLabel, metadata) | |||
fileContent += fmt.Sprintf("LABEL %s=%s\n", PackageLabel, packageName) | |||
fileContent += fmt.Sprintf("LABEL %s=%s\n", ChannelsLabel, channels) | |||
fileContent += fmt.Sprintf("LABEL %s=%s\n\n", ChannelDefaultLabel, chanDefault) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If channelDefault
is an empty string, this label will be empty. Is that ok/desirable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is OK to not have a defaultChannel value AKA empty string because in annotation generation function, there is a case where inferred defaultChannel is set to empty string. @Bowenislandsong Can you double-confirm this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to just not set this label at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. Later when added to Index, the default behavior will kick in (right now the default behavior is to add the first channel as default).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, wouldn't it be better/more obvious to the user to write a label containing the first channel as default if a default isn't explicitly set? https://github.com/operator-framework/operator-registry/pull/408/files#r462470459 implies that this isn't desirable.
@@ -355,11 +324,6 @@ func GenerateAnnotations(mediaType, manifests, metadata, packageName, channels, | |||
func GenerateDockerfile(mediaType, manifests, metadata, copyManifestDir, copyMetadataDir, workingDir, packageName, channels, channelDefault string) ([]byte, error) { | |||
var fileContent string | |||
|
|||
chanDefault, err := ValidateChannelDefault(channels, channelDefault) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If channelDefault
is not an empty string, we still want to verify that it exists in channels
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are cases when that is totally fine to have default channel not on the list. @shawn-hurley Can you explain this further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default channel mentioned in the bundle != Default channel on the package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming opm
libraries check if a specified default channel exists in some packaged bundle
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dinhxuanvu, estroz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
It is not possible to determine if the default channel value is valid
or not given we can "infer" default channel by using an emptry string.
Also, author can add a default channel that is not listed in the channel
list in some cases. As a result, the default channel is subjective
and there is no methodology to validate it. Therefore, removing this
validation will avoid any false positve.
Signed-off-by: Vu Dinh [email protected]
Description of the change:
Motivation for the change:
Reviewer Checklist
/docs