Change:
What happened: Tried to convert a v1beta1 Ingress object to v1, and received the following error: What you expected to happen: The conversion to work. How to reproduce it (as minimally and precisely as possible): Then run: /sig cli /assign
Can i work on this issue?
/assign
/triage accepted

Discussion:
- selectorRegexp: k8s[.]io/kubernetes/pkg allowedPrefixes: - k8s.io/kubernetes/pkg/api/legacyscheme <ins> - k8s.io/kubernetes/pkg/apis/admission - k8s.io/kubernetes/pkg/apis/admission/install - k8s.io/kubernetes/pkg/apis/admission/v1 - k8s.io/kubernetes/pkg/apis/admission/v1beta1 - k8s.io/kubernetes/pkg/apis/admissionregistration - k8s.io/kubernetes/pkg/apis/admissionregistration/install - k8s.io/kubernetes/pkg/apis/admissionregistration/v1 - k8s.io/kubernetes/pkg/apis/admissionregistration/v1beta1 - k8s.io/kubernetes/pkg/apis/apiserverinternal - k8s.io/kubernetes/pkg/apis/apiserverinternal/fuzzer - k8s.io/kubernetes/pkg/apis/apiserverinternal/install - k8s.io/kubernetes/pkg/apis/apiserverinternal/v1alpha1 </ins> - k8s.io/kubernetes/pkg/apis/apps - k8s.io/kubernetes/pkg/apis/apps/install - k8s.io/kubernetes/pkg/apis/apps/v1

- k8s.io/kubernetes/pkg/apis/core/helper - k8s.io/kubernetes/pkg/apis/core/install - k8s.io/kubernetes/pkg/apis/core/v1 <ins> - k8s.io/kubernetes/pkg/apis/discovery - k8s.io/kubernetes/pkg/apis/discovery/install - k8s.io/kubernetes/pkg/apis/discovery/v1alpha1 - k8s.io/kubernetes/pkg/apis/discovery/v1beta1 </ins> - k8s.io/kubernetes/pkg/apis/events - k8s.io/kubernetes/pkg/apis/events/install - k8s.io/kubernetes/pkg/apis/events/v1beta1 - k8s.io/kubernetes/pkg/apis/extensions - k8s.io/kubernetes/pkg/apis/extensions/install - k8s.io/kubernetes/pkg/apis/extensions/v1beta1 <ins> - k8s.io/kubernetes/pkg/apis/flowcontrol - k8s.io/kubernetes/pkg/apis/flowcontrol/install - k8s.io/kubernetes/pkg/apis/flowcontrol/v1alpha1 - k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1 - k8s.io/kubernetes/pkg/apis/imagepolicy - k8s.io/kubernetes/pkg/apis/imagepolicy/install - k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1 </ins> - k8s.io/kubernetes/pkg/apis/networking <ins> - k8s.io/kubernetes/pkg/apis/node - k8s.io/kubernetes/pkg/apis/node/install - k8s.io/kubernetes/pkg/apis/node/v1 - k8s.io/kubernetes/pkg/apis/node/v1alpha1 - k8s.io/kubernetes/pkg/apis/node/v1beta1 </ins> - k8s.io/kubernetes/pkg/apis/policy - k8s.io/kubernetes/pkg/apis/policy/install - k8s.io/kubernetes/pkg/apis/policy/v1beta1

visibility = ["//visibility:public"], deps = [ "//pkg/api/legacyscheme:go_default_library", <ins> "//pkg/apis/admission/install:go_default_library", "//pkg/apis/admissionregistration/install:go_default_library", "//pkg/apis/apiserverinternal/install:go_default_library", </ins> "//pkg/apis/apps/install:go_default_library", "//pkg/apis/authentication/install:go_default_library", "//pkg/apis/authorization/install:go_default_library",

"//pkg/apis/coordination/install:go_default_library", "//pkg/apis/core:go_default_library", "//pkg/apis/core/install:go_default_library", <ins> "//pkg/apis/discovery/install:go_default_library", </ins> "//pkg/apis/events/install:go_default_library", "//pkg/apis/extensions/install:go_default_library", <ins> "//pkg/apis/flowcontrol/install:go_default_library", "//pkg/apis/imagepolicy/install:go_default_library", "//pkg/apis/networking/install:go_default_library", "//pkg/apis/node/install:go_default_library", </ins> "//pkg/apis/policy/install:go_default_library", "//pkg/apis/rbac/install:go_default_library", "//pkg/apis/scheduling/install:go_default_library",

go_test( name = "go_default_test", <del> srcs = ["convert_test.go"], </del> <ins> srcs = [ "convert_test.go", "import_known_versions_test.go", ], </ins> data = [ "//test/fixtures", ], embed = [":go_default_library"], deps = [ <ins> "//pkg/api/legacyscheme:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", </ins> "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library", <ins> "//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library", </ins> "//staging/src/k8s.io/client-go/rest/fake:go_default_library", "//staging/src/k8s.io/kubectl/pkg/cmd/testing:go_default_library", ],

}, }, }, <ins> { name:          "v1beta1 Ingress to extensions Ingress", file:          "../../../../test/fixtures/pkg/kubectl/cmd/convert/v1beta1ingress.yaml", outputVersion: "extensions/v1beta1", fields: []checkField{ { expected: "apiVersion: extensions/v1beta1", }, }, }, </ins> } for _, tc := range testcases {

// These imports are the API groups the client will support. // TODO: Remove these manual install once we don't need legacy scheme in convert import ( <ins> _ "k8s.io/kubernetes/pkg/apis/admission/install" _ "k8s.io/kubernetes/pkg/apis/admissionregistration/install" _ "k8s.io/kubernetes/pkg/apis/apiserverinternal/install" </ins> _ "k8s.io/kubernetes/pkg/apis/apps/install" _ "k8s.io/kubernetes/pkg/apis/authentication/install" _ "k8s.io/kubernetes/pkg/apis/authorization/install"

_ "k8s.io/kubernetes/pkg/apis/certificates/install" _ "k8s.io/kubernetes/pkg/apis/coordination/install" _ "k8s.io/kubernetes/pkg/apis/core/install" <ins> _ "k8s.io/kubernetes/pkg/apis/discovery/install" </ins> _ "k8s.io/kubernetes/pkg/apis/events/install" _ "k8s.io/kubernetes/pkg/apis/extensions/install" <ins> _ "k8s.io/kubernetes/pkg/apis/flowcontrol/install" _ "k8s.io/kubernetes/pkg/apis/imagepolicy/install" _ "k8s.io/kubernetes/pkg/apis/networking/install" _ "k8s.io/kubernetes/pkg/apis/node/install" </ins> _ "k8s.io/kubernetes/pkg/apis/policy/install" _ "k8s.io/kubernetes/pkg/apis/rbac/install" _ "k8s.io/kubernetes/pkg/apis/scheduling/install"

<ins> /* Copyright 2021 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package convert import ( "sort" "strings" "testing" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes/scheme" "k8s.io/kubernetes/pkg/api/legacyscheme" ) func TestKnownVersions(t *testing.T) { legacytypes := legacyscheme.Scheme.AllKnownTypes() alreadyErroredGroups := map[string]bool{} var gvks []schema.GroupVersionKind for gvk := range scheme.Scheme.AllKnownTypes() { gvks = append(gvks, gvk) } sort.Slice(gvks, func(i, j int) bool { if isWatchEvent1, isWatchEvent2 := gvks[i].Kind == "WatchEvent", gvks[j].Kind == "WatchEvent"; isWatchEvent1 != isWatchEvent2 { return isWatchEvent2 } if isList1, isList2 := strings.HasSuffix(gvks[i].Kind, "List"), strings.HasSuffix(gvks[j].Kind, "List"); isList1 != isList2 { return isList2 } if isOptions1, isOptions2 := strings.HasSuffix(gvks[i].Kind, "Options"), strings.HasSuffix(gvks[j].Kind, "Options"); isOptions1 != isOptions2 { return isOptions2 } if isInternal1, isInternal2 := gvks[i].Group == runtime.APIVersionInternal, gvks[j].Group == runtime.APIVersionInternal; isInternal1 != isInternal2 { return isInternal2 } return gvks[i].String() < gvks[j].String() }) for _, gvk := range gvks { if alreadyErroredGroups[gvk.Group] { continue } if _, legacyregistered := legacytypes[gvk]; !legacyregistered { t.Errorf("%v is not registered in legacyscheme. Add group %q (all internal and external versions) to convert/import_known_versions.go", gvk, gvk.Group) alreadyErroredGroups[gvk.Group] = true } } } </ins>

<ins> apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: example spec: backend: serviceName: default-backend servicePort: 80 rules: - http: paths: - path: /testpath backend: serviceName: test servicePort: 80 </ins>  No newline at end of file