Skip to content
Merged
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
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd hyperfleet-adapter
### Install Dependencies

```bash
make tidy
make mod-tidy
```

### Build
Expand Down Expand Up @@ -128,9 +128,9 @@ hyperfleet-adapter/
| `make image-push` | Build and push container image to registry |
| `make image-dev` | Build and push to personal Quay registry (requires QUAY_USER) |
| `make fmt` | Format code |
| `make tidy` | Tidy Go module dependencies |
| `make mod-tidy` | Tidy Go module dependencies |
| `make clean` | Clean build artifacts |
| `make verify` | Run format check and go vet |
| `make verify` | Run lint and test |

💡 **Tip:** Use `make help` to see all available targets with descriptions

Expand Down Expand Up @@ -169,7 +169,7 @@ A HyperFleet Adapter requires several files for configuration:
- **Adapter Task config**: Configures the adapter task steps that will create resources
- **Broker configuration**: Configures the specific broker to use by the adapter framework to receive CloudEvents

To see all configuration options read [configuration.md](configuration.md) file
To see all configuration options read [configuration.md](docs/configuration.md) file

#### Adapter configuration

Expand All @@ -178,14 +178,16 @@ settings for the adapter process, such as client connections, retries, and broke
subscription details. It is loaded with Viper, so values can be overridden by CLI flags
and environment variables in this priority order: CLI flags > env vars > file > defaults.

Fields use **snake_case** naming.

- **Path**: `HYPERFLEET_ADAPTER_CONFIG` (required)
- **Common fields**: `spec.adapter.version`, `spec.debugConfig`, `spec.clients.*`
(HyperFleet API, Maestro, broker, Kubernetes)
- **Common fields**: `adapter.name`, `adapter.version`, `debug_config`, `clients.*`
(HyperFleet API: `clients.hyperfleet_api`, Maestro: `clients.maestro`, broker: `clients.broker`, Kubernetes: `clients.kubernetes`)

Reference examples:

- `configs/adapter-deployment-config.yaml` (full reference with env/flag notes)
- `charts/examples/adapter-config.yaml` (minimal deployment example)
- `charts/examples/kubernetes/adapter-config.yaml` (minimal deployment example)

#### Adapter task configuration

Expand All @@ -194,12 +196,12 @@ processing events: parameters, preconditions, resources to create, and post-acti
This file is loaded as **static YAML** (no Viper overrides) and is required at runtime.

- **Path**: `HYPERFLEET_TASK_CONFIG` (required)
- **Key sections**: `spec.params`, `spec.preconditions`, `spec.resources`, `spec.post`
- **Key sections**: `params`, `preconditions`, `resources`, `post`
- **Resource manifests**: inline YAML or external file via `manifest.ref`

Reference examples:

- `charts/examples/adapter-task-config.yaml` (worked example)
- `charts/examples/kubernetes/adapter-task-config.yaml` (worked example)
- `configs/adapter-task-config-template.yaml` (complete schema reference)

### Broker Configuration
Expand Down
20 changes: 10 additions & 10 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Beware of template resolution within files referenced in an `AdapterTaskConfig`.
| `adapterConfig.configMapName` | AdapterConfig ConfigMap name | `""` |
| `adapterConfig.yaml` | AdapterConfig YAML content | `""` |
| `adapterConfig.files` | AdapterConfig YAML files packaged with chart | `{}` |
| `adapterConfig.hyperfleetApi.baseUrl` | HyperFleet API base URL (HYPERFLEET_API_BASE_URL) | `"http://hyperfleet-api:8000"` |
| `adapterConfig.hyperfleetApi.version` | API version (HYPERFLEET_API_VERSION) | `"v1"` |
| `adapterConfig.hyperfleet_api.base_url` | HyperFleet API base URL (HYPERFLEET_API_BASE_URL) | `"http://hyperfleet-api:8000"` |
| `adapterConfig.hyperfleet_api.version` | API version (HYPERFLEET_API_VERSION) | `"v1"` |
| `adapterConfig.log.level` | Adapter log level | `"info"` |
| `adapterTaskConfig.create` | Enable AdapterTaskConfig ConfigMap | `true` |
| `adapterTaskConfig.configMapName` | AdapterTaskConfig ConfigMap name | `""` |
| `adapterTaskConfig.yaml` | AdapterTaskConfig YAML content | `""` |
| `adapterTaskConfig.files` | AdapterTaskConfig YAML files packaged with chart | `{}` |

AdapterConfig supports `spec.debugConfig` to log the full merged configuration after load
AdapterConfig supports `debug_config` to log the full merged configuration after load
(default: `false`). It can also be set via `HYPERFLEET_DEBUG_CONFIG` or `--debug-config`.

### Broker Configuration
Expand All @@ -91,8 +91,8 @@ The `ConfigMap` will be:
|-----------|-------------|---------|
| `broker.create` | Create broker ConfigMap | `true` |
| `broker.configMapName` | Broker ConfigMap name | `""` |
| `broker.googlepubsub.projectId` | Google Cloud project ID | `""` |
| `broker.googlepubsub.subscriptionId` | Subscription ID override (HYPERFLEET_BROKER_SUBSCRIPTION_ID) | `""` |
| `broker.googlepubsub.project_id` | Google Cloud project ID | `""` |
| `broker.googlepubsub.subscription_id` | Subscription ID override (HYPERFLEET_BROKER_SUBSCRIPTION_ID) | `""` |
| `broker.googlepubsub.topic` | Topic name override (HYPERFLEET_BROKER_TOPIC) | `""` |
| `broker.yaml` | Broker YAML config content | `""` |

Expand Down Expand Up @@ -149,8 +149,8 @@ helm install hyperfleet-adapter ./charts/ \
-f ./charts/examples/values.yaml \
--set image.registry=quay.io/my-quay-registry \
--set broker.create=true \
--set broker.googlepubsub.projectId=my-gcp-project \
--set broker.googlepubsub.subscriptionId=my-subscription \
--set broker.googlepubsub.project_id=my-gcp-project \
--set broker.googlepubsub.subscription_id=my-subscription \
--set broker.googlepubsub.topic=my-topic
```

Expand All @@ -160,10 +160,10 @@ The deployment sets these environment variables automatically:

| Variable | Value | Condition |
|----------|-------|-----------|
| `HYPERFLEET_API_BASE_URL` | From `adapterConfig.hyperfleetApi.baseUrl` | When `adapterConfig.hyperfleetApi.baseUrl` is set |
| `HYPERFLEET_API_VERSION` | From `adapterConfig.hyperfleetApi.version` | Always (default: v1) |
| `HYPERFLEET_API_BASE_URL` | From `adapterConfig.hyperfleet_api.base_url` | When `adapterConfig.hyperfleet_api.base_url` is set |
| `HYPERFLEET_API_VERSION` | From `adapterConfig.hyperfleet_api.version` | Always (default: v1) |
| `BROKER_CONFIG_FILE` | `/etc/broker/broker.yaml` | When `broker.yaml` is set |
| `HYPERFLEET_BROKER_SUBSCRIPTION_ID` | From values | When `broker.googlepubsub.subscriptionId` is set |
| `HYPERFLEET_BROKER_SUBSCRIPTION_ID` | From values | When `broker.googlepubsub.subscription_id` is set |
| `HYPERFLEET_BROKER_TOPIC` | From values | When `broker.googlepubsub.topic` is set |

## GCP Workload Identity Setup
Expand Down
31 changes: 9 additions & 22 deletions charts/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This directory contains example configurations for deploying the HyperFleet Adap
|-----------|-----------|-------------|
| [`kubernetes/`](./kubernetes/) | Kubernetes only | Creates resources directly in the local cluster using the Kubernetes client |
| [`maestro/`](./maestro/) | Maestro only | Deploys resources to a remote cluster via Maestro using ManifestWork |
| [`maestro-kubernetes/`](./maestro-kubernetes/) | Maestro + Kubernetes | Hybrid example combining both transport clients in a single task |

---

Expand All @@ -22,6 +21,7 @@ Creates the following resources directly in the local cluster via the Kubernetes
- An Nginx Deployment in the adapter's own namespace

**Key features demonstrated:**

- Inline manifests and external file references (`ref:`)
- Preconditions with Hyperfleet API calls and CEL expressions
- Resource discovery by name and label selectors
Expand All @@ -42,30 +42,17 @@ Deploys resources to a remote cluster through Maestro (Open Cluster Management)
- Nested resource discovery within the ManifestWork result

**Key features demonstrated:**

- Maestro transport client configuration (gRPC + HTTP)
- ManifestWork template with external file reference (`ref:`)
- Resource discovery by name and by label selectors (`nestedDiscoveries`)
- Resource discovery by name and by label selectors (`nested_discoveries`)
- Post-processing with CEL expressions on nested ManifestWork status
- Status reporting back to the Hyperfleet API

See [`maestro/README.md`](./maestro/README.md) for full details.

---

### `maestro-kubernetes/` — Hybrid Maestro + Kubernetes

Combines both transport clients in a single adapter task:

- A ManifestWork delivered via Maestro to a remote cluster (Namespace + ConfigMap)
- A Namespace created directly in the local cluster via the Kubernetes client

**Key features demonstrated:**
- Using multiple transport clients (`maestro` and `kubernetes`) within the same task
- Per-resource transport selection via the `transport.client` field
- Kubernetes transport as the default fallback when `transport` is omitted

---

## Common Configuration

All examples share the same broker and image placeholders that must be updated before deployment.
Expand All @@ -75,10 +62,10 @@ All examples share the same broker and image placeholders that must be updated b
```yaml
broker:
googlepubsub:
projectId: CHANGE_ME
subscriptionId: CHANGE_ME
project_id: CHANGE_ME
subscription_id: CHANGE_ME
topic: CHANGE_ME
deadLetterTopic: CHANGE_ME
dead_letter_topic: CHANGE_ME
```

### Image
Expand All @@ -97,8 +84,8 @@ image:
helm install <name> ./charts -f charts/examples/<example>/values.yaml \
--namespace <namespace> \
--set image.registry=quay.io/<developer-registry> \
--set broker.googlepubsub.projectId=<gcp-project> \
--set broker.googlepubsub.subscriptionId=<gcp-subscription> \
--set broker.googlepubsub.project_id=<gcp-project> \
--set broker.googlepubsub.subscription_id=<gcp-subscription> \
--set broker.googlepubsub.topic=<gcp-topic> \
--set broker.googlepubsub.deadLetterTopic=<gcp-dlq-topic>
--set broker.googlepubsub.dead_letter_topic=<gcp-dlq-topic>
```
12 changes: 6 additions & 6 deletions charts/examples/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ Update the `broker.googlepubsub` section in `values.yaml` with your GCP Pub/Sub
```yaml
broker:
googlepubsub:
projectId: CHANGE_ME
subscriptionId: CHANGE_ME
project_id: CHANGE_ME
subscription_id: CHANGE_ME
topic: CHANGE_ME
deadLetterTopic: CHANGE_ME
dead_letter_topic: CHANGE_ME
```

### Image Configuration
Expand All @@ -142,10 +142,10 @@ image:
helm install <name> ./charts -f charts/examples/values.yaml \
--namespace <namespace> \
--set image.registry=quay.io/<developer-registry> \
--set broker.googlepubsub.projectId=<gcp-project> \
--set broker.googlepubsub.subscriptionId=<gcp-subscription? \
--set broker.googlepubsub.project_id=<gcp-project> \
--set broker.googlepubsub.subscription_id=<gcp-subscription? \
--set broker.googlepubsub.topic=<gcp-topic> \
--set broker.googlepubsub.deadLetterTopic=<gcp-dlq-topic>
--set broker.googlepubsub.dead_letter_topic=<gcp-dlq-topic>
```

## How It Works
Expand Down
45 changes: 19 additions & 26 deletions charts/examples/kubernetes/adapter-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
# Example HyperFleet Adapter deployment configuration
apiVersion: hyperfleet.redhat.com/v1alpha1
kind: AdapterConfig
metadata:
adapter:
name: kubernetes-example
labels:
hyperfleet.io/adapter-type: kubernetes-example
hyperfleet.io/component: adapter
spec:
adapter:
version: "0.1.0"
version: "0.2.0"

# Log the full merged configuration after load (default: false)
debugConfig: true
log:
level: debug
# Log the full merged configuration after load (default: false)
debug_config: true
log:
level: debug

clients:
hyperfleetApi:
baseUrl: http://hyperfleet-api:8000
version: v1
timeout: 2s
retryAttempts: 3
retryBackoff: exponential
clients:
hyperfleet_api:
base_url: http://hyperfleet-api:8000
version: v1
timeout: 2s
retry_attempts: 3
retry_backoff: exponential

broker:
subscriptionId: "CHANGE_ME"
topic: "CHANGE_ME"
broker:
subscription_id: "CHANGE_ME"
topic: "CHANGE_ME"

kubernetes:
apiVersion: "v1"
#kubeConfigPath: PATH_TO_KUBECONFIG # for local development
kubernetes:
api_version: "v1"
#kube_config_path: PATH_TO_KUBECONFIG # for local development
Loading