install

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install is the Install run: taking a chosen target to a running kubriX platform.

An Install run has two phases. Inspect reads the repository, the kubriX source and the installer image and reports what the user still has to decide (apps to leave out, falling back to the latest installer image). Plan.Run then readies the platform repository and the target, runs the platform installer and reports access. Prompts stay with the caller; the decisions come in as data.

Index

Constants

View Source
const (
	// DNSManual is the DNS provider of a platform whose wildcard record the user creates.
	DNSManual = "none"
)

Variables

This section is empty.

Functions

func DNSSecret

func DNSSecret(provider string, creds DNSCredentials) (string, map[string][]byte, error)

DNSSecret returns the Secret external-dns expects for the provider (platform-apps/charts/external-dns/values-dns-*.yaml).

Types

type Apps

type Apps struct {
	// Required are always installed because other apps depend on them.
	Required []string
	// Optional can be left out.
	Optional []string
	// Selected is the initial selection of Optional: saved exclusions are honoured, but never break a kept app.
	Selected []string
	// Dependencies maps optional apps to the apps that must stay installed with them.
	Dependencies map[string][]string
}

Apps is the choice of applications offered while bootstrapping a fresh platform repository.

func (*Apps) Validate

func (a *Apps) Validate(selected []string) error

Validate reports a selection that drops an app another selected app needs.

type Cluster

type Cluster interface {
	platforminstaller.Kube
	SecretValue(ctx context.Context, ns, name, key string) (string, error)
	IngressHosts(ctx context.Context) ([]string, error)
}

Cluster is a running cluster the platform installer can work in.

type ClusterKube

type ClusterKube interface {
	Cluster
	ApplySecretData(ctx context.Context, ns, name string, data map[string][]byte) error
	LoadBalancerAddress(ctx context.Context, ns string) (string, error)
}

ClusterKube is what an existing cluster is asked besides running the platform installer.

type ClusterTarget

type ClusterTarget struct {
	Kube        ClusterKube
	Domain      string
	DNSProvider string
	DNS         DNSCredentials
}

ClusterTarget is an existing cluster chosen from a kubeconfig context.

func (*ClusterTarget) Access

func (*ClusterTarget) Prepare

func (t *ClusterTarget) Prepare(ctx context.Context, p Progress) (Prepared, error)

Prepare creates the DNS provider's credentials for external-dns. With manual DNS it also watches for the LoadBalancer address while the installer runs, to tell the user which wildcard record to create.

func (*ClusterTarget) Profile

func (t *ClusterTarget) Profile() Profile

Profile: without a DNS provider nothing manages records, so external-dns would only fail.

type DNSCredentials

type DNSCredentials struct {
	Token, ProjectID string
	// File is the path of a credentials file (AWS, Azure).
	File string
}

DNSCredentials are what the external-dns values-dns-*.yaml files expect; they are never saved.

type Deps

type Deps struct {
	Host     git.Host
	Upstream Upstream
}

Deps are the services an Install run talks to.

type KindClusters

type KindClusters interface {
	Exists(name string) (bool, error)
	Create(name string) error
	Delete(name string) error
	Connect(name string) (Cluster, error)
}

KindClusters creates and reaches local kind clusters; NewKindClusters is the production adapter.

func NewKindClusters

func NewKindClusters() KindClusters

NewKindClusters returns the kind adapter.

type KindTarget

type KindTarget struct {
	Clusters KindClusters
	Name     string
	// Reuse keeps an existing cluster of that name instead of recreating it.
	Reuse bool
	// CADir receives the kind root CA for the user to trust.
	CADir string
}

KindTarget is a demo: a kind cluster created by the CLI.

func (*KindTarget) Access

func (t *KindTarget) Access(ctx context.Context, c Cluster, p Progress) error

Access saves the kind root CA, which the platform's certificates are issued from.

func (*KindTarget) Prepare

func (t *KindTarget) Prepare(ctx context.Context, p Progress) (Prepared, error)

func (*KindTarget) Profile

func (t *KindTarget) Profile() Profile

type Options added in v0.1.3

type Options struct {
	// InstallerTags are the installer image tags to try in order. Without them, the tag of the kubriX version is tried.
	InstallerTags []string
	// UpstreamToken lets the installer clone a private kubriX source repository.
	UpstreamToken string
	// MaxWaitSeconds is how long the installer waits for the platform to become healthy; 0 keeps its default.
	MaxWaitSeconds int
	// Extra are further installer variables, passed on as they are.
	Extra map[string]string
	// HideSecrets keeps passwords out of the output, e.g. out of CI logs.
	HideSecrets bool
}

Options tune an Install run beyond the selections; the interactive flows use the zero value.

type Plan

type Plan struct {
	// Fresh means the platform repository has no content yet and is bootstrapped.
	Fresh bool
	// Apps is the choice of applications; nil unless Fresh and there is something to choose.
	Apps *Apps
	// ImageFallback is set when the installer image of the version is missing: the run can only continue
	// with the latest image, and the message says why.
	ImageFallback string
	// contains filtered or unexported fields
}

Plan is an inspected Install run.

func Inspect

func Inspect(ctx context.Context, deps Deps, target Target, sel state.Installation, p Progress) (*Plan, error)

Inspect looks at what the run depends on. sel holds the selections to install; its ExcludedApps are the initially deselected apps.

func InspectWith added in v0.1.3

func InspectWith(ctx context.Context, deps Deps, target Target, sel state.Installation, opts Options, p Progress) (*Plan, error)

InspectWith is Inspect for a run tuned by opts.

func (*Plan) Excluded

func (pl *Plan) Excluded() []string

Excluded are the applications left out by the user's selection.

func (*Plan) Run

func (pl *Plan) Run(ctx context.Context, p Progress, record func(state.Installation)) error

Run installs the platform. record receives the Installation as soon as the target is ready, so a failed run can still be found and cleaned up.

func (*Plan) Select

func (pl *Plan) Select(selected []string)

Select sets which of Apps.Optional are installed; every other optional app is left out.

type Prepared

type Prepared struct {
	Cluster Cluster
	// Reused means the cluster already ran a platform installer, whose Job has to be replaced.
	Reused bool
	// Watch, if set, runs while the platform installer runs, until ctx ends.
	Watch func(ctx context.Context)
}

Prepared is a cluster that is ready for the platform installer.

type Profile

type Profile struct {
	// ClusterType is the platform installer's cluster type: kind or k8s.
	ClusterType string
	// Excludes are applications this target never installs, with the reason.
	Excludes map[string]string
}

Profile is what a target tells about itself before anything runs.

type Progress

type Progress interface {
	platforminstaller.Progress
	Heading(msg string)
	Warn(msg string)
}

Progress is how an Install run reports; ui.UI satisfies it.

type Target

type Target interface {
	Profile() Profile
	// Prepare readies the cluster and whatever the platform needs in it before the installer starts.
	Prepare(ctx context.Context, p Progress) (Prepared, error)
	// Access reports what is specific to reaching a platform on this target.
	Access(ctx context.Context, c Cluster, p Progress) error
}

Target is where an Install run executes: a kind cluster created by the CLI or an existing cluster.

type Upstream

type Upstream interface {
	// Apps lists the applications the target type installs on the cluster type.
	Apps(ctx context.Context, repo, ref, targetType, clusterType string) ([]string, error)
	// Manifest downloads the platform installer's manifests.
	Manifest(ctx context.Context, repo, ref string) ([]byte, error)
	ImageTagExists(ctx context.Context, tag string) (bool, error)
	// GitURL is the clone URL of the source repository.
	GitURL(repo string) string
}

Upstream is the kubriX source repository and the installer image registry. platforminstaller.Source is the production adapter.

Directories

Path Synopsis
Package installtest provides fakes for testing Install runs without a cluster, a registry or GitHub.
Package installtest provides fakes for testing Install runs without a cluster, a registry or GitHub.

Jump to

Keyboard shortcuts

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