File tree 1 file changed +11
-3
lines changed
pkg/patterns/declarative/pkg/applier
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,20 @@ import (
27
27
)
28
28
29
29
type 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
31
39
}
32
40
33
41
var _ Applier = & DirectApplier {}
34
42
35
- type directApplier struct {
36
- }
43
+ type directApplier struct {}
37
44
38
45
type directApplierSite interface {
39
46
Run (a * apply.ApplyOptions ) error
@@ -170,6 +177,7 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
170
177
applyOpts .PruneResources = append (applyOpts .PruneResources , r ... )
171
178
}
172
179
180
+ applyOpts .ServerSideApply = d .serverSideApplyPreferred
173
181
applyOpts .ForceConflicts = opt .Force
174
182
applyOpts .Namespace = opt .Namespace
175
183
applyOpts .SetObjects (infos )
You can’t perform that action at this time.
0 commit comments