Changes in kubectl apply --prune to support k8s Inclusive Naming Initiative:
* Deprecated the --prune-whitelist flag.
* Deprecated the PruneWhitelist field on ApplyFlags struct.
* Removed PruneWhitelist field (not used anywhere) from ApplyOptions struct.
* Added --prune-allowlist flag.
* Added PruneAllowlist field on ApplyFlags struct.
* Added unit tests for prune with allowlist
This commit also fixes a bug where the command would fail if you specified
the sameGVK multiple times for --allow-whitelist. Now it only attempts to
prune the unique set of allowed GVKs.
Kubernetes-commit: f7ebf4d8852d4500f24100ca9a4ca665efc1fada
Currently `kubectl apply` determines correct patch type for given
GVKs by trying to register schema and if it succeeds, it uses
strategic-merge-patch.
But OpenAPI endpoint already stores which patch types are supported
by GVKs. This PR checks OpenAPI endpoint to retrieve patch type,
if OpenAPI is enabled. If it is not enabled, patch type determination
will be done as conventional registration method.
Kubernetes-commit: cddbb0c56397448ac0489f0473a26601c1feece8
This commit removes passing source field as parameter. Instead,
this commit returns error verb and error functions to caller function.
Caller function can add source field by generating correct message.
Kubernetes-commit: d336f7df874dc978ebd97971e1fc93d891c21e7d
Patch type determination is done by checking existence
of resource in schema and if it exists, it uses strategic merge patch.
Otherwise, like for CRDs, it uses merge patch type.
Currently, this code portion is not easily extensible and this PR
splits required checks into their own function to increase extensibility.
Kubernetes-commit: 15512210e3e14b0c827d13334394d658dc7ddc88
Validate function is used to validate command options and should not get
any additional parameter. To preserve compatibility across all
kubectl commands, this PR removes all parameters in validate functions.
Kubernetes-commit: 8fb423bfabe0d53934cc94c154c7da2dc3ce1332
* Fix: kubectl create -f and kubectl delete -f are not glob friendly
* gofmt fix
* removing unused receiver
* adding extra test
* log paths used
* fixing bad merge
* klog/v2 mod
* rebase fixes
* better error fmt
* error fmt unit test
* PR comments and tests
* Add reference to globbing to help snippets
Kubernetes-commit: 2cb3c7f706dbf266820fbde2e1b23a320e5d3de7
This PR does some refactors for diff/prune;
- GetRESTMappings takes value array instead reference
- Move getObjectName into diff instead prune
- License, etc. changes
Kubernetes-commit: 6c449dd272c95f2aeb3bb77e67d312d8df21bd62
Currently, server-side dry-run fetches the OpenAPI schema for every
single object.
This change fetches the OpenAPI schema only once.
Kubernetes-commit: caa158610dfb53de3582ed6df0eb37359206fc66
cleanup: use i18n.T only on string literals
cleanup: sort imports
Add i18n dependency for wait.go
Remove translation on envResource
cleanup: translate string instead of variable
cleanup: sort imports
cleanup: translate string literal only
Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
Some unit tests throw this warning.
W1013 09:06:21.581870 176998 helpers.go:567] --dry-run=true is deprecated (boolean value) and can be replaced with --dry-run=client.
This patch removes the warning by using --dry-run=client instead of --dry-run=true.
The unit tests that are affected are:
make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/apply GOFLAGS=-v
make test WHAT=./vendor/k8s.io/kubectl/pkg/cmd/create GOFLAGS=-v
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Kubernetes-commit: ad7cbac16354e19981e986bbc2b3fd9cfa930d45
For the beta server-side dry-run feature, `kubectl apply` provided the
`--server-dry-run` flag.
As of 1.18, this flag was deprecated and marked to be removed after 1
release.
Kubernetes-commit: 3e93f9926279db8a4d064d615c4ad7cfdc7ab38b
- Remove the ServerDryRun field and delegate it entirely to the resource.Helper
- Use resource.Helper for deletions (as in `kubectl apply --force`)
instead of using the pruner's method that uses a dynamic client
- Reduce the resource.Helpers and times we check for server-side dry-run
in apply
Kubernetes-commit: f0eb68c0cfcff6d50d9d5ec278f96820e3cb3f9a