Skip to content

Add server-side apply mode #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 27, 2022
Prev Previous commit
Next Next commit
Add client version check for --field-manager flag
  • Loading branch information
smuth4 committed Apr 26, 2022
commit 8b0852004ca1d929cd8f0e088b033a8a725511fa
7 changes: 6 additions & 1 deletion pkg/kubernetes/client/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"os/exec"
"strings"

"github.com/Masterminds/semver"

"github.com/grafana/tanka/pkg/kubernetes/manifest"
)

Expand All @@ -14,7 +16,10 @@ func (k Kubectl) applyCtl(data manifest.List, opts ApplyOpts) *exec.Cmd {
argv := []string{"-f", "-"}
serverSide := (opts.ApplyStrategy == "server")
if serverSide {
argv = append(argv, "--server-side", "--field-manager=tanka")
argv = append(argv, "--server-side")
if k.info.ClientVersion.GreaterThan(semver.MustParse("1.19.0")) {
argv = append(argv, "--field-manager=tanka")
}
}
if opts.Force {
if serverSide {
Expand Down