-
Notifications
You must be signed in to change notification settings - Fork 71
OCPBUGS-858: Package Server Manager should enforce expected csv values #378
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
OCPBUGS-858: Package Server Manager should enforce expected csv values #378
Conversation
@awgreene: This pull request references Jira Issue OCPBUGS-867, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/jira refresh |
@awgreene: This pull request references Jira Issue OCPBUGS-867, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
WIP |
@awgreene: This pull request references Jira Issue OCPBUGS-858, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/jira refresh |
@awgreene: This pull request references Jira Issue OCPBUGS-858, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
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.
/lgtm
log.V(3).Info("no further updates are necessary to the packageserver csv") | ||
} | ||
|
||
// Ensure defaults |
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: Maybe expand a bit more on what it means to ensure these defaults here
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.
Done.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awgreene, tylerslaton 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 |
/hold until we get the qe-approved label |
I wonder if there's a way to launch a 4.9 cluster with this PR. It'd be ideal to do an upgrade testing from 4.9->4.12 with this PR, and make sure that for each OCP version, the correct CSV version is being deployed on upgrade. |
} | ||
if !ensureCSV(log, image, csv, highAvailabilityMode) { | ||
|
||
if modified { |
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.
did you mean if !modified
?
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, updated.
ba3ee3a
to
aa14628
Compare
tt := []struct { | ||
name string | ||
inputCSV *olmv1alpha1.ClusterServiceVersion | ||
expectedCSV *olmv1alpha1.ClusterServiceVersion | ||
highlyAvailable bool | ||
want bool | ||
want wanted |
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.
all test cases seem to set expectedErr to nil. Is it worth exercising the failure path as well?
Seems like it only happens when there are issues deserializing the csv
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.
That's correct, all tests expect no error from this method. The request to add an error testcase seems reasonable, but the only instance where the ensureCSV
function can return an error is when the manifests.NewPackageServerCSV function
has an error unmarshalling the packageserver.yaml, which is hardcoded (as it should be IMO). While we could mock the function or update it to take a configurable path, it seemed like overkill and I didn't want to increase the scope of this PR given that it will need to be backported to 4.9.
If you feel strongly that we should test this path, I can update it when I'm back from vacation next week.
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.
my preference would be to not increase the scope of this PR either, specially with the need to backport in mind. We could always have a follow up PR for the test
aa14628
to
dd4850f
Compare
dd4850f
to
e144bda
Compare
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.
Last minute additions
csv.Spec.InstallStrategy.StrategySpec.DeploymentSpecs[0].Spec.Template.Spec.Affinity = affinity | ||
} | ||
} | ||
func withRolloutStrategy(strategy *appsv1.RollingUpdateDeployment) func(*olmv1alpha1.ClusterServiceVersion) { |
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.
Shoot, @grokspawn could you change this to the name of the field?
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.
Maybe withRollingUpdateStrategy? Open to suggestions
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.
How about withRollingUpdateStrategy
?
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.
Funny that your comment came in after mine, but at least great minds think alike. :)
|
||
var modified bool | ||
|
||
for k, v := range expectedCSV.GetLabels() { |
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.
We should add a check that the csv's annotations and label maps are not nil @grokspawn. If they are nil, set them to new maps and populate with the following for loops.
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.
Something like
'''
if csv.GetAnnotations() == nil {
csv.SetAnnotations(make(map[string]string))
modified = true
}
'''
Could add a check if the expectedCSV has annotations, but it always should.
**Problem:** The package-server-manifest (PSM) is a downstream specific component responsible for reconciling the package-server csv, which is defined in code as a yaml file. When the PSM reconciles the package-server csv, it: - Attempts to generate the base of the expected CSV from the yaml mentioned above. - Passes the reconcileCSV function as the mutateFn parameter and the expectedCSV as the `obj` parameter into into controller-runtime's createOrUpdate function. Controller runtime's createOrUpdate function will apply the mutateFn function against: - The `obj` you passed in if it does not already exist. OR - The existing on cluster object. In the case where the mutateFn is applied to the applied to the existing object, changes made to the package-server csv yaml are ignored because the mutateFn (ie the reconcileCSV function) doesn't consider changes to the manifest. **Solution:** Update the reconcileCSV function to: - Ensure that expected annotations and labels are present on the csv. - Ensure that the expected spec is present on the csv.
e144bda
to
2bb3d74
Compare
@ qe, please take a look at the reproduction steps in OCPBUGS-867 for a (relatively) easy verification. |
/test e2e-gcp-ovn |
@awgreene: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Yes, but I guess no. In fact, I build a payload with this PR by using cluster-bot, and upgrade OCP 4.10.32 to it forcefully, it works well. |
/label qe-approved |
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.
/lgtm
/hold cancel |
@awgreene: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-858 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
LGTM, details see: https://issues.redhat.com/browse/OCPBUGS-867 and https://issues.redhat.com/browse/OCPBUGS-858 |
/cherry-pick release-4.11 |
@anik120: new pull request created: #381 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Problem:
The package-server-manifest (PSM) is a downstream specific component responsible for reconciling the package-server csv, which is defined here as a yaml file. When the PSM reconciles the package-server csv, it:
mutateFn
parameter and the expectedCSV as theobj
parameter into into controller-runtime's createOrUpdate function. Controller runtime'screateOrUpdate function
will apply themutateFn
function against:obj
you passed in if it does not already exist.OR
In the case where the
mutateFn
is applied to the applied to the existing object, changes made to the package-server csv yaml are ignored because themutateFn
(ie thereconcileCSV
function) doesn't consider changes to the manifest.Solution:
Update the
reconcileCSV
function to: