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
- func DNSSecret(provider string, creds DNSCredentials) (string, map[string][]byte, error)
- type Apps
- type Cluster
- type ClusterKube
- type ClusterTarget
- type DNSCredentials
- type Deps
- type KindClusters
- type KindTarget
- type Options
- type Plan
- type Prepared
- type Profile
- type Progress
- type Target
- type Upstream
Constants ¶
const (
// DNSManual is the DNS provider of a platform whose wildcard record the user creates.
DNSManual = "none"
)
Variables ¶
This section is empty.
Functions ¶
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.
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) Prepare ¶
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 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 ¶
Access saves the kind root CA, which the platform's certificates are issued from.
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.
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. |