Skip to content

[WIP] ⚠️ Server Side Apply Support #366

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

Conversation

DirectXMan12
Copy link
Contributor

This introduces a server-side apply patch type. Don't use yet, since it requires Kubernetes 1.14. Breaking since the structure of PatchOptions needs to change.

This refactors options off to their own file in order to make each file
comprehensibly long (pkg/client/interfaces.go was getting rather large
with all the different types of options).
Strategic merge patch is what most things in kubernetes use, and
probably closer to what users expect if they can't use server-side
apply.
This adds a patch type for server-side apply (Kubernetes 1.14+),
which allows you to write code like

```go
client.Patch(ctx, &corev1.Pod{/* fields I care about */}, client.Apply, client.IgnoreConflicts())
```

and have it just work.
This is needed for server-side apply.
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 20, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2019
@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 20, 2019
@DirectXMan12
Copy link
Contributor Author

Also TODO: switch to specificallyversionedoptions calls

@DirectXMan12 DirectXMan12 added this to the 0.2.0 milestone Mar 20, 2019
@DirectXMan12
Copy link
Contributor Author

One step in #347

@DirectXMan12
Copy link
Contributor Author

also TODO (eventually): jsonpatch patch type

@DirectXMan12
Copy link
Contributor Author

(this also needs tests before merge)

@@ -72,3 +77,21 @@ func (s *mergeFromPatch) Data(obj runtime.Object) ([]byte, error) {
func MergeFrom(obj runtime.Object) Patch {
return &mergeFromPatch{obj}
}

// applyPatch uses server-side apply to patch the object.
type applyPatch struct{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't use the var _ SomeInterface = someImpl{} pattern? I'm assuming this implements something that I don't know

Copy link
Contributor Author

@DirectXMan12 DirectXMan12 Mar 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the Patch interface (interfaces.go)

@apelisse
Copy link

LGTM from my perspective.

@DirectXMan12 DirectXMan12 force-pushed the feature/server-side-apply-patch branch from fd37445 to 59da519 Compare March 21, 2019 06:13
@apelisse
Copy link

Shame on me for forgetting the fieldmanager field ...

@k8s-ci-robot
Copy link
Contributor

@DirectXMan12: PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 9, 2019
@DirectXMan12
Copy link
Contributor Author

for posterity: part of this went in to #435, the rest needs a bit more work.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 2, 2019
@DirectXMan12
Copy link
Contributor Author

we've got minimal support currently, but it's a bit clunky. We'll add a nice wrapper eventually, but closing for now

DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
[book] section on dependencies, update upgrading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants