This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch release-1.9.x in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 33d84e528778e05c183593d53216f749c48d2075 Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Wed May 18 10:38:46 2022 +0200 chore(trait): Add an option to disable SSA in deployer trait --- docs/modules/traits/pages/deployer.adoc | 5 +++++ pkg/resources/resources.go | 4 ++-- pkg/trait/deployer.go | 5 ++++- resources/traits.yaml | 5 +++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/modules/traits/pages/deployer.adoc b/docs/modules/traits/pages/deployer.adoc index 61181e5a9..906f34936 100755 --- a/docs/modules/traits/pages/deployer.adoc +++ b/docs/modules/traits/pages/deployer.adoc @@ -32,6 +32,11 @@ The following configuration options are available: | string | Allows to explicitly select the desired deployment kind between `deployment`, `cron-job` or `knative-service` when creating the resources for running the integration. +| deployer.use-ssa +| bool +| Use server-side apply to update the owned resources (default `true`). +Note that it automatically falls back to client-side patching, if SSA is not available, e.g., on old Kubernetes clusters. + |=== // End of autogenerated code - DO NOT EDIT! (configuration) diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go index de93e2be8..cb673933e 100644 --- a/pkg/resources/resources.go +++ b/pkg/resources/resources.go @@ -583,9 +583,9 @@ var assets = func() http.FileSystem { "/traits.yaml": &vfsgen۰CompressedFileInfo{ name: "traits.yaml", modTime: time.Time{}, - uncompressedSize: 51419, + uncompressedSize: 51672, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xfd\x73\x5b\xb9\x91\xe0\xef\xf3\x57\xa0\xb4\x57\x65\xc9\x45\x52\x9e\xc9\x26\x99\xd3\xdd\x6c\x4e\x63\x7b\x12\xcd\xf8\x43\x67\x6b\x26\x9b\xf2\xb9\x42\xf0\xbd\x26\x09\xf3\x11\x78\x01\xf0\x24\x33\x97\xfb\xdf\xaf\xd0\xdd\xf8\x78\x8f\x94\x44\xd9\xd6\x6c\xb4\xb5\x9b\xaa\x1d\x4b\x7a\x68\x34\x1a\x8d\x46\x7f\xc3\x5b\xa9\xbc\x3b\xf9\x6a\x2c\xb4\x5c\xc3\x89\x90\xf3\xb9\xd2\xca\x6f\xbe\x12\xa2\x6d\xa4\x9f\x1b\xbb\x3e\x11\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xfd\x73\x5b\xb9\x91\xe0\xef\xf3\x57\xa0\xb4\x57\x65\xc9\x45\x52\x9e\xc9\x26\x99\xd3\xdd\x6c\x4e\x63\x7b\x12\xcd\xf8\x43\x67\x6b\x26\x9b\xf2\xb9\x42\xf0\xbd\x26\x09\xf3\x11\x78\x01\xf0\x24\x33\x97\xfb\xdf\xaf\xd0\xdd\xf8\x78\x8f\x94\x44\xd9\xd6\x6c\xb4\xb5\x9b\xaa\x1d\x4b\x7a\x00\x1a\x8d\xee\x46\x7f\xc3\x5b\xa9\xbc\x3b\xf9\x6a\x2c\xb4\x5c\xc3\x89\x90\xf3\xb9\xd2\xca\x6f\xbe\x12\xa2\x6d\xa4\x9f\x1b\xbb\x3e\x11\x [...] }, } fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{ diff --git a/pkg/trait/deployer.go b/pkg/trait/deployer.go index 8bc3b23ff..3dfb036ef 100644 --- a/pkg/trait/deployer.go +++ b/pkg/trait/deployer.go @@ -41,6 +41,9 @@ type deployerTrait struct { BaseTrait `property:",squash"` // Allows to explicitly select the desired deployment kind between `deployment`, `cron-job` or `knative-service` when creating the resources for running the integration. Kind string `property:"kind" json:"kind,omitempty"` + // Use server-side apply to update the owned resources (default `true`). + // Note that it automatically falls back to client-side patching, if SSA is not available, e.g., on old Kubernetes clusters. + UseSSA *bool `property:"use-ssa" json:"useSSA,omitempty"` } var _ ControllerStrategySelector = &deployerTrait{} @@ -68,7 +71,7 @@ func (t *deployerTrait) Apply(e *Environment) error { // check its list of accepted MIME types. // As a simpler solution, we fall back to client-side apply at the first // 415 error, and assume server-side apply is not available globally. - if hasServerSideApply { + if hasServerSideApply && IsNilOrTrue(t.UseSSA) { err := t.serverSideApply(env, resource) switch { case err == nil: diff --git a/resources/traits.yaml b/resources/traits.yaml index 8317239b5..15183bb70 100755 --- a/resources/traits.yaml +++ b/resources/traits.yaml @@ -281,6 +281,11 @@ traits: description: Allows to explicitly select the desired deployment kind between `deployment`, `cron-job` or `knative-service` when creating the resources for running the integration. + - name: use-ssa + type: bool + description: Use server-side apply to update the owned resources (default `true`).Note + that it automatically falls back to client-side patching, if SSA is not available, + e.g., on old Kubernetes clusters. - name: deployment platform: true profiles: