Merge pull request #26597 from caesarxuchao/fix-26425
Automatic merge from submit-queue retry GetThirdPartyGroupVersions GetThirdPartyGroupVersions() may return a "NotFound" error if a thirdparty group is deleted in the interim between the group-discovery and the resource-discovery. This is causing e2e flakes in all tests that run kubectl, because test/e2e/thirdparty.go is creating/deleting thirdparty groups. Fix #26425 The e2e flakes will have the following pattern: 1. the test is calling kubectl 2. error message is `Error from server: the server could not find the requested resource` 3. in the apiserver log, you should see `GET /apis/company.com/v1: (518.944µs) 404 [[kubectl/v1.3.0 (linux/amd64) kubernetes/ae28564] 104.154.110.118:46043]` For detail see [here](https://github.com/kubernetes/kubernetes/issues/26425#issuecomment-222844523) cc @janetkuo @brendanburns
This commit is contained in:
@@ -489,6 +489,10 @@ func ShouldRecord(cmd *cobra.Command, info *resource.Info) bool {
|
||||
return GetRecordFlag(cmd) || ContainsChangeCause(info)
|
||||
}
|
||||
|
||||
// GetThirdPartyGroupVersions returns the thirdparty "group/versions"s and
|
||||
// resources supported by the server. A user may delete a thirdparty resource
|
||||
// when this function is running, so this function may return a "NotFound" error
|
||||
// due to the race.
|
||||
func GetThirdPartyGroupVersions(discovery discovery.DiscoveryInterface) ([]unversioned.GroupVersion, []unversioned.GroupVersionKind, error) {
|
||||
result := []unversioned.GroupVersion{}
|
||||
gvks := []unversioned.GroupVersionKind{}
|
||||
|
||||
Reference in New Issue
Block a user