deployer

package
v0.0.0-...-60784e1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package deployer is the v4 install path: load a CLI config, translate to operator chart values + four platform CRs, install the operator chart via Helm SDK, server-side-apply the CRs in dependency order, and wait for each to be Ready=True.

Index

Constants

View Source
const (
	// OperatorNamespace is where the educates-installer helm release
	// lives. Matches the chart's recommended deploy namespace and the
	// samples in installer/samples/.
	OperatorNamespace = "educates-installer"

	// OperatorReleaseName is the helm release name.
	OperatorReleaseName = "educates-installer"

	// DefaultTimeout caps the wait on each CR's Ready=True condition.
	DefaultTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, opts DeleteOptions) error

Delete executes the uninstall pipeline:

  1. Delete SessionManager → wait gone.
  2. Delete LookupService → wait gone.
  3. Delete SecretsManager → wait gone.
  4. Delete EducatesClusterConfig → wait gone (its finalizer drains kyverno → external-dns → contour → cert-manager → CustomCA copy in reverse install order).
  5. helm uninstall the operator chart.

Idempotent: a CR that's already gone is a no-op step. Useful for re-running after a half-finished delete or for cleaning up state the last deploy never created.

Deliberately NOT deleted (user state across reinstalls):

  • CRDs (helm never owns them; would cascade-delete any CR in the cluster, including ones from other Educates installs).
  • The operator namespace itself.
  • educates-secrets namespace + the synced CA Secret (so the next deploy reuses the same CA the user already trusts in their browser).

func Deploy

func Deploy(ctx context.Context, out *translator.Output, opts Options) error

Deploy executes the install pipeline against the cluster reachable via opts.Getter:

  1. Helm install/upgrade the operator chart in the operator namespace.
  2. Apply EducatesClusterConfig → wait Ready.
  3. Verify the educates-custom-ca prerequisite Secret (unless skipped).
  4. Apply SecretsManager → wait Ready.
  5. Apply LookupService (if present) → wait Ready.
  6. Apply SessionManager → wait Ready.

Returns the last LookupService/SessionManager objects observed so the caller can print URLs from .status.

Types

type DeleteOptions

type DeleteOptions struct {
	Getter   genericclioptions.RESTClientGetter
	Out      io.Writer
	HelmLog  io.Writer
	Timeout  time.Duration
	Progress progress.Reporter

	// Purge, when true, extends the delete pipeline AFTER helm
	// uninstall to remove the four CRDs, the operator namespace, and
	// the 'educates-secrets' namespace. Local <data-home>/config.yaml
	// + cached CA Secrets are intentionally preserved — they're user
	// authoring inputs and survive cluster reinstalls.
	Purge bool
}

DeleteOptions configures a delete run. Mirrors Options but the inputs differ: we don't need translator output here since the resources are always the same four CRs at metadata.name=cluster + the helm release.

type Options

type Options struct {
	// Getter is the kubectl-style RESTClientGetter — typically a
	// configured genericclioptions.ConfigFlags from cobra.
	Getter genericclioptions.RESTClientGetter

	// Out is where progress lines are written. Pass cmd.OutOrStdout()
	// from cobra; pass io.Discard from tests.
	Out io.Writer

	// HelmLog receives helm SDK debug output. io.Discard by default.
	HelmLog io.Writer

	// Timeout overrides DefaultTimeout per CR wait.
	Timeout time.Duration

	// SkipPrereqCheck bypasses the educates-custom-ca Secret existence
	// check. Set when the caller has already verified, or for advanced
	// users who manage the Secret asynchronously.
	SkipPrereqCheck bool

	// SkipCRDApply bypasses the operator CRD apply step. The default
	// is to push CRDs from the embedded chart before helm-install so a
	// CRD shape change reaches the cluster on re-deploy (helm itself
	// only installs CRDs on first install, never on upgrade). Set true
	// when the user manages CRDs out of band (GitOps, separate
	// kubectl apply, etc.).
	SkipCRDApply bool

	// SyncLocalSecrets, when true, copies <data-home>/secrets/*.yaml into
	// the cluster's 'educates-secrets' namespace before applying the
	// platform CRs. Matches the v3 laptop flow: cached CA/TLS material
	// is pushed at deploy time, ECC's caCertificateRef points there.
	// Only meaningful for EducatesLocalConfig deploys.
	SyncLocalSecrets bool

	// Progress is the structured progress reporter. When nil, plain
	// io.Discard-backed reporter is used (no progress output, but the
	// helpers still call into it so the call-site code is uniform).
	// Cmd code typically passes progress.NewForStdout(...) to render
	// to the user's terminal with TTY-aware overwriting.
	Progress progress.Reporter
}

Options configures a deploy run.

type PlatformComponentStatus

type PlatformComponentStatus struct {
	Kind     string // e.g. "EducatesClusterConfig"
	Optional bool   // absent is acceptable (only LookupService)
	Present  bool   // the CR (and its CRD) exists in the cluster
	Ready    bool   // status.conditions[type=Ready].status == "True"
	Phase    string // status.phase, for extra detail when not Ready
}

PlatformComponentStatus is the observed status of one Educates platform CR.

func PlatformStatus

func PlatformStatus(ctx context.Context, dyn dynamic.Interface) ([]PlatformComponentStatus, error)

PlatformStatus reads the status of the Educates platform CRs from the cluster. A CR whose CRD or "cluster" instance is absent is reported with Present=false — that is how a cluster-only install (no Educates) is detected. A connectivity error (unreachable API) is returned as an error.

type PurgeTargets

type PurgeTargets struct {
	CRDs       []string
	Namespaces []string
}

PurgeTargets is the inventory --purge will delete in addition to the standard delete pipeline. Exported so the cmd-layer confirmation prompt can render it for the user before they accept.

func PurgePlan

func PurgePlan() PurgeTargets

PurgePlan returns the list of cluster resources Purge would remove after helm uninstall. Stable order so the confirmation prompt is reproducible.

Directories

Path Synopsis
Package apply server-side-applies arbitrary unstructured Kubernetes objects from the CLI.
Package apply server-side-applies arbitrary unstructured Kubernetes objects from the CLI.
Package chart embeds the educates-installer Helm chart into the CLI binary.
Package chart embeds the educates-installer Helm chart into the CLI binary.
Package crds applies the four platform CRDs from the embedded operator chart to the cluster before helm-install.
Package crds applies the four platform CRDs from the embedded operator chart to the cluster before helm-install.
Package helm wraps the helm SDK with the small surface the CLI needs to install or upgrade the educates-installer chart in-process.
Package helm wraps the helm SDK with the small surface the CLI needs to install or upgrade the educates-installer chart in-process.
Package prereq checks deploy prerequisites that must be satisfied before the four platform CRs can reconcile.
Package prereq checks deploy prerequisites that must be satisfied before the four platform CRs can reconcile.
Package progress renders deploy/delete step status as compact per-step lines instead of free-form prints.
Package progress renders deploy/delete step status as compact per-step lines instead of free-form prints.
Package wait polls a Kubernetes resource until its Ready=True condition flips, or a timeout fires.
Package wait polls a Kubernetes resource until its Ready=True condition flips, or a timeout fires.

Jump to

Keyboard shortcuts

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