-
Notifications
You must be signed in to change notification settings - Fork 82
Add CLAUDE.md for Claude Code integration #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This file provides comprehensive context for AI-assisted development of the Open Cluster Management API library, including API architecture, client usage patterns, and development guidelines for multicluster Kubernetes management. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jhjaggars The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughAdds a new documentation file, CLAUDE.md, describing the OCM API project, its architecture, development workflow, code generation, integration examples, and contributing guidelines. No code changes, APIs, or exports modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (9)
CLAUDE.md (9)
227-233
: Tighten language on API stability; hyphenate compound adjective.Beta is not strictly “stable” in the Kubernetes deprecation policy; breaking changes are possible (though avoided). Also use “backward-compatible.”
- **v1beta1**: Stable APIs, backward compatible changes only + **v1beta1**: Generally stable APIs; breaking changes are rare but possible per Kubernetes API policy (aim for backward-compatible changes).
98-111
: Add missing imports and context in client example.ctrl and metav1 are used but not imported; ctx is undefined.
-import ( - clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned" -) +import ( + "context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + ctrl "sigs.k8s.io/controller-runtime" + clusterv1 "open-cluster-management.io/api/cluster/v1" + clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned" +) @@ -// List managed clusters -clusters, err := client.ClusterV1().ManagedClusters().List(ctx, metav1.ListOptions{}) +// List managed clusters +ctx := context.TODO() +clusters, err := client.ClusterV1().ManagedClusters().List(ctx, metav1.ListOptions{})
136-158
: Placement example: include imports for v1beta1 and metav1.Readers will copy/paste; make the snippet self-contained.
-// Create placement with cluster selection +// Create placement with cluster selection +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" +)
160-188
: ManifestWork example: add imports and show typed client create.Currently relies on undeclared identifiers (workv1, metav1, unstructured). Also demonstrate Create call.
-// Deploy resources to managed clusters +// Deploy resources to managed clusters +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + workv1 "open-cluster-management.io/api/work/v1" +) @@ - }, + }, @@ -} +} + +// Create via typed client +// _, err := client.WorkV1().ManifestWorks("cluster1").Create(ctx, manifestWork, metav1.CreateOptions{}) +// handle err
200-206
: Controller snippet: import missing packages (ctrl, handler, workv1).Without these, the example won’t compile.
-import ( - clusterv1 "open-cluster-management.io/api/cluster/v1" - "sigs.k8s.io/controller-runtime/pkg/controller" -) +import ( + clusterv1 "open-cluster-management.io/api/cluster/v1" + workv1 "open-cluster-management.io/api/work/v1" + "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/handler" +) @@ -func (r *MyReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *MyReconciler) SetupWithManager(mgr controller_runtime.Manager) error { - return ctrl.NewControllerManagedBy(mgr). + return controller_runtime.NewControllerManagedBy(mgr).
210-223
: Informer example: add imports (time, cache) and start factory.Small tweaks make it runnable.
-import ( - clusterinformers "open-cluster-management.io/api/client/cluster/informers/externalversions" -) +import ( + "time" + "k8s.io/client-go/tools/cache" + clusterinformers "open-cluster-management.io/api/client/cluster/informers/externalversions" +) @@ informerFactory := clusterinformers.NewSharedInformerFactory(client, time.Minute*30) clusterInformer := informerFactory.Cluster().V1().ManagedClusters() clusterInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: handleClusterAdd, UpdateFunc: handleClusterUpdate, DeleteFunc: handleClusterDelete, }) + +// Start informers (usually in a goroutine) +// informerFactory.Start(ctx.Done())
321-339
: Add language to fenced block (markdownlint MD040).Label the project tree block as text.
-``` +```text ...--- `24-55`: **Consider noting other commonly-used OCM API groups (if in-scope).** If policy APIs live in a different repo, explicitly say so to avoid confusion. ```diff ### Four Core API Groups +Note: Governance/Policy APIs are maintained in separate repositories; this document focuses on API groups defined in this repo.
5-12
: Minor style nits for consistency.Lowercase common nouns and tighten phrasing.
-**Framework**: Kubernetes API Machinery / controller-runtime -**Primary Purpose**: API definitions and client libraries for OCM ecosystem +**Framework**: Kubernetes API machinery / controller-runtime +**Primary purpose**: API definitions and client libraries for the OCM ecosystem
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
CLAUDE.md
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
CLAUDE.md
[grammar] ~7-~7: There might be a mistake here.
Context: ...Type**: Go API Library / Kubernetes CRDs
Language: Go
Framework: Kuberne...
(QB_NEW_EN)
[grammar] ~8-~8: There might be a mistake here.
Context: ...ry / Kubernetes CRDs
Language: Go
Framework: Kubernetes API Machinery / ...
(QB_NEW_EN)
[grammar] ~9-~9: There might be a mistake here.
Context: ...netes API Machinery / controller-runtime
Primary Purpose: API definitions and c...
(QB_NEW_EN)
[grammar] ~10-~10: There might be a mistake here.
Context: ...s and client libraries for OCM ecosystem
Target Users: Platform engineers, mult...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...*: Go 1.23+ with modern module structure
- Kubernetes Integration: API Machinery ...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...ion**: API Machinery for CRD definitions
- Code Generation: Kubernetes code gener...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...code generators for clients and deepcopy
- API Versioning: Multiple API versions ...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...ple API versions (v1, v1beta1, v1alpha1)
- Client Libraries: Kubernetes-style typ...
(QB_NEW_EN)
[grammar] ~19-~19: There might be a mistake here.
Context: ...ies**: Kubernetes-style typed clientsets
- Validation: OpenAPI schema generation ...
(QB_NEW_EN)
[grammar] ~26-~26: There might be a mistake here.
Context: ...t (cluster.open-cluster-management.io
)
- v1: Core cluster registration and grou...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...: Core cluster registration and grouping
ManagedCluster
: Represents a cluster joined to the hub...
(QB_NEW_EN)
[grammar] ~28-~28: There might be a mistake here.
Context: ...: Represents a cluster joined to the hub
ManagedClusterSet
: Logical grouping of clusters- `Man...
(QB_NEW_EN)
[grammar] ~29-~29: There might be a mistake here.
Context: ...lusterSet`: Logical grouping of clusters
ManagedClusterSetBinding
: Namespace-level cluster set access- ...
(QB_NEW_EN)
[grammar] ~30-~30: There might be a mistake here.
Context: ...ing`: Namespace-level cluster set access
- v1beta1: Advanced cluster selection an...
(QB_NEW_EN)
[grammar] ~31-~31: There might be a mistake here.
Context: ...Advanced cluster selection and placement
Placement
: Intelligent cluster selection with con...
(QB_NEW_EN)
[grammar] ~32-~32: There might be a mistake here.
Context: ...igent cluster selection with constraints
PlacementDecision
: Results of placement decisions- **v1...
(QB_NEW_EN)
[grammar] ~33-~33: There might be a mistake here.
Context: ...ecision`: Results of placement decisions
- v1alpha1: Extended cluster capabilitie...
(QB_NEW_EN)
[grammar] ~34-~34: There might be a mistake here.
Context: ...1alpha1**: Extended cluster capabilities
ClusterClaim
: Cluster-specific capability declaratio...
(QB_NEW_EN)
[grammar] ~35-~35: There might be a mistake here.
Context: ...Cluster-specific capability declarations
AddonPlacementScore
: Scoring for placement decisions
###...
(QB_NEW_EN)
[grammar] ~38-~38: There might be a mistake here.
Context: ...tion (work.open-cluster-management.io
)
- v1: Resource deployment across cluster...
(QB_NEW_EN)
[grammar] ~39-~39: There might be a mistake here.
Context: ...1**: Resource deployment across clusters
ManifestWork
: Kubernetes resources to deploy on mana...
(QB_NEW_EN)
[grammar] ~40-~40: There might be a mistake here.
Context: ... resources to deploy on managed clusters
AppliedManifestWork
: Status of deployed resources- **v1al...
(QB_NEW_EN)
[grammar] ~41-~41: There might be a mistake here.
Context: ...ifestWork`: Status of deployed resources
- v1alpha1: Bulk deployment capabilities...
(QB_NEW_EN)
[grammar] ~42-~42: There might be a mistake here.
Context: ...v1alpha1**: Bulk deployment capabilities
ManifestWorkReplicaSet
: Deploy to multiple clusters in a set
...
(QB_NEW_EN)
[grammar] ~45-~45: There might be a mistake here.
Context: ...ent (addon.open-cluster-management.io
)
- v1alpha1: Addon lifecycle and configur...
(QB_NEW_EN)
[grammar] ~46-~46: There might be a mistake here.
Context: ...ha1**: Addon lifecycle and configuration
ClusterManagementAddOn
: Hub-side addon definition- `Manage...
(QB_NEW_EN)
[grammar] ~47-~47: There might be a mistake here.
Context: ...agementAddOn`: Hub-side addon definition
ManagedClusterAddOn
: Cluster-specific addon instance- `...
(QB_NEW_EN)
[grammar] ~48-~48: There might be a mistake here.
Context: ...rAddOn`: Cluster-specific addon instance
AddonDeploymentConfig
: Addon configuration templates
...
(QB_NEW_EN)
[grammar] ~51-~51: There might be a mistake here.
Context: ... (operator.open-cluster-management.io
)
- v1: OCM component installation
- `C...
(QB_NEW_EN)
[grammar] ~52-~52: There might be a mistake here.
Context: ...`)
- v1: OCM component installation
ClusterManager
: Hub cluster OCM installation- `Klu...
(QB_NEW_EN)
[grammar] ~53-~53: There might be a mistake here.
Context: ...erManager`: Hub cluster OCM installation
Klusterlet
: Managed cluster agent installation
...
(QB_NEW_EN)
[grammar] ~70-~70: There might be a mistake here.
Context: ...ke test
### Generated Components
- **DeepCopy Methods**: For all API struct t...
(QB_NEW_EN)
---
[grammar] ~71-~71: There might be a mistake here.
Context: ...Copy Methods**: For all API struct types
- **Typed Clients**: Kubernetes-style client...
(QB_NEW_EN)
---
[grammar] ~72-~72: There might be a mistake here.
Context: ...etes-style clientsets for each API group
- **Informers/Listers**: Efficient caching a...
(QB_NEW_EN)
---
[grammar] ~73-~73: There might be a mistake here.
Context: ...fficient caching and watching mechanisms
- **OpenAPI Schemas**: CRD validation and do...
(QB_NEW_EN)
---
[grammar] ~128-~128: There might be a mistake here.
Context: ...pment Tasks
#### Adding New API Types
1. **Define Structure**: Create Go structs wi...
(QB_NEW_EN)
---
[grammar] ~227-~227: There might be a mistake here.
Context: ...## Best Practices
#### API Versioning
- **v1alpha1**: Experimental APIs, may have ...
(QB_NEW_EN)
---
[grammar] ~228-~228: There might be a mistake here.
Context: ...rimental APIs, may have breaking changes
- **v1beta1**: Stable APIs, backward compati...
(QB_NEW_EN)
---
[uncategorized] ~229-~229: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ng changes
- **v1beta1**: Stable APIs, backward compatible changes only
- **v1**: Stable APIs, no...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
---
[grammar] ~229-~229: There might be a mistake here.
Context: ...e APIs, backward compatible changes only
- **v1**: Stable APIs, no breaking changes a...
(QB_NEW_EN)
---
[grammar] ~230-~230: There might be a mistake here.
Context: ...Stable APIs, no breaking changes allowed
- Use feature gates for experimental funct...
(QB_NEW_EN)
---
[grammar] ~233-~233: There might be a mistake here.
Context: ...al functionality
#### Resource Naming
- Follow Kubernetes naming conventions
- ...
(QB_NEW_EN)
</details>
</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>
<details>
<summary>CLAUDE.md</summary>
321-321: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
- **Language**: Go 1.23+ with modern module structure | ||
- **Kubernetes Integration**: API Machinery for CRD definitions | ||
- **Code Generation**: Kubernetes code generators for clients and deepcopy | ||
- **API Versioning**: Multiple API versions (v1, v1beta1, v1alpha1) | ||
- **Client Libraries**: Kubernetes-style typed clientsets | ||
- **Validation**: OpenAPI schema generation for CRD validation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Align Go version with repo toolchain (go.mod/CI).
Doc says “Go 1.23+”. Please confirm this matches go.mod and CI images to avoid confusing contributors.
Run to verify and surface mismatches:
🏁 Script executed:
#!/bin/bash
# go.mod version(s)
fd -a go.mod | xargs -I{} sh -c 'echo "== {} =="; rg -n "^go\s+\d+\.\d+" {}'
# GitHub Actions: setup-go versions
fd -a .github -t f -e yml -e yaml | xargs -I{} sh -c 'echo "== {} =="; rg -n "setup-go|go-version" {} -n -C2'
# Makefile toolchain pins (if any)
fd -a Makefile | xargs -I{} sh -c 'echo "== {} =="; rg -n "GO_VERSION|golang:" {}'
Length of output: 359
Update Go version in CLAUDE.md to match go.mod
Doc lists “Go 1.23+” but go.mod specifies go 1.24.0; change the requirement to “Go 1.24+” and verify any CI workflows also use Go 1.24.
🧰 Tools
🪛 LanguageTool
[grammar] ~15-~15: There might be a mistake here.
Context: ...*: Go 1.23+ with modern module structure
- Kubernetes Integration: API Machinery ...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...ion**: API Machinery for CRD definitions
- Code Generation: Kubernetes code gener...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...code generators for clients and deepcopy
- API Versioning: Multiple API versions ...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...ple API versions (v1, v1beta1, v1alpha1)
- Client Libraries: Kubernetes-style typ...
(QB_NEW_EN)
[grammar] ~19-~19: There might be a mistake here.
Context: ...ies**: Kubernetes-style typed clientsets
- Validation: OpenAPI schema generation ...
(QB_NEW_EN)
🤖 Prompt for AI Agents
In CLAUDE.md around lines 15 to 21, the doc currently states "Go 1.23+" but
go.mod specifies go 1.24.0; update the Go requirement text to "Go 1.24+" (or "Go
1.24+ with modern module structure") to match go.mod, and also search and update
any other documentation or CI workflow files (e.g., GitHub Actions, Makefiles,
Dockerfiles) to ensure they reference and use Go 1.24.
// Use kubebuilder tags for validation | ||
type ManagedClusterSpec struct { | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:default=true | ||
HubAcceptsClient bool `json:"hubAcceptsClient"` | ||
|
||
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` | ||
LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect kubebuilder tag for integer field; use numeric validators, not Pattern.
Pattern applies to strings; LeaseDurationSeconds is an int. Provide min/max as needed.
type ManagedClusterSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:default=true
HubAcceptsClient bool `json:"hubAcceptsClient"`
-
- // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
- LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"`
+
+ // +kubebuilder:validation:Minimum=1
+ // +kubebuilder:validation:Maximum=3600
+ LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"`
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// Use kubebuilder tags for validation | |
type ManagedClusterSpec struct { | |
// +kubebuilder:validation:Required | |
// +kubebuilder:default=true | |
HubAcceptsClient bool `json:"hubAcceptsClient"` | |
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` | |
LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"` | |
} | |
// Use kubebuilder tags for validation | |
type ManagedClusterSpec struct { | |
// +kubebuilder:validation:Required | |
// +kubebuilder:default=true | |
HubAcceptsClient bool `json:"hubAcceptsClient"` | |
// +kubebuilder:validation:Minimum=1 | |
// +kubebuilder:validation:Maximum=3600 | |
LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"` | |
} |
🤖 Prompt for AI Agents
In CLAUDE.md around lines 260 to 268, the kubebuilder tag on
LeaseDurationSeconds incorrectly uses Pattern (a string validator) for an int32
field; replace the Pattern tag with numeric validators such as
+kubebuilder:validation:Minimum=<min> and/or
+kubebuilder:validation:Maximum=<max> (or
+kubebuilder:validation:ExclusiveMinimum/ExclusiveMaximum if needed), remove the
Pattern line, and keep the field as LeaseDurationSeconds *int32
`json:"leaseDurationSeconds,omitempty"` so the CRD uses proper integer
validation.
## Useful Commands | ||
|
||
```bash | ||
# Code Generation | ||
make update # Generate all code (clients, deepcopy, etc.) | ||
make verify # Verify generated code is up to date | ||
make clean # Clean generated code | ||
|
||
# Testing | ||
make test # Run unit tests | ||
make test-integration # Run integration tests | ||
make verify-crds # Verify CRD manifests | ||
|
||
# Development | ||
make fmt # Format Go code | ||
make vet # Run go vet | ||
make lint # Run linters | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Validate make targets to prevent dead commands.
Please confirm test-integration/verify-crds exist in this repo; if not, either add them or adjust the doc.
🏁 Script executed:
#!/bin/bash
fd -a Makefile | xargs -I{} sh -c 'echo "== {} =="; rg -n "test-integration|verify-crds|fmt|vet|lint|update|verify|clean" {} -n'
Length of output: 1004
Ensure referenced make targets exist or update documentation
In CLAUDE.md (lines 271–288), remove or update references to non-existent make test-integration
and make verify-crds
targets, or add those targets to the Makefile.
🤖 Prompt for AI Agents
In CLAUDE.md around lines 271–288, the documentation references two Make targets
(make test-integration and make verify-crds) that do not exist; either remove or
update those entries to match actual Makefile targets, or add corresponding
targets to the repo Makefile. If you choose to update the doc, replace or remove
the two lines and ensure the remaining commands reflect real targets; if you
choose to add targets, create make test-integration and make verify-crds with
sensible commands (integration test runner and CRD verification steps) and
update the Makefile index so the doc is accurate.
### External Project Integration | ||
```go | ||
// go.mod | ||
module my-ocm-controller | ||
|
||
require ( | ||
open-cluster-management.io/api v0.13.0 | ||
sigs.k8s.io/controller-runtime v0.16.0 | ||
) | ||
|
||
// main.go | ||
import ( | ||
clusterv1 "open-cluster-management.io/api/cluster/v1" | ||
clusterscheme "open-cluster-management.io/api/client/cluster/clientset/versioned/scheme" | ||
) | ||
|
||
// Add OCM APIs to your scheme | ||
scheme := runtime.NewScheme() | ||
clusterscheme.AddToScheme(scheme) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Version pins in go.mod example may drift; align with current tags.
Ensure the versions reflect the latest compatible releases used by this repo’s consumers.
🏁 Script executed:
#!/bin/bash
# Show the latest tags
gh repo view open-cluster-management-io/api --json releases -q '.releases[0:5][] | {name: .name, tag: .tagName, publishedAt: .publishedAt}'
# If gh is unavailable, list module versions from proxy:
curl -s https://proxy.golang.org/open-cluster-management.io/api/@v/list | tail -n 10
Length of output: 1444
🏁 Script executed:
#!/bin/bash
# List the latest versions of controller-runtime from Go proxy
curl -s https://proxy.golang.org/sigs.k8s.io/controller-runtime/@v/list | tail -n 5
Length of output: 130
🏁 Script executed:
#!/bin/bash
# Determine latest semver tag for open-cluster-management.io/api
echo "OCM API latest version:"
curl -s https://proxy.golang.org/open-cluster-management.io/api/@v/list | sort -V | tail -n 1
# Determine latest semver tag for sigs.k8s.io/controller-runtime
echo "Controller-runtime latest version:"
curl -s https://proxy.golang.org/sigs.k8s.io/controller-runtime/@v/list | sort -V | tail -n 1
Length of output: 342
Update go.mod example to latest module versions
In the CLAUDE.md snippet (lines 292–311), replace
require (
open-cluster-management.io/api v0.13.0
sigs.k8s.io/controller-runtime v0.16.0
)
with
require (
open-cluster-management.io/api v1.0.0
sigs.k8s.io/controller-runtime v0.22.0
)
to align the example with the current latest releases.
🤖 Prompt for AI Agents
In CLAUDE.md around lines 292 to 311, the go.mod example pins outdated module
versions; update the require block to use the current releases by replacing
open-cluster-management.io/api v0.13.0 with open-cluster-management.io/api
v1.0.0 and sigs.k8s.io/controller-runtime v0.16.0 with
sigs.k8s.io/controller-runtime v0.22.0 so the documentation shows the latest
compatible module versions.
### CRD Installation | ||
```bash | ||
# Install CRDs from this repository | ||
kubectl apply -f https://raw.githubusercontent.com/open-cluster-management-io/api/main/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid applying CRDs from ‘main’; pin to a release tag or commit SHA.
Prevents breaking changes from landing on users unexpectedly.
- kubectl apply -f https://raw.githubusercontent.com/open-cluster-management-io/api/main/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml
+ # Replace vX.Y.Z with a tested release tag
+ kubectl apply -f https://raw.githubusercontent.com/open-cluster-management-io/api/vX.Y.Z/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml
🤖 Prompt for AI Agents
In CLAUDE.md around lines 313 to 317, the CRD installation snippet points to the
repository's main branch which risks unexpected breakages; update the example to
reference a specific release tag or commit SHA (e.g., vX.Y.Z or a specific SHA)
instead of "main", and mention how to find the correct tag/SHA (releases page or
git log) so the kubectl apply URL is deterministic and reproducible.
Thanks for adding this, it will need a PR type as template shows. Also I wonder if it could be general enough for other AI tools. It also worth to mention that API should follow the https://github.com/open-cluster-management-io/api/blob/main/docs/api-conventions.md |
Summary
• Add CLAUDE.md file to enable Claude Code integration
• Provides comprehensive context for AI-assisted development
• Includes OCM API architecture, client patterns, and usage examples
• Covers multicluster Kubernetes management API definitions
Benefits
• Enables more effective AI-assisted development and code review
• Documents OCM API groups and their relationships
• Provides quick reference for client library usage
• Improves onboarding for OCM ecosystem contributors
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit