Merge pull request #113348 from seans3/prune-ssa-fix

Disallow prune for server-side applied objects
This commit is contained in:
Kubernetes Prow Robot 2023-01-04 13:07:58 -08:00 committed by GitHub
commit 4e800983fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -381,6 +381,11 @@ func (o *ApplyOptions) Validate() error {
return fmt.Errorf("--force cannot be used with --prune") return fmt.Errorf("--force cannot be used with --prune")
} }
// Currently do not support pruning objects which are server-side applied.
if o.Prune && o.ServerSideApply {
return fmt.Errorf("--prune is in alpha and doesn't currently work on objects created by server-side apply")
}
return nil return nil
} }

View File

@ -147,6 +147,14 @@ func TestApplyFlagValidation(t *testing.T) {
}, },
expectedErr: "--force cannot be used with --prune", expectedErr: "--force cannot be used with --prune",
}, },
{
args: [][]string{
{"server-side", "true"},
{"prune", "true"},
{"all", "true"},
},
expectedErr: "--prune is in alpha and doesn't currently work on objects created by server-side apply",
},
} }
for _, test := range tests { for _, test := range tests {