Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# See https://docs.coderabbit.ai/reference/configuration for all fields and default values
knowledge_base:
code_guidelines:
filePatterns:
- "docs/*-guidelines.md"
- "AGENTS.md"
89 changes: 89 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# discovery — Agent Instructions

This repository contains the controller for discovering and importing clusters into RHACM.

## What this controller does

The discovery controller automates cluster discovery and import by:

- Discovering OpenShift and Kubernetes clusters in cloud providers (AWS, Azure, GCP)
- Using cloud provider APIs to enumerate clusters
- Creating DiscoveredCluster resources for found clusters
- Facilitating cluster import into RHACM
- Managing discovery credentials and configurations

## Repository layout

- `api/` - CRD definitions for DiscoveryConfig and DiscoveredCluster
- `controllers/` - Reconciliation logic for discovery and import
- `pkg/` - Cloud provider clients (AWS, Azure, GCP, OCM)
- `test/` - Unit and integration tests
- `config/` - Deployment manifests and samples

## Development workflow

### Building locally

```bash
make build # Build controller binary
make docker-build # Build controller image
```

### Running locally

```bash
# Run controller outside cluster (for development)
make run

# Deploy controller to cluster
make deploy
```

### Testing

```bash
make test # Run unit tests
make test-e2e # Run end-to-end tests
```

## Dependencies

- **OpenShift 4.x / Kubernetes 1.19+** - Target platform
- **Cloud provider SDKs** - AWS SDK, Azure SDK, GCP SDK
- **OCM APIs** - Open Cluster Management
- **Cloud credentials** - AWS access keys, Azure service principals, GCP service accounts

## Documentation

- [Discovery API Reference](https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/)
- [Supported Cloud Providers](docs/)
- [Discovery Configuration Guide](config/samples/)

## Common tasks

### Create a discovery configuration

```bash
# Create a DiscoveryConfig for AWS
oc apply -f config/samples/discovery_v1_discoveryconfig_aws.yaml

# Watch discovered clusters
oc get discoveredclusters -A
```

### Test discovery locally

```bash
# Set cloud credentials
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...

# Run controller
make run
```

### Debug controller logs

```bash
oc logs -n multicluster-engine deployment/discovery-operator -f
```
54 changes: 54 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CLAUDE.md

@AGENTS.md

## Build commands

```bash
make build # Build controller binary
make docker-build # Build controller image
make bundle # Generate operator bundle
```

## Test commands

```bash
make test # Run unit tests
make test-e2e # Run end-to-end tests
make lint # Run linters
```

## Local development

### Run controller locally

```bash
# Install CRDs
make install

# Run controller outside cluster
make run
```

### Deploy to cluster

```bash
# Deploy controller
make deploy

# Create discovery config
oc apply -f config/samples/discovery_v1_discoveryconfig_aws.yaml
```

### Test discovery with credentials

```bash
# Create secret with cloud credentials
oc create secret generic aws-creds \
--from-literal=aws_access_key_id=$AWS_ACCESS_KEY_ID \
--from-literal=aws_secret_access_key=$AWS_SECRET_ACCESS_KEY \
-n open-cluster-management

# Watch discovered clusters
watch oc get discoveredclusters -A
```
Loading