-
Story
-
Resolution: Unresolved
-
Major
-
None
-
None
-
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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