Skip to content
Docs

'hyve template'

The hyve template command group manages reusable cluster templates that define a driver (module), region, default params, and lifecycle workflows. Creating a cluster from a template (via hyve cluster create --template <name>) generates a cluster definition YAML and provisions the cluster.

Overview

Templates capture the shape of a cluster. They reference a module (driver), specify a region, set default params, and optionally attach lifecycle workflows. Reference a template by name with hyve cluster create to stamp out a new cluster with all those settings applied.

Commands

hyve template create

Create a new cluster template.

Terminal window
hyve template create <template-name> [flags]
template-name string required

Name of the template to create

--driver string required

Module source string (e.g. github.com/your-org/hyve-civo-module, ./my-local-module)

--driver-version string required

Module version. Must be locked in hyve.lock (e.g. v1.0.0, local)

--region string

Default region for clusters created from this template (e.g. PHX1, us-east-1)

--set string (repeatable)

Set a default param value in KEY=VALUE format. Can be specified multiple times.

Terminal window
--set node_size=g4s.kube.medium --set node_count=3
--description string

Human-readable description for the template

--mgmt-cluster string

The cluster the driver module uses as its management cluster (e.g. a Cluster API management cluster) — sets spec.mgmtCluster, overriding any default the module declares.

--before-create / --on-create / --on-delete / --after-delete string

Lifecycle workflows, comma-separated names, for each hook.

--schedule string

Cron expression for cluster expiry (e.g. '0 20 * * 5') — each cluster created from the template gets spec.expiresAt set to its next occurrence.

--lock-params boolean

Prevent overriding the template’s params when creating a cluster from it.

--file string

Create from an existing Template YAML file instead of flags (cluster mode only).

Examples:

Terminal window
# Civo template
hyve template create my-civo-template \
--driver github.com/your-org/hyve-civo-module \
--driver-version v1.0.0 \
--region PHX1 \
--set node_size=g4s.kube.medium \
--set node_count=3
# AWS EKS template
hyve template create prod-eks \
--driver github.com/your-org/hyve-eks-module \
--driver-version v2.1.3 \
--region us-east-1 \
--set vpc_id=vpc-0abc123456789 \
--set eks_role_arn=arn:aws:iam::123456789012:role/eks-role \
--set node_role_arn=arn:aws:iam::123456789012:role/node-role \
--set instance_type=t3.medium \
--set node_count=3

Then add workflows/schedule by editing the file hyve template create just wrote (or hyve template show <name> to find it, then edit it in place).

Output:

Template 'my-civo-template' created successfully.
Path: <context directory>/templates/my-civo-template.yaml
Create a cluster from it with:
hyve cluster create <cluster-name> --template my-civo-template

hyve template list

List all available templates in the current repository.

Terminal window
hyve template list

Output:

Available templates (2):
my-civo-template
Driver: github.com/your-org/hyve-civo-module@v1.0.0
Region: PHX1
onCreate: setup-monitoring
prod-eks
Driver: github.com/your-org/hyve-eks-module@v2.1.3
Region: us-east-1
beforeCreate: provision-prereqs
onCreate: deploy-monitoring
onDelete: backup-data
afterDelete: cleanup-prereqs

hyve template show

Display the full YAML of a cluster template.

Terminal window
hyve template show <template-name>
template-name string required

Name of the template to show

Example:

Terminal window
hyve template show my-civo-template

Output:

apiVersion: hyve.io/v1alpha1
kind: Template
metadata:
name: my-civo-template
description: Production Civo cluster
spec:
driver:
source: github.com/your-org/hyve-civo-module
version: v1.0.0
region: PHX1
params:
node_size: g4s.kube.medium
node_count: "3"
workflows:
onCreate:
- setup-monitoring

Creating a cluster from a template

Cluster creation lives under hyve cluster now, not hyve template — see hyve cluster create for the full reference (flags, examples, output, and the step-by-step creation process).

Terminal window
hyve cluster create <cluster-name> --template <template-name>

hyve template delete

Remove a template from the repository.

Terminal window
hyve template delete <template-name>
template-name string required

Name of the template to delete

Example:

Terminal window
hyve template delete old-template

hyve template validate

Validate the syntax and structure of a template definition.

Terminal window
hyve template validate <template-name>
template-name string required

Name of the template to validate

Example:

Terminal window
hyve template validate my-civo-template

Output (success):

Validating template 'my-civo-template'...
Driver: github.com/your-org/hyve-civo-module@v1.0.0 LOCKED
Region: PHX1
Params: node_size, node_count
Workflows: onCreate=[setup-monitoring]
Template is valid.

Output (errors):

Validating template 'broken-template'...
ERRORS:
- spec.driver.source is required
- spec.driver.version 'v9.9.9' is not locked in hyve.lock
WARNINGS:
- onCreate workflow 'missing-workflow' not found in repository
Template is invalid.

Template YAML format

apiVersion: hyve.io/v1alpha1
kind: Template
metadata:
name: prod-eks-template
description: Production EKS cluster
spec:
driver:
source: github.com/your-org/hyve-eks-module
version: v1.0.0
region: us-east-1
params:
vpc_id: vpc-0abc123456789
eks_role_arn: arn:aws:iam::123456789012:role/eks-role
node_role_arn: arn:aws:iam::123456789012:role/node-role
instance_type: t3.medium
node_count: "3"
schedule: "" # optional cron expression for auto-expiry
workflows:
beforeCreate:
- provision-network
onCreate:
- deploy-monitoring
afterCreate:
- create-app-secrets
onDelete:
- drain-workloads
afterDelete:
- cleanup-network

Field reference

spec.driver.source string required

Module source string (e.g. github.com/your-org/hyve-civo-module)

spec.driver.version string required

Module version. Must be locked in hyve.lock.

spec.region string

Default region. Can be overridden at cluster-creation time with --region.

spec.params object

Default param values. Keys and types must match the module’s module.yaml param declarations. Values can be overridden at cluster-creation time with --set.

spec.schedule string

5-field cron expression (minute, hour, day-of-month, month, day-of-week). When a cluster is created from the template, the next occurrence is computed and written to cluster.spec.expiresAt. Leave blank for clusters that should not expire.

spec.lockParams string[]

Names of params whose values, once a cluster is created, get hashed and recorded — not a permission lock. This is what hyve cluster adopt’s drift detection uses to tell “this param was set intentionally at creation” apart from “this looks like drift,” for exactly the params you list here.

spec.workflows.beforeCreate string[]

Workflows to run before the cluster is provisioned. No kubeconfig is available yet.

spec.workflows.onCreate string[]

Workflows to run after the cluster is created and ready, before spec.resources applies for this cycle.

spec.workflows.afterCreate string[]

Workflows to run after the cluster is created and ready, after spec.resources has applied for this cycle. Use instead of onCreate when a workflow depends on something spec.resources creates.

spec.workflows.onDelete string[]

Workflows to run before the cluster is deleted.

spec.workflows.afterDelete string[]

Workflows to run after the cluster is deleted.

Template library examples

Minimal Civo template

apiVersion: hyve.io/v1alpha1
kind: Template
metadata:
name: dev-civo
spec:
driver:
source: github.com/your-org/hyve-civo-module
version: v1.0.0
region: PHX1
params:
node_size: g4s.kube.small
node_count: "1"

Production EKS with full lifecycle

apiVersion: hyve.io/v1alpha1
kind: Template
metadata:
name: prod-eks
description: Production EKS cluster with full lifecycle hooks
spec:
driver:
source: github.com/your-org/hyve-eks-module
version: v2.1.3
region: us-east-1
params:
vpc_id: vpc-0abc123456789
eks_role_arn: arn:aws:iam::123456789012:role/eks-role
node_role_arn: arn:aws:iam::123456789012:role/node-role
instance_type: t3.medium
node_count: "3"
workflows:
onCreate:
- install-monitoring
- install-cert-manager
- deploy-app
afterCreate:
- create-app-secrets
onDelete:
- backup-state
- drain-workloads
afterDelete:
- notify-team

Weekly ephemeral dev template

apiVersion: hyve.io/v1alpha1
kind: Template
metadata:
name: dev-weekly
description: Dev cluster that auto-expires every Friday at 20:00
spec:
driver:
source: github.com/your-org/hyve-civo-module
version: v1.0.0
region: PHX1
params:
node_size: g4s.kube.small
node_count: "1"
schedule: "0 20 * * 5"