client icon indicating copy to clipboard operation
client copied to clipboard

Improve "kn service apply" to use a strategic patch strategy for perfoming the 3-way merge

Open rhuss opened this issue 4 years ago • 4 comments

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.

rhuss avatar Oct 26 '20 08:10 rhuss

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jan 25 '21 02:01 github-actions[bot]

/remove-lifecycle stale

navidshaikh avatar Jan 25 '21 05:01 navidshaikh

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Apr 26 '21 01:04 github-actions[bot]

/remove-lifecycle stale

rhuss avatar Apr 26 '21 06:04 rhuss