bootstrap

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodesphereEnvironment

type CodesphereEnvironment struct {
	ProjectID                string      `json:"project_id"`
	ProjectName              string      `json:"project_name"`
	DNSProjectID             string      `json:"dns_project_id"`
	PostgreSQLNode           node.Node   `json:"postgresql_node"`
	ControlPlaneNodes        []node.Node `json:"control_plane_nodes"`
	CephNodes                []node.Node `json:"ceph_nodes"`
	Jumpbox                  node.Node   `json:"jumpbox"`
	ContainerRegistryURL     string      `json:"container_registry_url"`
	ExistingConfigUsed       bool        `json:"existing_config_used"`
	InstallCodesphereVersion string      `json:"install_codesphere_version"`
	Preemptible              bool        `json:"preemptible"`
	WriteConfig              bool        `json:"write_config"`
	GatewayIP                string      `json:"gateway_ip"`
	PublicGatewayIP          string      `json:"public_gateway_ip"`

	ProjectDisplayName    string
	BillingAccount        string
	BaseDomain            string
	GithubAppClientID     string
	GithubAppClientSecret string
	SecretsDir            string
	FolderID              string
	SSHPublicKeyPath      string
	SSHPrivateKeyPath     string
	DatacenterID          int
	CustomPgIP            string
	InstallConfig         string
	SecretsFile           string
	Region                string
	Zone                  string
	DNSZoneName           string
}

type GCPBootstrapper

type GCPBootstrapper struct {
	InstallConfig *files.RootConfig
	Secrets       *files.InstallVault

	NodeManager *node.NodeManager
	GCPClient   GCPClient
	// contains filtered or unexported fields
}

func NewGCPBootstrapper

func NewGCPBootstrapper(env env.Env, CodesphereEnv *CodesphereEnvironment, gcpClient GCPClient) (*GCPBootstrapper, error)

func (*GCPBootstrapper) Bootstrap

func (b *GCPBootstrapper) Bootstrap() (*CodesphereEnvironment, error)

func (*GCPBootstrapper) EncryptVault

func (b *GCPBootstrapper) EncryptVault() error

func (*GCPBootstrapper) EnsureAPIsEnabled

func (b *GCPBootstrapper) EnsureAPIsEnabled() error

func (*GCPBootstrapper) EnsureAgeKey

func (b *GCPBootstrapper) EnsureAgeKey() error

func (*GCPBootstrapper) EnsureArtifactRegistry

func (b *GCPBootstrapper) EnsureArtifactRegistry() error

func (*GCPBootstrapper) EnsureBilling

func (b *GCPBootstrapper) EnsureBilling() error

func (*GCPBootstrapper) EnsureComputeInstances

func (b *GCPBootstrapper) EnsureComputeInstances() error

func (*GCPBootstrapper) EnsureDNSRecords

func (b *GCPBootstrapper) EnsureDNSRecords() error

func (*GCPBootstrapper) EnsureExternalIP

func (b *GCPBootstrapper) EnsureExternalIP(name string) (string, error)

func (*GCPBootstrapper) EnsureFirewallRules

func (b *GCPBootstrapper) EnsureFirewallRules() error

func (*GCPBootstrapper) EnsureGatewayIPAddresses

func (b *GCPBootstrapper) EnsureGatewayIPAddresses() error

EnsureGatewayIPAddresses reserves 2 static external IP addresses for the ingress controllers of the cluster.

func (*GCPBootstrapper) EnsureIAMRoles

func (b *GCPBootstrapper) EnsureIAMRoles() error

func (*GCPBootstrapper) EnsureInotifyWatches

func (b *GCPBootstrapper) EnsureInotifyWatches() error

func (*GCPBootstrapper) EnsureJumpboxConfigured

func (b *GCPBootstrapper) EnsureJumpboxConfigured() error

func (*GCPBootstrapper) EnsureProject

func (b *GCPBootstrapper) EnsureProject() error

func (*GCPBootstrapper) EnsureRootLoginEnabled

func (b *GCPBootstrapper) EnsureRootLoginEnabled() error

func (*GCPBootstrapper) EnsureServiceAccount

func (b *GCPBootstrapper) EnsureServiceAccount(name string) (string, bool, error)

func (*GCPBootstrapper) EnsureServiceAccounts

func (b *GCPBootstrapper) EnsureServiceAccounts() error

func (*GCPBootstrapper) EnsureVPC

func (b *GCPBootstrapper) EnsureVPC() error

func (*GCPBootstrapper) GenerateK0sConfigScript

func (b *GCPBootstrapper) GenerateK0sConfigScript() error

func (*GCPBootstrapper) InstallCodesphere

func (b *GCPBootstrapper) InstallCodesphere() error

func (*GCPBootstrapper) UpdateInstallConfig

func (b *GCPBootstrapper) UpdateInstallConfig() error

type GCPClient

type GCPClient interface {
	GetProjectByName(ctx context.Context, folderID string, displayName string) (*resourcemanagerpb.Project, error)
	CreateProject(ctx context.Context, parent, projectName, displayName string) (string, error)
	GetBillingInfo(projectID string) (*cloudbilling.ProjectBillingInfo, error)
	EnableBilling(ctx context.Context, projectID, billingAccount string) error
	EnableAPIs(ctx context.Context, projectID string, apis []string) error
	GetArtifactRegistry(ctx context.Context, projectID, region, repoName string) (*artifactpb.Repository, error)
	CreateArtifactRegistry(ctx context.Context, projectID, region, repoName string) (*artifactpb.Repository, error)
	CreateServiceAccount(ctx context.Context, projectID, name, displayName string) (string, bool, error)
	CreateServiceAccountKey(ctx context.Context, projectID, saEmail string) (string, error)
	AssignIAMRole(ctx context.Context, projectID, saEmail, role string) error
	CreateVPC(ctx context.Context, projectID, region, networkName, subnetName, routerName, natName string) error
	CreateFirewallRule(ctx context.Context, projectID string, rule *computepb.Firewall) error
}

Interface for high-level GCP operations

type RealGCPClient

type RealGCPClient struct {
	CredentialsFile string
}

Concrete implementation

func NewGCPClient

func NewGCPClient(credentialsFile string) *RealGCPClient

func (*RealGCPClient) AssignIAMRole

func (c *RealGCPClient) AssignIAMRole(ctx context.Context, projectID, saName, role string) error

func (*RealGCPClient) CreateArtifactRegistry

func (c *RealGCPClient) CreateArtifactRegistry(ctx context.Context, projectID, region, repoName string) (*artifactpb.Repository, error)

func (*RealGCPClient) CreateFirewallRule

func (c *RealGCPClient) CreateFirewallRule(ctx context.Context, projectID string, rule *computepb.Firewall) error

func (*RealGCPClient) CreateProject

func (c *RealGCPClient) CreateProject(ctx context.Context, parent, projectID, displayName string) (string, error)

func (*RealGCPClient) CreateServiceAccount

func (c *RealGCPClient) CreateServiceAccount(ctx context.Context, projectID, name, displayName string) (string, bool, error)

func (*RealGCPClient) CreateServiceAccountKey

func (c *RealGCPClient) CreateServiceAccountKey(ctx context.Context, projectID, saEmail string) (string, error)

func (*RealGCPClient) CreateVPC

func (c *RealGCPClient) CreateVPC(ctx context.Context, projectID, region, networkName, subnetName, routerName, natName string) error

func (*RealGCPClient) EnableAPIs

func (c *RealGCPClient) EnableAPIs(ctx context.Context, projectID string, apis []string) error

func (*RealGCPClient) EnableBilling

func (c *RealGCPClient) EnableBilling(ctx context.Context, projectID, billingAccount string) error

func (*RealGCPClient) GetArtifactRegistry

func (c *RealGCPClient) GetArtifactRegistry(ctx context.Context, projectID, region, repoName string) (*artifactpb.Repository, error)

func (*RealGCPClient) GetBillingInfo

func (c *RealGCPClient) GetBillingInfo(projectID string) (*cloudbilling.ProjectBillingInfo, error)

func (*RealGCPClient) GetProjectByName

func (c *RealGCPClient) GetProjectByName(ctx context.Context, folderID string, displayName string) (*resourcemanagerpb.Project, error)

type VMDef

type VMDef struct {
	Name            string
	MachineType     string
	Tags            []string
	AdditionalDisks []int64
	ExternalIP      bool
}

Jump to

Keyboard shortcuts

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