Skip to content

kyverno: add Storybook stories for CELPolicyViewer#846

Open
Suhani95 wants to merge 1 commit into
headlamp-k8s:mainfrom
Suhani95:kyverno-celpolicyviewer-storybook
Open

kyverno: add Storybook stories for CELPolicyViewer#846
Suhani95 wants to merge 1 commit into
headlamp-k8s:mainfrom
Suhani95:kyverno-celpolicyviewer-storybook

Conversation

@Suhani95

Copy link
Copy Markdown

Summary

Adds Storybook coverage for the Kyverno CELPolicyViewer component.

This PR introduces stories for all supported CEL policy types:

  • ValidatingPolicy
  • MutatingPolicy
  • GeneratingPolicy
  • DeletingPolicy

The stories use representative policy fixtures to exercise the different sections rendered by the viewer without requiring a live cluster.

Related Issue

Fixes #845

Changes

  • Added src/components/CELPolicyViewer.stories.tsx
  • Added Storybook coverage for all supported CEL policy types
  • Added representative fixtures for validations, mutations, generators, audit annotations, and deletion conditions

Steps to Test

npm run format
npm run lint-fix
npm run lint
npm run tsc
npm run test
npm run storybook-build

Notes for the Reviewer

  • Adds Storybook coverage for CELPolicyViewer.
  • Uses static policy fixtures for deterministic rendering.
  • No functional changes.

Signed-off-by: Suhani <suhani4630@gmail.com>
@Suhani95

Copy link
Copy Markdown
Author

@illume could you please take a look when you have a chance? Thanks!

@illume illume requested a review from Copilot June 24, 2026 09:43

@illume illume 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.

Thanks for this PR.

A few of the commits don't quite follow the project guidelines. We use Linux kernel style for git commits — have a look at the contributing guide and previous commits with git log.

Commits that need attention
  • kyverno: add Storybook stories for CELPolicyViewer — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
Commit guidelines
  • Use atomic commits focused on a single change.
  • Use the title format <area>: <Description of changes> — description must start with a capital letter.
  • Keep the title under 72 characters (soft requirement).
  • Explain the intention and why the change is needed.
  • Make commit titles meaningful and describe what changed.
  • Do not add code that a later commit rewrites; squash or reorder commits instead.
  • Do not include Fixes #NN in commit messages.

Good examples:

  • frontend: HomeButton: Fix so it navigates to home
  • backend: config: Add enable-dynamic-clusters flag

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

Adds Storybook stories for the Kyverno CELPolicyViewer component so each CEL policy type can be rendered and reviewed in isolation using static fixtures (no live cluster required).

Changes:

  • Added CELPolicyViewer.stories.tsx with stories for Validating, Mutating, Generating, and Deleting policies.
  • Introduced representative fixture objects to exercise viewer sections (match constraints, variables, validations, mutations, generators, conditions).

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

Comment on lines +39 to +46
const podResourceRules = [
{
apiGroups: [''],
apiVersions: ['v1'],
operations: ['CREATE', 'UPDATE'],
resources: ['pods'],
},
];
Comment on lines +60 to +65
variables: [
{
name: 'containers',
expression: 'object.spec.containers',
},
],
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.

kyverno: add Storybook coverage for CELPolicyViewer

3 participants