Improve "kn service apply" to use a strategic patch strategy for perfoming the 3-way merge
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 388
- Forks
- 274
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 8
Description
Feature request
As described in https://github.com/knative/client/pull/964#issuecomment-707184807 the way we are performing the 3way merge for a kn service apply is limited and can be improved.
Use case
Instead of doing a jsonmergepatch.CreateThreeWayJSONMergePatch, ideally a strategicpatch.CreateThreeWayMergePatch should be used but this fails because of lack of support for CRDs like the Knative Service.
// Compute a three way strategic merge patch to send to server.
lookupPatchMeta, err := strategicpatch.NewPatchMetaFromStruct(servingv1.Service{})
if err != nil {
return false, err
}
patch, _ = strategicpatch.CreateThreeWayMergePatch(uOriginalService, uModifiedService, uCurrentService, lookupPatchMeta, false)
Also, an "overwrite" mode should be configurable to allow a forced overwrite in case of a conflict.
It is not clear now, whether the Kubernetes provided utility methods can be used or whether we need to implement our own merge algorithm (based on the knowledge of the supported CRD) instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the kn service apply implementation and review the three-way merge discussion in PR #964. Determine whether Kubernetes strategic-patch utilities support the Knative Service CRD; done means apply uses the supported merge strategy and exposes a configurable overwrite mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100