Skip to content

informer's cache is empty after await informer.start() #1952

Closed as not planned
@atamon

Description

@atamon

Describe the bug
We're migrating from using v0.2X of this library to 1.0, currently 1.0.0-rc7

In the previous version we could rely on informer.list(this.options.namespace) returning the complete list of objects after await informer.start()

With the new version the first call returns undefined.

We use the add, change and delete events to react to changes to this list, and when doing so we can see that the cache/informer is filled up from 0 to N objects.

Is this a new intended behavior, or should it be considered a bug?

Client Version
1.0.0-rc7

Server Version
v1.30.5

To Reproduce

const fn = () => {
    return client.list(
      config.apiVersionLatest,
      config.kind,
      namespace,
    );
  };

  const informer = k8s.makeInformer(
    kubeConfig,
    `/apis/${config.apiVersionLatest}/namespaces/${namespace}/mycrd`,
    fn,
  );

  await informer.start()
  this.informer.list(this.options.namespace) // <- returns undefined, but I would have expected a full cache

Expected behavior
Being able to list all objects directly after the informer.start() promise resolves

Example Code
See steps to reproduce

Environment (please complete the following information):

  • OS: Linux
  • NodeJS Version v20.18.0
  • Cloud runtime GKE

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions