ork

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

pkg/ork

The ork package provides the cluster-facing primitives that the Orkestra runtime needs to operate: Helm chart installation, kind cluster management, health checking, and prerequisite detection.

This is the boundary between Orkestra's core packages and the cluster. It does not detect projects, generate Katalogs, parse compose files, or manage deploy state — those concerns live in ork-doctor.

What the package provides

Area Functions Used by
Helm InstallOrUpgradeOrkestra, BuildControlCenterValues pkg/e2e, cmd/cli
Cluster health OrkestraInstalled, RuntimeDeployed, CheckRuntimeHealth, SyncRuntime, FetchRuntimeLogs, KatalogChanged pkg/e2e, cmd/cli
Kind EnsureKindCluster, DeleteKindCluster pkg/e2e, cmd/cli
Dependencies EnsureDependencies, KubectlAvailable, HelmAvailable, ClusterReachable pkg/e2e, cmd/cli
Constants Orkestra, OrkestraRuntime, OrkestraNamespace, OrkestraChartRepo, OrkestraChartName, KindClusterName everywhere

Package structure

File Responsibility
constants.go All Orkestra* and chart constants
helm.go InstallOrUpgradeOrkestra, BuildControlCenterValues
health.go CheckRuntimeHealth, SyncRuntime, FetchRuntimeLogs, OrkestraInstalled, RuntimeDeployed, KatalogChanged
kind.go EnsureKindCluster, DeleteKindCluster, binary download
deps.go EnsureDependencies, KubectlAvailable, HelmAvailable, ClusterReachable

Developer documentation

I want to… Go to
Understand cluster health checking and runtime sync docs/01-cluster.md
Understand Helm chart installation docs/02-helm.md

Documentation

Index

Constants

View Source
const (
	// Orkestra is the Helm release name and the prefix for all Orkestra resources.
	Orkestra = "orkestra"

	// OrkestraRuntime is the name of the runtime Deployment.
	OrkestraRuntime = "orkestra-runtime"

	// OrkestraGateway is the name of the gateway Deployment.
	OrkestraGateway = "orkestra-gateway"

	// OrkestraNamespace is the Kubernetes namespace Orkestra deploys into.
	OrkestraNamespace = "orkestra-system"

	// OrkestraChartRepo is the Helm repository URL for the Orkestra chart.
	OrkestraChartRepo = "https://orkspace.github.io/orkestra"

	// OrkestraChartName is the chart name within the repository.
	OrkestraChartName = "orkestra"

	// OrkestraControlCenter is the name of the Control Center Deployment.
	OrkestraControlCenter = "orkestra-cc"

	// OrkestraControlCenterPort is the default Control Center HTTP port.
	OrkestraControlCenterPort = "8081"
)
View Source
const (
	// KindClusterName is the default kind cluster name used by ork run --dev.
	KindClusterName = "orkestra-playground"
)

Variables

This section is empty.

Functions

func BuildControlCenterValues

func BuildControlCenterValues(host string) (string, error)

BuildControlCenterValues generates a temporary Helm values file that enables the Control Center ingress for the given hostname. The caller is responsible for removing the file when done.

func ClusterReachable

func ClusterReachable() bool

ClusterReachable reports whether kubectl can reach the cluster configured in the current kubeconfig. Times out after 5 seconds.

func DeleteKindCluster

func DeleteKindCluster(name string) error

DeleteKindCluster deletes a kind cluster by name. Safe to call when the cluster does not exist.

func EnsureDependencies

func EnsureDependencies() error

EnsureDependencies installs kubectl and helm if they are missing.

func EnsureKindCluster

func EnsureKindCluster(name string) error

EnsureKindCluster creates a kind cluster named `name` if it does not already exist, then switches kubectl to its context. Downloads the kind binary from GitHub releases if not found in PATH or ~/.orkestra/bin.

func FetchControlCenterLogsIfNeeded added in v0.6.5

func FetchControlCenterLogsIfNeeded() error

FetchControlCenterLogsIfNeeded fetches control center logs only if the deployment exists but has no ready replicas

func FetchGatewayLogs added in v0.6.5

func FetchGatewayLogs() (tail string, err error)

FetchGatewayLogs saves gateway logs and returns the last 10 lines

func FetchRuntimeLogs

func FetchRuntimeLogs() (tail string, err error)

FetchRuntimeLogs saves the last 100 log lines from the Orkestra runtime to /tmp/orkestra/runtime.log. If the Control Center Deployment exists but has no ready replicas, its logs are saved to /tmp/orkestra/controlcenter.log. Returns the last 10 lines of the runtime log for inline display.

func GatewayInstalled added in v0.6.5

func GatewayInstalled() bool

GatewayInstalled reports whether the Orkestra gateway Deployment exists.

func HelmAvailable

func HelmAvailable() bool

HelmAvailable reports whether helm is present in PATH.

func HelmInstall

func HelmInstall(ctx context.Context, h orktypes.SetupHelmInstall) error

HelmInstall installs or upgrades a Helm chart as declared in SetupHelmInstall. Uses helm upgrade --install so the call is idempotent.

func InstallOrUpgradeOrkestra

func InstallOrUpgradeOrkestra(version string, valueFiles []string, args ...string) error

InstallOrUpgradeOrkestra installs or upgrades the Orkestra Helm chart idempotently. It always runs `helm upgrade --install` so the call is safe whether Orkestra is already present or not.

The repo is added and updated before every call to ensure the index is current. Version may be empty to use the latest chart. Additional Helm flags (e.g. --set, --atomic) are passed through args.

func KatalogChanged

func KatalogChanged(dir string) bool

KatalogChanged returns true when .orkestra/katalog.yaml has uncommitted changes or was touched by the most recent commit.

func KubectlAvailable

func KubectlAvailable() bool

KubectlAvailable reports whether kubectl is present in PATH.

func ResourceExists added in v0.6.5

func ResourceExists(resourceType, resourceName, namespace string) bool

In future if needed: ServiceExists := ResourceExists("service", "my-service", "default") ConfigMapExists := ResourceExists("configmap", "my-config", "kube-system")

func RuntimeInstalled added in v0.6.5

func RuntimeInstalled() bool

RuntimeInstalled reports whether the Orkestra runtime Deployment exists.

func SyncDeployment added in v0.6.5

func SyncDeployment(deploymentName, namespace string, timeout time.Duration) error

SyncDeployment restarts a Kubernetes Deployment and waits for the rollout to complete. Returns an error if the restart or rollout status check fails. Timeout is configurable (e.g., 3*time.Minute).

func SyncGateway added in v0.6.5

func SyncGateway() error

SyncGateway restarts the Orkestra gateway Deployment and waits for rollout.

func SyncRuntime

func SyncRuntime() error

SyncRuntime restarts the Orkestra runtime Deployment and waits for rollout.

func WaitForResource

func WaitForResource(ctx context.Context, w orktypes.SetupWait) error

WaitForResource polls until the described resource exists (and is ready when w.Ready is true). Times out after w.Timeout (default 30s).

Types

type DeploymentHealthChecker added in v0.6.5

type DeploymentHealthChecker struct {
	Name      string
	Namespace string
}

DeploymentHealthChecker handles health checks for any deployment

func (DeploymentHealthChecker) CheckHealth added in v0.6.5

func (d DeploymentHealthChecker) CheckHealth(timeout time.Duration, checkFailure func(ctx context.Context) string) DeploymentStatus

CheckHealth waits up to timeout for a deployment to have at least one ready replica. Polls every 2 seconds. Returns immediately if a custom failure condition is detected.

func (DeploymentHealthChecker) Exists added in v0.6.5

func (d DeploymentHealthChecker) Exists() bool

Exists checks if the deployment exists

func (DeploymentHealthChecker) FetchLogs added in v0.6.5

func (d DeploymentHealthChecker) FetchLogs(maxLines int, logDir, logPath string) (tail string, err error)

FetchLogs saves the last maxLines from the deployment to a file and returns the last 10 lines

func (DeploymentHealthChecker) HasReadyReplicas added in v0.6.5

func (d DeploymentHealthChecker) HasReadyReplicas(ctx context.Context) bool

HasReadyReplicas checks if the deployment has at least one ready replica

type DeploymentStatus added in v0.6.5

type DeploymentStatus struct {
	Running bool
	Reason  string // set when Running is false
}

DeploymentStatus represents the status of a Kubernetes deployment

func CheckGatewayHealth added in v0.6.5

func CheckGatewayHealth() DeploymentStatus

CheckGatewayHealth waits up to healthCheckTimeout for the Orkestra gateway to be ready

func CheckRuntimeHealth

func CheckRuntimeHealth() DeploymentStatus

CheckRuntimeHealth waits up to healthCheckTimeout for the Orkestra runtime to be ready

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL