Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useList not filtering by namespace on CRDs #2613

Open
pedroosorio opened this issue Nov 27, 2024 · 2 comments · May be fixed by #2617
Open

useList not filtering by namespace on CRDs #2613

pedroosorio opened this issue Nov 27, 2024 · 2 comments · May be fixed by #2617
Assignees
Labels
bug Something isn't working frontend Issues related to the frontend regression Bugs for things that used to work in previous releases.

Comments

@pedroosorio
Copy link

Describe the bug

Calling useList() on a CRD returns all results regardless of the filters

To Reproduce

export function ListWrapper({ namespace }) {
  const [crd] = K8s.ResourceClasses.CustomResourceDefinition.useGet(
    '<any CRD>'
  );

  const crdCrlass = useMemo(() => {
    return crd?.makeCRClass();
  }, [crd]);

  return <List resourceClass={crdCrlass}/>;
}

interface ListProps {
  resourceClass: KubeCRD;
}

export function List(props: ListProps) {
  const namespace = "some-namespace"
  const queryData = {
    namespace
  };

  let filtered;
  let resource = undefined;
  if (props.resourceClass) {
    [resource] = props.resourceClass.useList(queryData);
    filtered = resource;
  }

  // This shouldn't be needed, but useList is not filtering properly
  if (resource) {
    console.log(resource?.length)
    filtered = resource.filter(
      item => item.jsonData.metadata.namespace === namespace
    );
    console.log(filtered?.length)
  }

  return <></>;
}

Environment (please provide info about your environment):

  • Kubernetes v1.29.2
  • Headlamp v0.26.0
  • @kinvolk/headlamp-plugin 0.10.0
@pedroosorio pedroosorio added the bug Something isn't working label Nov 27, 2024
@dosubot dosubot bot added the backend Issues related to the backend label Nov 27, 2024
@joaquimrocha
Copy link
Collaborator

cc/ @sniok

@sniok sniok added frontend Issues related to the frontend regression Bugs for things that used to work in previous releases. and removed backend Issues related to the backend labels Nov 28, 2024
@sniok
Copy link
Contributor

sniok commented Nov 28, 2024

Hi, thanks for opening an issue for this! This is a regression after our recent refactor. Opened a PR with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Issues related to the frontend regression Bugs for things that used to work in previous releases.
Projects
Development

Successfully merging a pull request may close this issue.

3 participants