File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
pkg/patterns/declarative/pkg/applier Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,20 @@ import (
2727)
2828
2929type DirectApplier struct {
30- inner directApplierSite
30+ // Whether to apply the KRM resources using server-side apply. https://kubernetes.io/docs/reference/using-api/server-side-apply/
31+ // Note: The server-side apply is stable in Kubernetes v1.22, users should take the responsibility to make sure the cluster
32+ // server can support this feature.
33+ serverSideApplyPreferred bool
34+ inner directApplierSite
35+ }
36+
37+ func (d * DirectApplier ) UseServerSideApply () {
38+ d .serverSideApplyPreferred = true
3139}
3240
3341var _ Applier = & DirectApplier {}
3442
35- type directApplier struct {
36- }
43+ type directApplier struct {}
3744
3845type directApplierSite interface {
3946 Run (a * apply.ApplyOptions ) error
@@ -170,6 +177,7 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
170177 applyOpts .PruneResources = append (applyOpts .PruneResources , r ... )
171178 }
172179
180+ applyOpts .ServerSideApply = d .serverSideApplyPreferred
173181 applyOpts .ForceConflicts = opt .Force
174182 applyOpts .Namespace = opt .Namespace
175183 applyOpts .SetObjects (infos )
You can’t perform that action at this time.
0 commit comments