Skip to content

Conversation

@moko-poi
Copy link
Contributor

Integrate kube-api-linter into the golangci-lint workflow to enforce Kubernetes API conventions and catch common mistakes in Kubernetes API types.

This PR addresses #675 by:

  • Building golangci-lint with the kube-api-linter plugin using golangci-lint custom
  • Updating CI workflow to use the custom-built linter
  • Adding configuration file for custom plugin management

Changes

1. Custom golangci-lint Configuration

  • Added .custom-gcl.yml: Configuration file specifying kube-api-linter plugin (v0.0.0-20251112164541-d94382a24f06) to be built into golangci-lint

2. Makefile Updates

  • Modified golangci-lint target (Makefile:214-221): Changed from simple go install to custom build process
    • First installs standard golangci-lint v2.4.0
    • Then builds custom binary with plugins using golangci-lint custom -o $(GOLANGCI_LINT) .custom-gcl.yml
    • Ensures kube-api-linter is available in local development

3. CI/CD Integration

  • Modified .github/workflows/golangci-lint.yaml: Replaced golangci/golangci-lint-action with Makefile-based approach
    • Added "Build custom golangci-lint" step to build the linter with plugins
    • Changed "lint" step to use make lint for consistency between local and CI environments

Benefits

  • Standards Compliance: Enforces Kubernetes API Conventions
    automatically
  • Consistency: Same linter configuration used in both local development and CI
  • Maintainability: Centralized plugin configuration in .custom-gcl.yml for easy updates

Testing

  • Local testing: Run make golangci-lint && make lint to verify custom linter builds and runs correctly
  • CI will automatically build and use the custom linter on all PRs and pushes

References

@moko-poi moko-poi requested a review from yorugac as a code owner November 19, 2025 08:04
@moko-poi moko-poi force-pushed the enable_kube_api_linter branch from 089fa91 to 09ddc4e Compare November 19, 2025 10:26
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