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
- func BranchTag(branch string) string
- func Run(ctx context.Context, kc Kube, p Progress, o Options) error
- func SetImageTag(manifest []byte, tag string) ([]byte, error)
- type Kube
- type Options
- type Progress
- type Source
- func (s Source) Apps(ctx context.Context, repo, ref, targetType, clusterType string) ([]string, error)
- func (s Source) GitURL(repo string) string
- func (s Source) ImageTagExists(ctx context.Context, tag string) (bool, error)
- func (s Source) Manifest(ctx context.Context, repo, ref string) ([]byte, error)
- type Spec
Constants ¶
const ( ImageRepo = "ghcr.io/suxess-it/kubrix-installer" Namespace = "kubrix-install" JobName = "kubrix-install-job" SecretName = "kubrix-install-secrets" )
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 ¶
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) ImageTagExists ¶
ImageTagExists reports whether the installer image has the tag.
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
}
Spec is what the platform installer is told about the platform it installs.
func (Spec) SecretValues ¶
SecretValues are the keys of the installer's Secret, the env contract with install-platform.sh.