Skip to content

Conversation

janisz
Copy link
Collaborator

@janisz janisz commented Oct 8, 2025

This PR introduces a new kubeconform template that validates k8s resources against their schemas using the kubeconform library.

Fixes:

🤖 Generated with Claude Code

This commit introduces a new kubeconform template that validates
Kubernetes resources against their schemas using the kubeconform library.

Features:
- Validates Kubernetes resources against official schemas
- Supports custom schema locations and Kubernetes versions
- Configurable strict mode for catching extra properties
- Can ignore missing schemas for CRDs
- Skip/reject specific resource kinds
- Schema caching support

Changes:
- Added kubeconform template with comprehensive parameter support
- Fixed godoc comments following Go conventions
- Added unit tests for template functionality
- Added e2e tests with sample valid and invalid resources
- Integrated template into kube-linter's template registry
- Updated documentation with template parameters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@janisz janisz requested a review from rhybrillou as a code owner October 8, 2025 12:19
janisz added a commit that referenced this pull request Oct 8, 2025
  This PR adds a fallback when decoding unknown resources to be able to handle
  CRDs. The schema validation could be then performed with kubeconform check
  from #1033 and CEL from
  #1012. This should fix
  #606

  Changes:
  - Modified parseObjects to use unstructured decoder as fallback for unknown resource types
  - Added comprehensive test suite covering standard K8s resources and CRDs
  - Maintained backward compatibility for existing decode error handling
  - Added test cases for Tekton Task CRD and other custom resources

  The fallback allows kube-linter to parse CRDs like Tekton Pipelines without
  failing, while delegating proper schema validation to specialized templates
  like kubeconform and CEL expressions.

  🤖 Generated with [Claude Code](https://claude.ai/code)

  Co-Authored-By: Claude <noreply@anthropic.com>

Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
janisz added a commit that referenced this pull request Oct 9, 2025
  This PR adds a fallback when decoding unknown resources to be able to handle
  CRDs. The schema validation could be then performed with kubeconform check
  from #1033 and CEL from
  #1012. This should fix
  #606

  Changes:
  - Modified parseObjects to use unstructured decoder as fallback for unknown resource types
  - Added comprehensive test suite covering standard K8s resources and CRDs
  - Maintained backward compatibility for existing decode error handling
  - Added test cases for Tekton Task CRD and other custom resources

  The fallback allows kube-linter to parse CRDs like Tekton Pipelines without
  failing, while delegating proper schema validation to specialized templates
  like kubeconform and CEL expressions.

  🤖 Generated with [Claude Code](https://claude.ai/code)

  Co-Authored-By: Claude <noreply@anthropic.com>

Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@janisz
Copy link
Collaborator Author

janisz commented Oct 9, 2025

This change is part of the following stack:

Change managed by git-spice.

@janisz janisz requested a review from rukletsov October 9, 2025 14:28
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.

1 participant