devinstall

package
v0.1.0-c02.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 45 Imported by: ? 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 devinstall installs one disposable, explicitly non-production provider. Its KubeVirt substrate is an operator-selected prerequisite, never an owned production cluster or a substitute for the production site profile.

Index

Constants

View Source
const (
	APIVersion        = "cloudring.org/v1alpha1"
	Kind              = "CloudRINGDevelopmentInstallation"
	Development       = "development"
	OwnerLabel        = "cloudring.org/development-installation"
	OwnerAnnotation   = "cloudring.org/development-owner"
	ProfileAnnotation = "cloudring.org/development-profile-sha256"
)

Variables

View Source
var (
	ErrInvalidProfile = errors.New("development installation profile is invalid")
	ErrProduction     = errors.New("development installation cannot select a production profile")
	ErrConflict       = errors.New("development installation ownership conflicts with observed state")
	ErrNotFound       = errors.New("development installation is absent")
)
View Source
var ErrCredentials = errors.New("development substrate credentials are invalid; require one explicit inline context")

Functions

func BootstrapGuest

func BootstrapGuest(ctx context.Context, input io.Reader, output io.Writer) error

BootstrapGuest is an internal subcommand. It only operates as root inside the exact disposable Linux guest whose firmware and cloud-init identity match the caller's durable ownership journal. No host fallback exists.

func Fingerprint

func Fingerprint(profile Profile) string

func RunCLI

func RunCLI(ctx context.Context, args []string, input io.Reader, output, diagnostics io.Writer) int

RunCLI is the public `cloudring dev` entry point. All diagnostic messages are constructed by the installer; credential inputs and API bodies stay out.

func Validate

func Validate(profile Profile, mode string) error

Validate requires an explicit caller mode in addition to the document kind. A production caller cannot accept this document even if all resources fit.

Types

type APIError

type APIError struct{ StatusCode int }

APIError exposes only a status code. API bodies can include Secret contents or broad cluster information and are never returned as diagnostic strings.

func (*APIError) Error

func (err *APIError) Error() string

type BOM

type BOM struct {
	SourceCommit        string     `json:"sourceCommit"`
	Installer           Download   `json:"installer"`
	GuestImage          string     `json:"guestImage"`
	RuntimeImage        string     `json:"runtimeImage"`
	PostgreSQLImage     string     `json:"postgresqlImage"`
	Kubeadm             Download   `json:"kubeadm"`
	Kubelet             Download   `json:"kubelet"`
	Kubectl             Download   `json:"kubectl"`
	Containerd          Download   `json:"containerd"`
	Runc                Download   `json:"runc"`
	CNIPlugins          Download   `json:"cniPlugins"`
	CRICTL              Download   `json:"crictl"`
	Helm                Download   `json:"helm"`
	CiliumChart         Download   `json:"ciliumChart"`
	CiliumImage         string     `json:"ciliumImage"`
	CiliumOperatorImage string     `json:"ciliumOperatorImage"`
	KubernetesImages    []ImagePin `json:"kubernetesImages"`
}

type Check

type Check struct {
	Name   string `json:"name"`
	Passed bool   `json:"passed"`
	Code   string `json:"code,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(reader io.Reader, profile Profile) (*Client, error)

NewClient consumes credentials once. They are held in memory only and are never copied into the installation journal, command arguments or reports.

func (*Client) CheckPrerequisites

func (client *Client) CheckPrerequisites(ctx context.Context) (Prerequisites, error)

CheckPrerequisites performs fresh read-only checks. Its report explicitly distinguishes API scheduling headroom from storage failure headroom and policy enforcement, which need the operator's substrate-specific evidence.

func (*Client) Close

func (client *Client) Close() error

type Credentials

type Credentials struct {
	OperatorToken               string    `json:"operatorToken"`
	DatabaseAdminPassword       string    `json:"databaseAdminPassword"`
	DatabaseOwnerPassword       string    `json:"databaseOwnerPassword"`
	DatabaseApplicationPassword string    `json:"databaseApplicationPassword"`
	CACertificate               string    `json:"caCertificate"`
	APIKey                      string    `json:"apiKey"`
	APICertificate              string    `json:"apiCertificate"`
	DatabaseKey                 string    `json:"databaseKey"`
	DatabaseCertificate         string    `json:"databaseCertificate"`
	SSHClientPrivateKey         string    `json:"sshClientPrivateKey"`
	SSHClientPublicKey          string    `json:"sshClientPublicKey"`
	SSHHostPrivateKey           string    `json:"sshHostPrivateKey"`
	SSHHostPublicKey            string    `json:"sshHostPublicKey"`
	CertificateExpiresAt        time.Time `json:"certificateExpiresAt"`
}

Credentials are generated once and kept only in the protected installation directory and its own guest/Kubernetes Secrets. Never encode this structure into a diagnostic report, deterministic plan or command argument.

type Download

type Download struct {
	Version string `json:"version"`
	URL     string `json:"url"`
	SHA256  string `json:"sha256"`
}

Download is an exact upstream artifact. Archives are checked before any executable is installed in the owned guest.

type Engine

type Engine struct {
	Client   *Client
	Store    *StateStore
	Progress io.Writer
}

func (*Engine) Connect

func (engine *Engine) Connect(ctx context.Context) error

Connect keeps a single loopback HTTPS forwarding listener in the foreground. It owns no background process, proxy configuration, DNS or global CA trust.

func (*Engine) Create

func (engine *Engine) Create(ctx context.Context) (Report, error)

func (*Engine) Destroy

func (engine *Engine) Destroy(ctx context.Context) (Report, error)

Destroy never clears finalizers or directly deletes CSI backend volumes. The normal controllers must finish foreground deletion and Longhorn reclaim.

func (*Engine) Diagnose

func (engine *Engine) Diagnose(ctx context.Context) (Report, error)

func (*Engine) Reset

func (engine *Engine) Reset(ctx context.Context) (Report, error)

Reset is explicitly destructive for this one installation. It starts a new ownership identity only after the previous installation has a green receipt.

func (*Engine) Status

func (engine *Engine) Status(ctx context.Context) (Report, error)

type Guest

type Guest struct {
	CPUs      int `json:"cpus"`
	MemoryMiB int `json:"memoryMiB"`
	DiskGiB   int `json:"diskGiB"`
}

type ImagePin

type ImagePin struct {
	Name   string `json:"name"`
	Digest string `json:"digest"`
}

ImagePin binds kubeadm's upstream image name to its immutable OCI digest. The alias is needed by upstream kubeadm; it may never be rebound to a different digest while this installation exists.

type Network

type Network struct {
	GuestCIDR     string   `json:"guestCIDR"`
	PodCIDR       string   `json:"podCIDR"`
	ServiceCIDR   string   `json:"serviceCIDR"`
	PublicOrigin  string   `json:"publicOrigin"`
	EgressDomains []string `json:"egressDomains"`
}

type Object

type Object struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Resource   string `json:"resource"`
	Namespace  string `json:"namespace,omitempty"`
	Name       string `json:"name"`
	UID        string `json:"uid,omitempty"`
}

Object identifies the exact API object which an operation may create. UID is filled only from successful API readback, never manufactured locally.

type OwnedObject

type OwnedObject struct {
	Object
	DesiredSHA256 string `json:"desiredSHA256"`
}

type OwnedVolume

type OwnedVolume struct {
	PersistentVolume Object `json:"persistentVolume"`
	ClaimUID         string `json:"claimUID"`
	Driver           string `json:"driver"`
	Handle           string `json:"handle"`
	Backend          Object `json:"backend"`
}

type Plan

type Plan struct {
	APIVersion            string   `json:"apiVersion"`
	InstallationID        string   `json:"installationID"`
	ProfileSHA256         string   `json:"profileSHA256"`
	Profile               string   `json:"profile"`
	ProductionReady       bool     `json:"productionReady"`
	TargetClusterUID      string   `json:"targetClusterUID"`
	Objects               []Object `json:"objects"`
	GuestAddress          string   `json:"guestAddress"`
	GuestCommands         []string `json:"guestCommands"`
	PublicOrigin          string   `json:"publicOrigin"`
	RequiredPrerequisites []string `json:"requiredPrerequisites"`
}

func BuildPlan

func BuildPlan(profile Profile) (Plan, error)

type Prerequisites

type Prerequisites struct {
	ObservedAt                                 time.Time `json:"observedAt"`
	TargetClusterUID                           string    `json:"targetClusterUID"`
	Node                                       string    `json:"node"`
	AvailableCPUMilli                          int64     `json:"availableCPUMilli"`
	AvailableMemoryMiB                         int64     `json:"availableMemoryMiB"`
	StorageClass                               string    `json:"storageClass"`
	StorageReclaimPolicy                       string    `json:"storageReclaimPolicy"`
	StoragePlacementRequiresOperatorAcceptance bool      `json:"storagePlacementRequiresOperatorAcceptance"`
	NetworkPolicyRequiresLiveDenialTest        bool      `json:"networkPolicyRequiresLiveDenialTest"`
}

type Profile

type Profile struct {
	APIVersion     string  `json:"apiVersion"`
	Kind           string  `json:"kind"`
	Profile        string  `json:"profile"`
	InstallationID string  `json:"installationID"`
	Target         Target  `json:"target"`
	Guest          Guest   `json:"guest"`
	Network        Network `json:"network"`
	Artifacts      BOM     `json:"artifacts"`
}

Profile contains public artifact pins and explicit infrastructure selection. Credentials never belong in a profile or in its deterministic plan.

func Parse

func Parse(reader io.Reader) (Profile, error)

type ProviderObservation

type ProviderObservation struct {
	InstallationID        string    `json:"installationID"`
	Profile               string    `json:"profile"`
	Status                string    `json:"status"`
	OperatorID            string    `json:"operatorID"`
	CreatedAt             time.Time `json:"createdAt"`
	ProductCount          int       `json:"productCount"`
	Database              string    `json:"database"`
	SourceRevision        string    `json:"sourceRevision"`
	SourceModified        bool      `json:"sourceModified"`
	UnauthenticatedDenied bool      `json:"unauthenticatedDenied"`
	ForeignTokenDenied    bool      `json:"foreignTokenDenied"`
}

type Report

type Report struct {
	APIVersion       string               `json:"apiVersion"`
	InstallationID   string               `json:"installationID"`
	Profile          string               `json:"profile"`
	ProfileSHA256    string               `json:"profileSHA256"`
	SourceCommit     string               `json:"sourceCommit"`
	ProductionReady  bool                 `json:"productionReady"`
	ObservedAt       time.Time            `json:"observedAt"`
	Phase            string               `json:"phase"`
	Ready            bool                 `json:"ready"`
	TargetClusterUID string               `json:"targetClusterUID"`
	PublicOrigin     string               `json:"publicOrigin"`
	Objects          []Object             `json:"objects"`
	DerivedObjects   []Object             `json:"derivedObjects,omitempty"`
	Volumes          []OwnedVolume        `json:"volumes,omitempty"`
	Provider         *ProviderObservation `json:"provider,omitempty"`
	Checks           []Check              `json:"checks"`
	ZeroOwnedResidue bool                 `json:"zeroOwnedResidue"`
}

type State

type State struct {
	APIVersion        string        `json:"apiVersion"`
	InstallationID    string        `json:"installationID"`
	OwnerNonce        string        `json:"ownerNonce"`
	ProfileSHA256     string        `json:"profileSHA256"`
	Profile           Profile       `json:"profile"`
	Credentials       Credentials   `json:"credentials"`
	CreatedAt         time.Time     `json:"createdAt"`
	UpdatedAt         time.Time     `json:"updatedAt"`
	Sequence          uint64        `json:"sequence"`
	Phase             string        `json:"phase"`
	Objects           []OwnedObject `json:"objects"`
	DerivedObjects    []Object      `json:"derivedObjects,omitempty"`
	Volumes           []OwnedVolume `json:"volumes,omitempty"`
	GuestBootstrapped bool          `json:"guestBootstrapped"`
	FailureCode       string        `json:"failureCode,omitempty"`
}

State is an installation-specific ownership journal, not runtime data. Accepted API/domain state lives only in the real PostgreSQL provider.

type StateStore

type StateStore struct {
	Path  string
	State State
	// contains filtered or unexported fields
}

StateStore keeps a process-wide exclusive lock and root directory handle. The root must be a new directory or a complete owned journal. No existing arbitrary directory is adopted, even when its name looks correct.

func OpenState

func OpenState(path string, profile Profile, create bool) (_ *StateStore, resultErr error)

func (*StateStore) Close

func (store *StateStore) Close() error

func (*StateStore) Remove

func (store *StateStore) Remove() error

Remove is called only after the backend's complete owned-resource absence sweep has succeeded. Unexpected local content is preserved, never recursed.

func (*StateStore) Save

func (store *StateStore) Save() error

func (*StateStore) WriteCredentialFile

func (store *StateStore) WriteCredentialFile(name string, payload []byte) error

type Target

type Target struct {
	APIServer      string `json:"apiServer"`
	KubeSystemUID  string `json:"kubeSystemUID"`
	Namespace      string `json:"namespace"`
	VirtualMachine string `json:"virtualMachine"`
	Node           string `json:"node"`
	StorageClass   string `json:"storageClass"`
	PriorityClass  string `json:"priorityClass"`
}

Jump to

Keyboard shortcuts

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