Skip to content

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

HyperFleet Scripts

CLI utilities for managing HyperFleet clusters, node pools, databases, and Kubernetes resources.

Quick Start

hf.config.sh bootstrap my-env # Interactive setup: context, API, port-forwards, DB
hf.config.sh doctor # Check which scripts are ready to use

Script Groups

PrefixWhat it manages
hf.cluster.*Cluster API objects — create, inspect, patch, watch conditions and statuses
hf.nodepool.*NodePool API objects — create, inspect, patch, watch conditions and statuses
hf.db.*Direct database access — queries, status records, cleanup
hf.kube.*Kubernetes helpers — context, port-forward, in-cluster curl, debug pods
hf.logs.*Log tailing — pods and adapter-filtered logs
hf.maestro.*Maestro resource management via maestro-cli
hf.pubsub.*GCP Pub/Sub — list topics/subscriptions, publish change events
hf.rabbitmq.*RabbitMQ — publish change events via HTTP management API
hf.repos.*GitHub repository status overview
hf.config.*Configuration management — environments, bootstrap, doctor

Config System

All scripts use a file-based configuration system with environment variable overrides:

  • Config location: ~/.config/hf/ (one file per setting)
  • Precedence: Environment variables > config files > defaults
  • Shared state: Settings persist across script invocations
  • Property registry: All config keys are declared once in HF_CONFIG_REGISTRY in hf.lib.sh
  • Dependency tracking: Each script declares its required config via hf_require_config

Managed via hf.config.sh

hf.config.sh # Show help, environments, and active config
hf.config.sh show # Show current configuration
hf.config.sh show my-env # Show config with environment overrides highlighted
hf.config.sh set api-url <url># Set API URL
hf.config.sh clear token # Clear auth token
hf.config.sh clear all # Reset everything
hf.config.sh doctor # Check per-script readiness
hf.config.sh bootstrap [env] # Interactive environment setup
hf.config.sh env list # List environments
hf.config.sh env activate <name># Activate an environment

Settings are grouped into sections in the registry:

hyperfleet: api-url, api-version, token, context, namespace, gcp-project, cluster-id, cluster-name, nodepool-id

maestro: maestro-consumer, maestro-http-endpoint, maestro-grpc-endpoint, maestro-namespace

portforward: pf-api-port, pf-pg-port, pf-maestro-http-port, pf-maestro-http-remote-port, pf-maestro-grpc-port

database: db-host, db-port, db-name, db-user, db-password

Adding a new config property

  1. Add one line to HF_CONFIG_REGISTRY in hf.lib.sh
  2. Add a HF_*_FILE variable and _hf_load call in the same file
  3. Add a setter function if scripts need to set it programmatically
  4. Scripts that need it add the key to their hf_require_config call

No other files need to change -- hf.config.sh, environments, and doctor all derive from the registry.

Scripts Overview

Cluster Management

ScriptDescription
hf.cluster.create.shCreate a new cluster via API
hf.cluster.delete.shDelete cluster by ID
hf.cluster.get.shGet cluster details by ID
hf.cluster.search.shSearch clusters by name and set as current
hf.cluster.list.shList all clusters
hf.cluster.table.shDisplay clusters in table format
hf.cluster.id.shShow current cluster ID
hf.cluster.patch.shIncrement counter field in cluster spec or labels
hf.cluster.conditions.shShow cluster conditions (-w for watch)
hf.cluster.conditions.table.shShow cluster conditions in table format
hf.cluster.statuses.shShow cluster adapter statuses (-w for watch)
hf.cluster.statuses.table.shDisplay cluster adapter statuses in table format (Available and Finalized)
hf.cluster.adapter.post.status.shPost adapter status for current cluster

NodePool Management

ScriptDescription
hf.nodepool.create.shCreate one or more node pools under the current cluster (name [count] [instance-type])
hf.nodepool.delete.shDelete a node pool
hf.nodepool.get.shGet node pool details
hf.nodepool.list.shList node pools for the current cluster
hf.nodepool.search.shSearch for nodepool by name and set as current
hf.nodepool.table.shDisplay node pools in table format
hf.nodepool.patch.shIncrement counter field in nodepool spec or labels
hf.nodepool.conditions.shShow node pool conditions (-w for watch)
hf.nodepool.conditions.table.shShow node pool conditions in table format
hf.nodepool.statuses.shShow node pool adapter statuses (-w for watch)
hf.nodepool.statuses.table.shDisplay node pool adapter statuses in table format (Available and Finalized)
hf.nodepool.adapter.post.status.shPost adapter status for current node pool

Database Operations

ScriptDescription
hf.db.config.shInteractive database configuration
hf.db.query.shExecute SQL queries or files
hf.db.delete.shDelete database records
hf.db.statuses.shQuery cluster status table
hf.db.delete.all.shDelete all records from adapter_statuses, node_pools, and clusters tables
hf.db.statuses.delete.shDelete status records

Kubernetes Helpers

ScriptDescription
hf.kube.context.shSelect and save kubectl context/namespace
hf.kube.curl.shRun curl from inside a cluster pod (see below)
hf.kube.debug.pod.shCreate debug pod cloned from a deployment (see below)
hf.kube.port.forward.shPort forward to services/pods

hf.kube.curl.sh

Runs curl from inside a pod in the current Kubernetes cluster, useful for reaching cluster-internal services. The pod (hf-kcurl) is reused across invocations and auto-terminates after 5 minutes via sleep 300, so the first call pays the pod startup cost but subsequent calls are fast. Only curl output is written to stdout, making the script safe to use in pipelines and other scripts.

# Simple GET
hf.kube.curl.sh http://my-service.ns.svc:8080/health
# POST with inline data
hf.kube.curl.sh -X POST -H "Content-Type: application/json" -d '{"key":"val"}' http://my-service.ns.svc:8080/api
# POST with file body
hf.kube.curl.sh -X POST -H "Content-Type: application/json" -f payload.json http://my-service.ns.svc:8080/api
# Save response to file
hf.kube.curl.sh -o response.json http://my-service.ns.svc:8080/api
# Use in a pipeline
hf.kube.curl.sh http://my-service.ns.svc:8080/api | jq '.items[]'

hf.kube.debug.pod.sh

Creates a debug pod by cloning the pod template from an existing deployment. The debug pod runs with the same image, environment variables, volumes, and service account as the original deployment, but replaces the entrypoint with sleep infinity and removes all health probes. This lets you exec into a shell with the exact same runtime context as the target workload — useful for debugging configuration, network connectivity, or permissions issues.

The deployment is matched by partial name, so you don't need to type the full name.

# Clone a deployment's pod template into a debug pod and exec into it
hf.kube.debug.pod.sh my-app
# Specify a namespace
hf.kube.debug.pod.sh my-app staging
# Clean up when done
kubectl delete pod my-app-debug-<timestamp> -n default

Logs

ScriptDescription
hf.logs.shTail pod logs with context
hf.logs.adapter.shTail adapter pod logs filtered by cluster ID

Maestro

Maestro scripts require maestro-cli to be compiled and available on your PATH from openshift-hyperfleet/maestro-cli.

ScriptDescription
hf.maestro.list.shList maestro resources
hf.maestro.get.shGet a maestro resource by name (auto-selects if one match; interactive menu if multiple)
hf.maestro.delete.shDelete a maestro resource by name (interactive selection if no name given)
hf.maestro.bundles.shList maestro resource bundles
hf.maestro.consumers.shList maestro consumers
hf.maestro.tui.shLaunch maestro-cli TUI

Pub/Sub and Messaging

ScriptDescription
hf.pubsub.list.shList Pub/Sub topics and subscriptions, with optional filter
hf.pubsub.publish.cluster.change.shPublish cluster change event to a Pub/Sub topic
hf.pubsub.publish.nodepool.change.shPublish nodepool change event to a Pub/Sub topic
hf.rabbitmq.publish.cluster.change.shPublish cluster change event to a RabbitMQ exchange via HTTP management API

Other Utilities

ScriptDescription
hf.table.shCombined table of all clusters with their nodepools, showing ready status and adapter counts
hf.workflow.shEnd-to-end test workflow: create cluster+nodepool, cycle adapter statuses and patches through multiple generations, then delete
hf.workflow.api-only.shAPI-only workflow: create cluster+nodepool, post adapter statuses, and clean up without real adapters
hf.repos.shShow status table for all HyperFleet GitHub repositories
hf.lib.shShared library (config registry, API helpers, logging, Kubernetes wrappers)

Common Patterns

Bootstrap a new environment:

hf.config.sh bootstrap dev

Check what's ready:

hf.config.sh doctor

Search and set current cluster:

hf.cluster.search.sh my-cluster-name

Query cluster details (uses saved cluster-id):

hf.cluster.get.sh

Create and manage node pools:

hf.nodepool.create.sh my-pool 3 m5.2xlarge
hf.nodepool.list.sh
hf.nodepool.table.sh
hf.nodepool.conditions.sh -w

Post adapter status manually:

hf.cluster.adapter.post.status.sh validator True 1
hf.nodepool.adapter.post.status.sh provisioner True 1

Switch environments:

hf.config.sh env list
hf.config.sh env activate staging

Configure kubectl context:

hf.kube.context.sh select

Run database query:

hf.db.query.sh "SELECT * FROM clusters LIMIT 10"
hf.db.query.sh -f schema.sql

Architecture

  • hf.lib.sh: Core library providing config registry, config loading, API helpers, logging, and Kubernetes wrappers
  • Config registry: HF_CONFIG_REGISTRY in hf.lib.sh is the single source of truth for all config properties (section, key, default, sensitivity)
  • Dependency declarations: Each script declares hf_require_config <keys> -- used at runtime for validation and by doctor for readiness scanning
  • File-based state: Each config value stored separately in ~/.config/hf/ for easy inspection and editing
  • Environment profiles: Named environments stored as <env>.<property> files in the config directory
  • Environment override: Set HF_API_URL, HF_TOKEN, etc. to override file config
  • Consistent interface: All scripts source hf.lib.sh for unified behavior and error handling

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages