-
Notifications
You must be signed in to change notification settings - Fork 227
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
BundleDeployment status error message improvement #2679
Conversation
6d386ed
to
51d5ebf
Compare
@@ -407,6 +407,7 @@ type ModifiedStatus struct { | |||
// +nullable | |||
Name string `json:"name,omitempty"` | |||
Create bool `json:"missing,omitempty"` | |||
Exist bool `json:"exist,omitempty"` |
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.
Exist bool `json:"exist,omitempty"` | |
// Exist is true if the modified resource exists in the cluster. This can happen, when ... | |
Exist bool `json:"exist,omitempty"` |
So this happens because we're missing annotations and the resource ends up in plan.Create
instead of plan.Update
?
This is probably the last usage of wrangler apply in the agent, we pass the helm resources.Objects
into wrangler's DryRun
and get a plan
with several lists returned (Create
, Update
, Delete
, Objects
).
plan, err := m.applied.DryRun(ns, applied.GetSetID(bd.Name, m.labelPrefix, m.labelSuffix), resources.Objects...)
Our Diff
only takes resources with updates to existing fields into account, it only looks at plan.Update
.
If we wrote our own applied.DryRun
, could it return lists that fit our use case better? So that we don't have to do a an additional Get
for every resource in plan.Create
? I'm asking, because we do want to remove wrangler where possible.
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.
So this happens because we're missing annotations and the resource ends up in
plan.Create
instead ofplan.Update
?
It might not be accurate to say, that we're missing annotations. So far I was only able to reproduce the issue when two bundles have fought for ownership. When one has it and the other takes it, the first says "missing" instead of "isn't owned by me". This message is adapted in this PR.
If we wrote our own
applied.DryRun
, could it return lists that fit our use case better? So that we don't have to do a an additionalGet
for every resource inplan.Create
? I'm asking, because we do want to remove wrangler where possible.
Yes, I think we can do better when we write our own function to diff. However, I do not claim to have fully understood the diffing process.
And I only was able to reproduce the issue with two competing bundles, not with resources installed without a bundle and a bundle failing to properly adopt them. The newly create SURE might help to further investigate that.
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.
This adds 10 get requests per deployment if I'm right. Is that a performance problem?
This adds up to 10 requests per bundledeployment. One request for every resource that the dry-run reported to be missing (that it would create). There is no default requeue period set in the reconciler, so that those requests are only done once on an attempted deployment of the downstream cluster (or if the bundledeployment is changed). It does not look like a performance problem to me. |
9fd2fbd
to
25f73d0
Compare
25f73d0
to
53561b9
Compare
53561b9
to
7e4e9ed
Compare
7e4e9ed
to
50b20be
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.
LGTM
When a resource of a BundleDeployment is removed after the Bundle has been created, the BundleDeployment says it is missing. This is also the case if the resource is not removed but changes its owner. In that case, the message of a resource that is missing might be misleading. These changes adapt the messsage to say "<resource> is not owned by us" instead of saying that the "<resource> is missing". Part of rancher#2134
as that is ineffective anyway. It returns true but does not remove them.
5fd0484
to
bba0377
Compare
When a resource of a BundleDeployment is removed after the Bundle has been created, the BundleDeployment says it is missing. This is also the case if the resource is not removed but changes its owner. In that case, the message of a resource that is missing might be misleading. These changes adapt the message to say " is not owned by us" instead of saying that the "<resource> is missing".
Part of #2134