Add manually invalidate cache documentation into delete

When CRDs are deleted, discovery local cache is not invalidated.
This brings about `resource not found` error when new CRD with same name is created
with different fields(ie. changing scope from cluster-wide to namespaced).
Because this already deleted CRD still stays in serverresources.json and kubectl tries to use it.

This local cached files have 10 minutes TTL. After deletion, if user waits 10 minutes,
files will be expired and deleted and there will be no errors. However, 10 minutes is a long time
and cache needs to be invalidated after deletion occurs.

This PR adds a document into delete command by noting that there might be a need to invalidate discovery
cache when CRD is deleted. In addition to that this PR adds a test to catch this behavior.

Kubernetes-commit: 43d8b3459baec794c8a3a858c04f1562a09886a3
This commit is contained in:
Arda Güçlü 2021-12-21 11:53:09 +03:00 committed by Kubernetes Publisher
parent a4aec62157
commit 119abb31f8
1 changed files with 5 additions and 1 deletions

View File

@ -69,7 +69,11 @@ var (
Note that the delete command does NOT do resource version checks, so if someone submits an
update to a resource right when you submit a delete, their update will be lost along with the
rest of the resource.`))
rest of the resource.
After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up
to 10 minutes. If you don't want to wait, you might want to run "kubectl api-resources"
to refresh the discovery cache.`))
deleteExample = templates.Examples(i18n.T(`
# Delete a pod using the type and name specified in pod.json