-
Notifications
You must be signed in to change notification settings - Fork 565
clarify maxOpenShiftVersion upgrade error message #2326
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ func (s skew) String() string { | |
return fmt.Sprintf("%s/%s has invalid %s properties: %s", s.namespace, s.name, MaxOpenShiftVersionProperty, s.err) | ||
} | ||
|
||
return fmt.Sprintf("%s/%s is incompatible with OpenShift versions greater than %s", s.namespace, s.name, s.maxOpenShiftVersion) | ||
return fmt.Sprintf("%s/%s is incompatible with OpenShift minor versions greater than %s", s.namespace, s.name, s.maxOpenShiftVersion) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the test include a maxOpenShift version that includes a patch and could we ensure that the patch version is omitted from the message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we just throw a validation error on a patch version? It doesn't seem to me to make a lot of sense to allow users to even set it like that if we can't actually block those upgrades anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about requiring the operators to declare There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just think it's confusing and erroneous to do that. OLM functionally can't do anything special with the patch version here, so we should limit it to the minor version with validation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified it to drop the build version and complain on a non-zero patch/pre-release version. I've added a warning on the api validation operator-framework/api#146 |
||
} | ||
|
||
type transientError struct { | ||
|
@@ -165,7 +165,8 @@ func incompatibleOperators(ctx context.Context, cli client.Client) (skews, error | |
if max == nil || max.GTE(next) { | ||
continue | ||
} | ||
s.maxOpenShiftVersion = max.String() | ||
|
||
s.maxOpenShiftVersion = fmt.Sprintf("%d.%d", max.Major, max.Minor) | ||
|
||
incompatible = append(incompatible, s) | ||
} | ||
|
@@ -252,7 +253,11 @@ func maxOpenShiftVersion(csv *operatorsv1alpha1.ClusterServiceVersion) (*semver. | |
return nil, fmt.Errorf(`Failed to parse "%s" as semver: %w`, value, err) | ||
} | ||
|
||
return &version, nil | ||
truncatedVersion := semver.Version{Major: version.Major, Minor: version.Minor} | ||
if !version.EQ(truncatedVersion) { | ||
return nil, fmt.Errorf("property %s must specify only <major>.<minor> version, got invalid value %s", MaxOpenShiftVersionProperty, version) | ||
} | ||
return &truncatedVersion, nil | ||
} | ||
|
||
func notCopiedSelector() (labels.Selector, error) { | ||
|
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.
nit: this newline should exist to delineate standard library imports.