Uploaded image for project: 'Hybrid Application Console'
  1. Hybrid Application Console
  2. HAC-801

Misc types cleanup from K8s utility migration to dynamic plugin SDK

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Core
    • False
    • False
    • None

      While migrating the K8s utilities to the dynamic plugin SDK, several type issues were noticed. See https://issues.redhat.com/browse/HAC-488

      Acceptance Criteria

      1. Do not expose/directly use resource identifier type, use K8sGroupVersionKind instead. This will require cleaning up any legacy logic that imports K8sResourceIdentifier. Resource identifier is exposed (and should not be) here: https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L3. K8sGroupVersionKind was added here: https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L111
      2. Remove type GroupVersionKind = string type (redundant since string | string = string). See https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L120
      3. Remove additional keys on K8sResourceCommon (spec, data, etc) - specific use cases may need to utilize generics (or a specific type that extends common). See https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L37
      4. Move K8s selector, query, and operation types to an appropriately named file like `k8s-filter.ts`. See https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L54-L107
      5. For legacy serializable k8s reference tilda logic - move to a new file`src/types/k8s-internal.ts` and do not expose. See https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L114 and https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/types/k8s.ts#L123
      6. The singular useK8sWatchResource has an `| null` on the input parameter. We should remove that and enforce a K8s resource is passed in. See https://github.com/openshift/dynamic-plugin-sdk/pull/68/files#r857627499
      7. Improve types used for the usePrevious hook https://github.com/openshift/dynamic-plugin-sdk/blob/main/packages/lib-utils/src/k8s/hooks/usePrevious.ts (utilized in useK8sWatchResources). See review comment here: https://github.com/openshift/dynamic-plugin-sdk/pull/68#discussion_r857638293 

              spadgett@redhat.com Samuel Padgett
              bflorkie@redhat.com Bryan Florkiewicz
              Archiver:
              rhn-support-sthamilt Stacey Hamilton

                Created:
                Updated:
                Archived: