Skip to content

strimzi: Add support for v1 resources and fix null crash#850

Open
AshutoshSharma-pixel wants to merge 1 commit into
headlamp-k8s:mainfrom
AshutoshSharma-pixel:fix/strimzi-v1-support
Open

strimzi: Add support for v1 resources and fix null crash#850
AshutoshSharma-pixel wants to merge 1 commit into
headlamp-k8s:mainfrom
AshutoshSharma-pixel:fix/strimzi-v1-support

Conversation

@AshutoshSharma-pixel

Copy link
Copy Markdown
Contributor

Fixes #839
Strimzi 1.0.0 dropped v1beta2 and now only serves v1 resources. The plugin hardcoded v1beta2, causing a null crash in useMemo when listing topics or users.
Changes:

Updated detail pages for Kafka, KafkaTopic, KafkaUser, KafkaConnect and KafkaConnector to use useStrimziApiVersions hook and dynamically select the correct resource class, preferring v1 over v1beta2 when available
Added null guards in useMemo hooks in KafkaUserList.tsx and KafkaTopicList.tsx to prevent crashes when kafkaClusters resolves to null
Added null guards in KafkaUserCreateFormModal.tsx and TopicFormModal.tsx

All checks passing: tsc, lint, format.

Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Strimzi plugin to work with Strimzi 1.0+ clusters that only serve v1 CRDs, and hardens the UI against null list data that previously caused crashes when listing/creating topics and users.

Changes:

  • Use useStrimziApiVersions in detail pages to select v1 resource classes when available (fallback to v1beta2).
  • Add null guards around useMemo/namespace+cluster derivation in Kafka topic/user list & form flows to prevent runtime crashes.
  • Apply a set of formatting/storybook/mock-data cleanups for readability and consistency.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
strimzi/src/utils/strimziApiVersion.test.ts Minor formatting adjustment in API version resolver tests.
strimzi/src/StrimziIntro.stories.tsx Storybook intro text formatting.
strimzi/src/storybookMocks/strimziMocks.ts Mock data formatting; minor connector config key normalization.
strimzi/src/mapView.tsx Formatting/readability changes; no functional logic change visible in diff.
strimzi/src/hooks/useTopologyTheme.ts Condensed ternaries for theme color values.
strimzi/src/hooks/useStrimziApiVersions.ts Minor formatting of initial state setup.
strimzi/src/components/users/Detail.tsx Select KafkaUser resource class dynamically (v1 vs v1beta2).
strimzi/src/components/topics/Detail.tsx Select KafkaTopic resource class dynamically (v1 vs v1beta2).
strimzi/src/components/kafkas/Detail.tsx Select Kafka resource class dynamically (v1 vs v1beta2).
strimzi/src/components/connects/Detail.tsx Select KafkaConnect resource class dynamically (v1 vs v1beta2).
strimzi/src/components/connectors/Detail.tsx Select KafkaConnector resource class dynamically (v1 vs v1beta2); text formatting.
strimzi/src/components/TopicFormModal.tsx Add defensive handling around cluster selection; formatting.
strimzi/src/components/KafkaUserList.tsx Add null guards to prevent crashes when kafka cluster list is null; formatting.
strimzi/src/components/KafkaTopicList.tsx Add null guards to prevent crashes when kafka cluster list is null; formatting.
strimzi/src/components/KafkaUserCreateFormModal.tsx Add defensive handling around cluster selection; formatting.
strimzi/src/components/KafkaTopologyModal.tsx Formatting/refactor of callback and markup.
strimzi/src/components/KafkaTopologyModal.stories.tsx Formatting.
strimzi/src/components/KafkaClusterTopology.tsx Formatting plus small functional implications around loading/state transitions.
strimzi/src/components/KafkaClusterTopology.stories.tsx Formatting.
strimzi/src/components/KafkaList.tsx Formatting.
strimzi/src/components/KafkaConnectorList.tsx Formatting.
strimzi/src/components/KafkaConnectorList.stories.tsx Formatting import + small inline simplification.
strimzi/src/components/KafkaConnectList.tsx Formatting.
strimzi/src/components/Toast.tsx Formatting (arrow fn parens removal).
strimzi/src/components/Toast.stories.tsx Formatting.
strimzi/src/components/StrimziNotInstalledMessage.tsx Formatting.
strimzi/src/components/StrimziErrorBoundary.tsx Formatting/markup wrapping.
strimzi/src/components/SecureSecretDisplay.tsx Formatting.
strimzi/src/components/SearchFilter.tsx Formatting (arrow fn parens removal).
strimzi/src/components/SearchFilter.stories.tsx Formatting.
strimzi/src/components/ResourceEditor.tsx Formatting + cleanup block braces.
strimzi/src/components/ResourceEditor.stories.tsx Formatting.
strimzi/src/components/KafkaUserList.stories.tsx Formatting.
strimzi/src/components/KafkaTopicList.stories.tsx Formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 628 to 632
([nodePoolData, podSetData, podData]: [
{ items?: KafkaNodePool[] },
{ items?: StrimziPodSet[] },
{ items?: Pod[] }
{ items?: Pod[] },
]) => {
Comment on lines +301 to +307
<Button
key="create"
variant="contained"
color="primary"
size="medium"
onClick={openCreateDialog}
>
Comment on lines +298 to +304
<Button
key="create"
variant="contained"
color="primary"
size="medium"
onClick={openCreateDialog}
>
Comment on lines +319 to +324
<Button
variant="contained"
color="primary"
onClick={onSubmit}
disabled={loading || !formData.name}
>
Comment on lines +435 to +440
<Button
variant="contained"
color="primary"
onClick={onSubmit}
disabled={loading || !formData.name}
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strimzi: support v1 resources

2 participants