platforminstaller

package
v0.1.4 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: 18 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 platforminstaller runs the kubriX platform installer, a Kubernetes Job from the kubriX source repository, and reads what it is installed from.

Index

Constants

View Source
const (
	ImageRepo  = "ghcr.io/suxess-it/kubrix-installer"
	Namespace  = "kubrix-install"
	JobName    = "kubrix-install-job"
	SecretName = "kubrix-install-secrets"
)
View Source
const (
	// DefaultUpstream is the kubriX source repository; the installer only needs to be told about other ones.
	DefaultUpstream = "suxess-it/kubriX"
)

Variables

This section is empty.

Functions

func BranchTag

func BranchTag(branch string) string

BranchTag mirrors docker/metadata-action's `type=ref,event=branch` tag naming.

func IsSpecKey added in v0.1.3

func IsSpecKey(key string) bool

IsSpecKey reports whether the Secret key is derived from a Spec field, so it cannot be one of the Extra.

func Run

func Run(ctx context.Context, kc Kube, p Progress, o Options) error

Run applies the installer's Secret and manifests, follows its logs and waits until the Job ends.

func SetImageTag

func SetImageTag(manifest []byte, tag string) ([]byte, error)

SetImageTag points the manifest's installer image at tag.

Types

type Kube

type Kube interface {
	EnsureNamespace(ctx context.Context, name string) error
	ApplySecret(ctx context.Context, ns, name string, values map[string]string) error
	DeleteJob(ctx context.Context, ns, name string) error
	ApplyManifests(ctx context.Context, manifests []byte) error
	WaitForJobPod(ctx context.Context, ns, job string) (string, error)
	StreamLogs(ctx context.Context, ns, pod string, w io.Writer) error
	WaitForJob(ctx context.Context, ns, name string) (bool, error)
	JobDiagnostics(ctx context.Context, ns, name string) string
}

Kube is the cluster access the platform installer needs; *kube.Client is the production adapter.

type Options

type Options struct {
	Spec     Spec
	Manifest []byte
	// ReplaceJob removes the Job of a previous run first; a finished Job cannot be updated in place.
	ReplaceJob bool
}

Options configure one Run.

type Progress

type Progress interface {
	Step(ctx context.Context, title string, fn func(context.Context) error) error
	// Begin marks a long phase without a spinner (e.g. while logs stream); call end when it finishes.
	Begin(title string) (end func(error))
	Logs() io.Writer
	Info(msg string)
	OK(msg string)
}

Progress reports what the run is doing; ui.UI satisfies it.

type Source

type Source struct {
	// Token is only used as a fallback for private forks.
	Token string
	// RawURL is where raw file contents are served; raw.githubusercontent.com when empty.
	RawURL string
	// Image is the installer image repository; ImageRepo when empty.
	Image string
	// InsecureRegistry allows a registry over plain HTTP, for a local one.
	InsecureRegistry bool
}

Source reads the installer's inputs from the kubriX source repository on GitHub and the installer image registry. The zero value reads from GitHub and ghcr.io.

func (Source) Apps

func (s Source) Apps(ctx context.Context, repo, ref, targetType, clusterType string) ([]string, error)

Apps lists the applications the target type installs on the cluster type, rendering the target's template the way the bootstrap does.

func (Source) GitURL

func (s Source) GitURL(repo string) string

GitURL is the clone URL of the source repository.

func (Source) ImageTagExists

func (s Source) ImageTagExists(ctx context.Context, tag string) (bool, error)

ImageTagExists reports whether the installer image has the tag.

func (Source) Manifest

func (s Source) Manifest(ctx context.Context, repo, ref string) ([]byte, error)

Manifest downloads install-manifests.yaml of the ref.

type Spec

type Spec struct {
	RepoURL        string
	RepoToken      string
	GitUserName    string
	Domain         string
	DNSProvider    string
	CloudProvider  string
	TargetType     string
	ClusterType    string // kind | k8s
	UpstreamRepo   string
	UpstreamBranch string
	// Bootstrap makes the installer bootstrap the (empty) platform repository itself.
	Bootstrap bool
	// ExcludedApps are applications left out while bootstrapping; only meaningful for a fresh repository.
	ExcludedApps []string
	// UpstreamToken lets the installer clone a private UpstreamRepo.
	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. They never replace a specKey.
	Extra map[string]string
}

Spec is what the platform installer is told about the platform it installs.

func (Spec) SecretValues

func (s Spec) SecretValues() map[string]string

SecretValues are the keys of the installer's Secret, the env contract with install-platform.sh.

Jump to

Keyboard shortcuts

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