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.
This commit is contained in:
Arda Güçlü
2021-12-21 11:53:09 +03:00
parent cd117abf19
commit 43d8b3459b
7 changed files with 103 additions and 1 deletions

View File

@@ -892,6 +892,13 @@ runTests() {
record_command run_kubectl_explain_tests
fi
##############################
# CRD Deletion / Re-creation #
##############################
if kube::test::if_supports_resource "${namespaces}" ; then
record_command run_crd_deletion_recreation_tests
fi
###########
# Swagger #