Commit Graph

2 Commits

Author SHA1 Message Date
Matej Vasek c62842355a
Use context.Context in API methods (#1274)
* Refactor: add ctx param to KnServingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to ServingV1Interface

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Making wait function cancellable

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Handling SIGINT and SIGTERM

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnEventingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup style

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Removing unnecessary dependency

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnChannelsClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knServingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnSubscriptionsClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from subscriptionsClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnSinkBindingClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knBindingClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnDynamicClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from knDynamicClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnAPIServerSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from APIServerSourcesRecorder to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnContainerSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from containerSourcesClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: add ctx param to KnPingSourcesClient funs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Passing ctx from pingSourcesClient to knative.dev interfaces

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Using cmd.Context() in pkg/kn/commands

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Test using background ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Removing ctx param from RawClient()

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* ctx for watch/polling

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix per review request

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: extract ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Refactor: Namespace not requiring ctx

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Revert "Handling SIGINT and SIGTERM"

This reverts commit 9598646fda.

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Update CHANGELOG

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Add test for Wait()

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Add test for Wait()

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-26 09:23:20 -07:00
Roland Huß 8ca97c7920
Feature: "kn service apply" (#964)
* feat: "kn service apply"

This commit introduces a client-side apply with a plain JsonPatchMerge. This is more limited than a StrategicPatchMerg as it does not allow to merge lists (they are just overwritten). Also is not a real 3-way merger that would lead to a conflict when both the, the server-side and the provide update overlapp in fields that updated, compared to the shared original configuration. This is a problem of  JsonThreeWayMerger itself, as pointed out in https://github.com/kubernetes/kubernetes/pull/40666#pullrequestreview-502804243.

This limitation is shared with kubectl, which suffers from the same issue if using `kubectl apply` with a custom resource (i.e. with everything that has schema that is not registered within kubectl).

Tests are missing, too, but will come soon

* chore: Add tests for 'kn apply'

* refactor: Removed PatchService from pulic API interface

* fix: Display of service URL at the end, when no changes apply

* chore: Add initial E2E test

* chore: Implemented review suggestions

* More tests
* Example for kn service apply
* Remove commented-out code

* lint fixes

* fix formatting of kn service apply doc

* fixing go.sum

* chore: Update deps
2020-11-02 00:36:35 -08:00