Kubernetes-client: Incorrect plural form for Endpoints kind

Created on 23 Feb 2020  路  8Comments  路  Source: fabric8io/kubernetes-client

I am getting following error when trying to watch Endpoints

ERROR 20981 --- [pool-3-thread-1] i.f.k.c.i.cache.ReflectorRunnable        : Failure in list-watch: Failure executing: GET at: https://192.168.1.12:16443/api/v1/endpointss. Message: the server could not find the requested resource. Received status: Status(apiVersion=v1, code=404, details=StatusDetails(causes=[], group=null, kind=null, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=the server could not find the requested resource, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=NotFound, status=Failure, additionalProperties={}).
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://192.168.1.12:16443/api/v1/endpointss. Message: the server could not find the requested resource. Received status: Status(apiVersion=v1, code=404, details=StatusDetails(causes=[], group=null, kind=null, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=the server could not find the requested resource, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=NotFound, status=Failure, additionalProperties={}).
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:510)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:449)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:413)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:372)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:354)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.listRequestHelper(BaseOperation.java:147)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:614)
    at io.fabric8.kubernetes.client.informers.SharedInformerFactory$1.list(SharedInformerFactory.java:126)
    at io.fabric8.kubernetes.client.informers.SharedInformerFactory$1.list(SharedInformerFactory.java:119)
    at io.fabric8.kubernetes.client.informers.cache.ReflectorRunnable.run(ReflectorRunnable.java:60)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:830)

Looks like method io.fabric8.kubernetes.client.utils.Utils#getPluralFromKind does not properly handle Endpoints.

To me it should not add s in plural form.

All 8 comments

@adcis : Which version of Kubernetes client are you using? Haven't reproduced your issue but I checked and below is generation *OperationsImpl class related to endpoints, it seems to be correct.:

public class EndpointsOperationsImpl extends HasMetadataOperation<Endpoints, EndpointsList, DoneableEndpoints, Resource<Endpoints, DoneableEndpoints>> {

  public EndpointsOperationsImpl(OkHttpClient client, Config config) {
    this(client, config, null);
  }

  public EndpointsOperationsImpl(OkHttpClient client, Config config, String namespace) {
    this(new OperationContext().withOkhttpClient(client).withConfig(config).withNamespace(namespace));
  }

  public EndpointsOperationsImpl(OperationContext context) {
    super(context.withApiGroupName("")
    .withApiGroupVersion("v1")
    .withPlural("endpoints"));
    this.type = Endpoints.class;
    this.listType = EndpointsList.class;
    this.doneableType = DoneableEndpoints.class;
  }

  public EndpointsOperationsImpl newInstance(OperationContext context) {
    return new EndpointsOperationsImpl(context);
  }
}

@rohanKanojia I tried with 4.6.0 first and then switched to 4.8.0, both failed. I use local microk8s. I can send you link to my code to reproduce it later on when come back home.

@rohanKanojia I created a sample project.
https://github.com/adcis/endpointss
Just run main class against some "valid" kube config

@adcis : Thanks, will try to reproduce your issue.

@rohanKanojia Have you had a change to look at that?

@adcis : apologies, I will look tomorrow.

@adcis : Yes, I can reproduce your issue now :laughing: . Seems like there was a minor bug in the way I was determining plural forms in SharedInformers. I've created a PR to fix it. It will be available in next release.

@rohanKanojia I can see unit test revealed also another incorrect plural form ;)
Thanks a lot for help.

Was this page helpful?
0 / 5 - 0 ratings