This is an automated email from the ASF dual-hosted git repository. tsato pushed a commit to branch release-1.8.x in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 8f64c6b53911fffde7af59ffe87cd47865b53dd5 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 (cherry picked from commit 8f3f6354228bbd04174cb3f25a33e4a7886fffd5) --- docs/modules/traits/pages/deployer.adoc | 5 +++++ go.sum | 3 ++- pkg/cmd/run_test.go | 4 ++-- pkg/resources/resources.go | 4 ++-- pkg/trait/deployer.go | 5 ++++- resources/traits.yaml | 5 +++++ 6 files changed, 20 insertions(+), 6 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/go.sum b/go.sum index a230b3538..571ac57b7 100644 --- a/go.sum +++ b/go.sum @@ -1447,8 +1447,9 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/cmd/run_test.go b/pkg/cmd/run_test.go index 85241a2c5..8cabc66cd 100644 --- a/pkg/cmd/run_test.go +++ b/pkg/cmd/run_test.go @@ -633,7 +633,7 @@ func TestFilterBuildPropertyFiles(t *testing.T) { } func TestResolveYamlPodTemplateWithSupplementalGroups(t *testing.T) { - //_, rootCmd, _ := initializeRunCmdOptions(t) + // _, rootCmd, _ := initializeRunCmdOptions(t) templateText := ` securityContext: supplementalGroups: @@ -651,7 +651,7 @@ securityContext: } func TestResolveJsonPodTemplateWithSupplementalGroups(t *testing.T) { - //_, rootCmd, _ := initializeRunCmdOptions(t) + // _, rootCmd, _ := initializeRunCmdOptions(t) minifiedYamlTemplate := `{"securityContext":{"supplementalGroups":[666]}}` integrationSpec := v1.IntegrationSpec{} diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go index a4b5ea1bb..e21cdb9ee 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: 51291, + uncompressedSize: 51544, - 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\xeb\x11\x78\x01\xf0\x24\x33\x97\xfb\xdf\xaf\xd0\xdd\xf8\x78\x8f\xa4\x44\xd9\xd6\x6c\xb4\xb5\x9b\xaa\x1d\x4b\x7a\x00\x1a\x8d\x46\x7f\x77\xc3\x5b\xa9\xbc\x3b\xf9\x6a\x2c\xb4\x5c\xc1\x89\x90\xf3\xb9\xd2\xca\xaf\xbf\x12\xa2\x6d\xa4\x9f\x1b\xbb\x3a\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\x46\x7f\x77\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 b52c48742..515c26e3e 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: