Open Limorerez opened 2 years ago
Is there any way to affect this mistaken guessing?
A workaround is to pass empty list of objects
https://github.com/kubernetes/client-go/blob/cab7ba1d4a523956b6395dcbe38620159ac43fef/kubernetes/fake/clientset_generated.go#L124-L130
and manually use Create()
on the tracker instead of Add()
as suggested here https://github.com/kubernetes/client-go/blob/cab7ba1d4a523956b6395dcbe38620159ac43fef/testing/fixture.go#L326-L330
I've also stumbled across this when using
dynClient := dyn_fake.NewSimpleDynamicClientWithCustomListKinds(scheme.Scheme,
map[schema.GroupVersionResource]string{
{
Group: "gateway.networking.k8s.io",
Version: "v1beta1",
Resource: "gateways",
}: "GatewayList",
},
...
)
and then listing a gateway (via unstructured client) yields
panic: coding error: you must register resource to list kind for every resource you're going to LIST when creating the client. See NewSimpleDynamicClientWithCustomListKinds or register the list into the scheme: gateway.networking.k8s.io/v1beta1, Resource=gateways out of map[/, Resource=:List /v1, Resource=apigroups:APIGroupList /v1, Resource=apiresources:APIResourceList /v1, Resource=componentstatuses:ComponentStatusList /v1, Resource=configmaps:ConfigMapList /v1, Resource=endpoints:EndpointsList /v1, Resource=events:EventList /v1, Resource=limitranges:LimitRangeList /v1, Resource=namespaces:NamespaceList /v1, Resource=nodes:NodeList /v1, Resource=persistentvolumeclaims:PersistentVolumeClaimList /v1, Resource=persistentvolumes:PersistentVolumeList /v1, Resource=pods:PodList /v1, Resource=podtemplates:PodTemplateList /v1, Resource=replicationcontrollers:ReplicationControllerList /v1, Resource=resourcequotas:ResourceQuotaList /v1, Resource=secrets:SecretList /v1, Resource=serviceaccounts:ServiceAccountList /v1, Resource=services:ServiceList admissionregistration.k8s.io/v1, Resource=mutatingwebhookconfigurations:MutatingWebhookConfigurationList admissionregistration.k8s.io/v1, Resource=validatingwebhookconfigurations:ValidatingWebhookConfigurationList admissionregistration.k8s.io/v1beta1, Resource=mutatingwebhookconfigurations:MutatingWebhookConfigurationList admissionregistration.k8s.io/v1beta1, Resource=validatingwebhookconfigurations:ValidatingWebhookConfigurationList apps/v1, Resource=controllerrevisions:ControllerRevisionList apps/v1, Resource=daemonsets:DaemonSetList apps/v1, Resource=deployments:DeploymentList apps/v1, Resource=replicasets:ReplicaSetList apps/v1, Resource=statefulsets:StatefulSetList apps/v1beta1, Resource=controllerrevisions:ControllerRevisionList apps/v1beta1, Resource=deployments:DeploymentList apps/v1beta1, Resource=statefulsets:StatefulSetList apps/v1beta2, Resource=controllerrevisions:ControllerRevisionList apps/v1beta2, Resource=daemonsets:DaemonSetList apps/v1beta2, Resource=deployments:DeploymentList apps/v1beta2, Resource=replicasets:ReplicaSetList apps/v1beta2, Resource=statefulsets:StatefulSetList autoscaling/v1, Resource=horizontalpodautoscalers:HorizontalPodAutoscalerList autoscaling/v2, Resource=horizontalpodautoscalers:HorizontalPodAutoscalerList autoscaling/v2beta1, Resource=horizontalpodautoscalers:HorizontalPodAutoscalerList autoscaling/v2beta2, Resource=horizontalpodautoscalers:HorizontalPodAutoscalerList batch/v1, Resource=cronjobs:CronJobList batch/v1, Resource=jobs:JobList batch/v1beta1, Resource=cronjobs:CronJobList certificates.k8s.io/v1, Resource=certificatesigningrequests:CertificateSigningRequestList certificates.k8s.io/v1beta1, Resource=certificatesigningrequests:CertificateSigningRequestList coordination.k8s.io/v1, Resource=leases:LeaseList coordination.k8s.io/v1beta1, Resource=leases:LeaseList discovery.k8s.io/v1, Resource=endpointslices:EndpointSliceList discovery.k8s.io/v1beta1, Resource=endpointslices:EndpointSliceList events.k8s.io/v1, Resource=events:EventList events.k8s.io/v1beta1, Resource=events:EventList extensions/v1beta1, Resource=daemonsets:DaemonSetList extensions/v1beta1, Resource=deployments:DeploymentList extensions/v1beta1, Resource=ingresses:IngressList extensions/v1beta1, Resource=networkpolicies:NetworkPolicyList extensions/v1beta1, Resource=podsecuritypolicies:PodSecurityPolicyList extensions/v1beta1, Resource=replicasets:ReplicaSetList flowcontrol.apiserver.k8s.io/v1alpha1, Resource=flowschemas:FlowSchemaList flowcontrol.apiserver.k8s.io/v1alpha1, Resource=prioritylevelconfigurations:PriorityLevelConfigurationList flowcontrol.apiserver.k8s.io/v1beta1, Resource=flowschemas:FlowSchemaList flowcontrol.apiserver.k8s.io/v1beta1, Resource=prioritylevelconfigurations:PriorityLevelConfigurationList flowcontrol.apiserver.k8s.io/v1beta2, Resource=flowschemas:FlowSchemaList flowcontrol.apiserver.k8s.io/v1beta2, Resource=prioritylevelconfigurations:PriorityLevelConfigurationList gateway.networking.k8s.io/v1beta1, Resource=gatewaies:GatewayList gateway.networking.k8s.io/v1beta1, Resource=gatewayclasses:GatewayClassList gateway.networking.k8s.io/v1beta1, Resource=httproutes:HTTPRouteList internal.apiserver.k8s.io/v1alpha1, Resource=storageversions:StorageVersionList networking.k8s.io/v1, Resource=ingressclasses:IngressClassList networking.k8s.io/v1, Resource=ingresses:IngressList networking.k8s.io/v1, Resource=networkpolicies:NetworkPolicyList networking.k8s.io/v1beta1, Resource=ingressclasses:IngressClassList networking.k8s.io/v1beta1, Resource=ingresses:IngressList node.k8s.io/v1, Resource=runtimeclasses:RuntimeClassList node.k8s.io/v1alpha1, Resource=runtimeclasses:RuntimeClassList node.k8s.io/v1beta1, Resource=runtimeclasses:RuntimeClassList policy/v1, Resource=poddisruptionbudgets:PodDisruptionBudgetList policy/v1beta1, Resource=poddisruptionbudgets:PodDisruptionBudgetList policy/v1beta1, Resource=podsecuritypolicies:PodSecurityPolicyList rbac.authorization.k8s.io/v1, Resource=clusterrolebindings:ClusterRoleBindingList rbac.authorization.k8s.io/v1, Resource=clusterroles:ClusterRoleList rbac.authorization.k8s.io/v1, Resource=rolebindings:RoleBindingList rbac.authorization.k8s.io/v1, Resource=roles:RoleList rbac.authorization.k8s.io/v1alpha1, Resource=clusterrolebindings:ClusterRoleBindingList rbac.authorization.k8s.io/v1alpha1, Resource=clusterroles:ClusterRoleList rbac.authorization.k8s.io/v1alpha1, Resource=rolebindings:RoleBindingList rbac.authorization.k8s.io/v1alpha1, Resource=roles:RoleList rbac.authorization.k8s.io/v1beta1, Resource=clusterrolebindings:ClusterRoleBindingList rbac.authorization.k8s.io/v1beta1, Resource=clusterroles:ClusterRoleList rbac.authorization.k8s.io/v1beta1, Resource=rolebindings:RoleBindingList rbac.authorization.k8s.io/v1beta1, Resource=roles:RoleList scheduling.k8s.io/v1, Resource=priorityclasses:PriorityClassList scheduling.k8s.io/v1alpha1, Resource=priorityclasses:PriorityClassList scheduling.k8s.io/v1beta1, Resource=priorityclasses:PriorityClassList storage.k8s.io/v1, Resource=csidrivers:CSIDriverList storage.k8s.io/v1, Resource=csinodes:CSINodeList storage.k8s.io/v1, Resource=csistoragecapacities:CSIStorageCapacityList storage.k8s.io/v1, Resource=storageclasses:StorageClassList storage.k8s.io/v1, Resource=volumeattachments:VolumeAttachmentList storage.k8s.io/v1alpha1, Resource=csistoragecapacities:CSIStorageCapacityList storage.k8s.io/v1alpha1, Resource=volumeattachments:VolumeAttachmentList storage.k8s.io/v1beta1, Resource=csidrivers:CSIDriverList storage.k8s.io/v1beta1, Resource=csinodes:CSINodeList storage.k8s.io/v1beta1, Resource=csistoragecapacities:CSIStorageCapacityList storage.k8s.io/v1beta1, Resource=storageclasses:StorageClassList storage.k8s.io/v1beta1, Resource=volumeattachments:VolumeAttachmentList]
Resource=gatewaies:GatewayList gateway.networking.k8s.io/v1beta1
from k8s.io/client-go@v0.24.3/dynamic/fake/simple.go:353
.
Any work arounds for this?
I tried adding a test case in https://github.com/kubernetes/gengo/blob/940203f2dae74b24bb30948aa5a9619ba259d4a5/namer/plural_namer_test.go to verify that this is indeed broken for Gateway
/gateway
but it doesn't look like that's the case. I've even checked several versions back to verify which version of gengo
is being used by https://github.com/kubernetes/code-generator and match that with my cluster's version and that didn't yield a failure.
Ok, got it: https://github.com/kubernetes/kubernetes/pull/110053
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Still an issue (I'm mostly bumping this because of the problem with Gateway APIs).
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
There seem to be a potential way forward to fix this. I've posted https://github.com/kubernetes/kubernetes/pull/110053#issuecomment-1585644795 to ensure it's "the right way" and if that's the case I can propose something for everyone to review.
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
any updates ?
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/reopen
/remove-lifecycle rotten
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
/reopen /remove-lifecycle rotten
@pmalek: Reopened this issue.
Expected:
gateway-> gateways Got: gateway-> gatewaies
Is there any way to affect this mistaken guessing?