Skip to content

ResourceRef confusion in operator support #6062

Open
@absoludity

Description

Summary
While working on #6013, particularly replacing the frontend code with the connect grpc-web client, I've hit a lint type issue because with the previously generated files, the ResourceRef object was apparently interchangeable with the shared/ResourceRef object which was still used for operator support, and included extra fields (filter, namespaced etc.) With the new generated files, the code works fine in tests, but tsc won't allow these two objects to be used interchangeably.

I don't want to risk an unintended change within the large PR that I'm doing, so will instead disable the lint for this item specifically in my PR have extended our custom ResourceRef from the client one, so that I can come back and look at removing our custom one in isolation with a focused PR and proper testing.

Description
The main place this arises in in the OperatorInstance.tsx where the resulting resource refs are collected using an IAppViewResourceRefs:

let result: IAppViewResourceRefs = {
ingresses: [],
deployments: [],
statefulsets: [],
daemonsets: [],
otherResources: [],
services: [],
secrets: [],
};

This interface uses the client ResourceRef class, yet the OperatorInstance code adds the shared/ResourceRef annotated objects, which are not compatible due to the missing methods and constructor etc.

Additional Info

CustomAppView appears to use the extra namespaced field in tests (but doesn't appear to need to) Similarly, Kube.test.ts appears to use namespaced unnecessarily. Need to audit whether any of the extra fields are used elsewhere. The test "updates the state with the CRD resources" fails if using normal resourcerefs here, because of the missing filter, but again, need to audit where this filter field of the ResourceRef is used in the actual code outside tests.

Metadata

Assignees

No one assigned

    Labels

    component/uiIssue related to kubeapps UIkind/enhancementAn issue that reports an enhancement for an implemented feature

    Type

    No type

    Projects

    • Status

      🗂 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions