Skip to content

Commit

Permalink
chore(trait): Add an option to disable SSA in deployer trait
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed May 18, 2022
1 parent 85483d4 commit 8f3f635
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/modules/traits/pages/deployer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions pkg/resources/resources.go

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion pkg/trait/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions resources/traits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8f3f635

Please sign in to comment.