-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KEP-3659: ApplySet: kubectl apply --prune redesign and graduation strategy #3661
Conversation
Skipping CI for Draft Pull Request. |
b63ff0c
to
ecb3a7c
Compare
Co-authored-by: Katrina Verey <[email protected]>
> has owner references, what should we do? This would be | ||
> somewhat unexpected; it implies that kubectl apply doesn't | ||
> really own the object, apparently. | ||
> We could consider this an error, or perhaps warn |
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 the owner reference is to the "parent" applyset object, then I suggest we should ignore that particular case. It feels very reasonable for a third party tool to create objects with ownerReferences, but still mark them with our labels/annotations for compatibility.
If the owner reference is to something else, I propose that in alpha we should make that an error, to force the discussion. I can see us eventually making it a warning (or ignored if we see that the parent is also in the applyset), but I think that we should use the alpha to try to discover use-cases here.
|
||
> <<[UNRESOLVED @justinsb @KnVerey]>> | ||
> | ||
> Should we identify a few patterns to avoid collisions? Either uid:12345 or <toolname>:... |
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 like the idea of allowing it to be arbitrary but suggesting <toolname:...>
, e.g. kubectl:<apply-set-name>
. I don't think we should recommend encoding uids, which aren't meaningful to humans. Plus imagine the scenario where the tracking object is deleted then re-created with the same name. I think the human's expectation would be that any previous children would continue to point to it.
EDIT: If the convention includes a separate annotation for the tool name though, perhaps recommending tool name in the set name is less useful.
> <<[UNRESOLVED @justinsb @KnVerey]>> | ||
> | ||
> How should we recognize that we’re using the “wrong’ tool? | ||
> Should we have something like `applyset.k8s.io/tooling: helm/v2.0.6` on the applyset? |
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 we should, and make checking that annotation part of the standard.
/cc |
|
||
#### Helm | ||
|
||
**Pattern**: list of GVKNN (from secret) + labels |
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.
Same as before: GroupVersionKindNameNamespace (GVKNN) - I wasn't aware that such acronym existed and had to look it up 😅
> How should we recognize that we’re using the “wrong’ tool? | ||
> Should we have something like `applyset.k8s.io/tooling: helm/v2.0.6` on the applyset? | ||
> | ||
> <<[/UNRESOLVED]>> |
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.
Since you're introducing a meta object holding information about applyset contents, have you considered versioning the metadata?
Follow-on to initial feedback, address some unresolved blocks
Likely pushes us to GKNN-derived IDs.
We just choose the constrained applyset id to prevent "applyset ID impersonation".
Prune: document confused deputy attack and mitigations
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.
Hello, I am a PRR shadow and I'm giving this a first pass for PRR 👋
Left a small comment, otherwise lgtm as a client side feature.
--> | ||
|
||
We will maintain tests for "prune v2" and "prune v1", until | ||
such time as prune v1 (technically still in alpha) is removed. |
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.
Do you plan to add unit tests that will exercise the environment variable flag?
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.
Good call - yes - we can add to the doc. We'll add unit tests (or cases) that cover v2 apply/prune, and leave the existing v1 apply/prune unit tests basically as-is until that functionality is removed. I don't think there should be any possible "crosstalk" between the two, but if there is we'll make sure there's test coverage to make sure we haven't regressed.
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.
From a PRR perspective I am content.
I do think we should consider making this NOT a client-side only feature, though. I think a lot of the complexity comes in because we're trying to avoid creating a new server side resource.
- An object can be part of at most one ApplySet. This is a limitation, but seems to be a good one in that objects that are part of multiple ApplySets are complicated both conceptually for users and in terms of implementation behaviour. | ||
- An ApplySet object can be part of another ApplySet (sub-ApplySets). | ||
|
||
### ApplySet Naming |
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.
s/Naming/Identification/
|
||
### ApplySet Naming | ||
|
||
Each ApplySet MUST have an ID that can be used to uniquely identify the parent and member objects via the label selector conventions outlined in the following sections. As such, the name: |
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.
s/the name/the ID/
if I am understanding correctly?
|
||
Each ApplySet MUST have an ID that can be used to uniquely identify the parent and member objects via the label selector conventions outlined in the following sections. As such, the name: | ||
* is subject to the normal limits of label values | ||
* MUST be the base64 encoding of the hash of the GKNN, in the form `base64(sha256(<name>.<namespace>.<kind>.<group>))`, using the URL safe encoding of RFC4648. |
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.
<name>
here is the metadata.name
of the parent object?
If not this is really unclear. If so, you need to update the paragraph below saying that ID != name, because of course it's not equal, that would be an infinite recursion.
Or I am really confused. Which could be the case.
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, you're right! The paragraph below just wasn't updated properly when we added this restriction on the ID in a recent revision. I'll fix it now.
When a tool that wants to list the members of an ApplySet and cannot determine the list of GKs (i.e. because neither hint annotation is used), it may support “discovery”, likely warning that a full cluster crawl is being attempted. Insufficient permissions errors are likely with such functionality, and when they are encountered, the tool should warn that the membership list may be incomplete. | ||
|
||
```yaml | ||
applyset.k8s.io/contains-group-kinds: <kind>.<group>[,]` # OPTIONAL |
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 a lot of annotations with varying complex validation logic. Maybe that makes sense for alpha.
But it would seem some of these issues raised can be addressed if we use a new metadata field or field + core type rather than a raft of annotations? This would avoid the adoption limitations for putting all this in a CRD. It would be empty for non-parent objects, so I understand that seems weird to put it everywhere.
Another option would be to reverse that, and have a core applyset type, and allow it to reference the tool-specific porcelain resource as an object ref. That also solves the discovery of applysets issue. Has that been considered?
In the future, we could downgrade this stance to recommending a warning, | ||
or to considering owner references orthogonal and ignoring them entirely. | ||
|
||
### Versioning |
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.
Why are we limiting the discussion to CRDs? Why not built-in types? This is a plumbing level feature. If we have a built-in applyset + object ref to tooling porcelain object, we would avoid the adoption issue related to needing to install the CRD, and have better discovery, and have better options for validation and consistency management of the objects.
I believe this proposal addresses the most important problems with the current prune, and I don't think the two reservations I've enumerated are blockers. /lgtm |
@johnbelamaric I haven't told that Katrina and Justin, yet, but I'm slowly preparing them to gain confidence to create that new server-side resource, but shhhh, don't tell them 😉 |
/label tide/merge-method-squash |
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.
A few minor nits
/lgtm
/approve
from sig-cli pov
/approve From a PRR perspective. From my "project" perspective, I question the resources spent on a a purely client side approach. But that's up to the SIG and those working on the feature. I believe that this approach won't necessarily get more feedback, and if ecosystem tools have to adapt to this approach and then to a later server side approach, it's a lot of churn and wasted effort. My 2 cents - do with it what you will :) |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnbelamaric, KnVerey, soltysh 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 |
So I encountered a slight challenge while using this. If we have a CRD and an instance of that CRD (a CR) in the same manifest, we know the GVKs for all the objects, but we can't (easily) know the GVR for the CR until we apply the CRD. This means we can't update the Arguably this is a regression vs the existing kubectl behaviour. The regression is that now we can't even start the apply if we're using prune. A few options:
In terms of compatibility if we did switch to GVKs, there are a few choices: a) Create a new annotation and simply break everyone using the feature today - it is alpha & feature-flagged. We could implement the fallback to full discovery. Personally I think option b is the best, it sets us up to put more functionality into fsck, and it feels more sustainable for an alpha / feature-flagged feature. For reference, the current annotation is |
kubectl apply --prune
redesign and graduation strategy #3659kubectl apply --prune
redesign and graduation strategy #3659