stack

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionV0_1_0_0 Version = "v0.1.0.0"
	SupportEmail    string  = "support@upcloud.com"
)

Variables

This section is empty.

Functions

func ApplyKustomize

func ApplyKustomize(dir string) error

ApplyKustomize builds the kustomization at `dir` and applies all resulting resources server-side (using server-side apply).

func BaseStackCommand

func BaseStackCommand() commands.Command

func CheckSSHKeys

func CheckSSHKeys(privateKeyPath, publicKeyPath string) error

CheckSSHKeys ensures both private and public SSH key files exist.

func ClusterExists

func ClusterExists(clusterName string, clusters []upcloud.KubernetesCluster) bool

ClusterExists checks if a Kubernetes cluster with the given name exists in the provided list of clusters.

func CreateHelmLogFile

func CreateHelmLogFile(chartPath string) (*os.File, error)

func CreateNamespace

func CreateNamespace(kubeClient *kubernetes.Clientset, namespace string) error

CreateNamespace creates a Kubernetes namespace if it does not already exist.

func CreateNetwork

func CreateNetwork(exec commands.Executor, networkName, location string, stackType StackType) (*upcloud.Network, error)

CreateNetwork creates a network with a random 10.0.X.0/24 subnet It will try 10 times to create a network with a random subnet If it fails to create a network after 10 attempts, it returns an error

func DeployCommand

func DeployCommand() commands.Command

DeployCommand creates the "stack deploy" command

func DeployHelmRelease

func DeployHelmRelease(kubeClient *kubernetes.Clientset, releaseName string, chartPath string, valuesFiles []string, upgrade bool) error

deployHelmRelease will check if a Helm release named releaseName exists in namespace=releaseName. - If it doesn't exist and upgrade = false, it will install the chart at chartPath using valuesFiles. - If it does exist and upgrade = true, it will perform a Helm upgrade with the same chartPath and values.

func DeployHelmReleaseFromRepo

func DeployHelmReleaseFromRepo(
	kubeClient *kubernetes.Clientset,
	releaseName, repoURL, chartName, version string,
	valsFiles []string,
	upgrade bool,
) error

DeployHelmReleaseFromRepo deploys a Helm release from a remote repository.

func ExecInPod

func ExecInPod(
	restConfig *rest.Config,
	kubeClient *kubernetes.Clientset,
	namespace, podName string,
	containerName string,
	cmd []string,
	stdin io.Reader,
) (stdout, stderr []byte, err error)

ExecInPod runs a command in the given pod and container and returns stdout/stderr. If containerName is empty, it will auto-detect the container if there is only one in the pod. If there are multiple containers, it returns an error asking to specify the container name.

func ExtractFolder

func ExtractFolder(fsys embed.FS, targetDir string) error

ExtractFolder extracts the embedded chart files to the specified target directory.

func GetKubernetesClient

func GetKubernetesClient(kubeconfigPath string) (*kubernetes.Clientset, error)

GetKubernetesClient creates a Kubernetes client from the provided kubeconfig path.

func GetNetworkFromName

func GetNetworkFromName(networkName string, networks []upcloud.Network) *upcloud.Network

GetNetworkFromName retrieves the network from the net name, returns nil if it does not exist

func GetNodeExternalIP

func GetNodeExternalIP(kubeClient *kubernetes.Clientset) (string, error)

GetNodeExternalIP returns the first ExternalIP of any node in the cluster.

func GetObjectStorageRegionFromZone

func GetObjectStorageRegionFromZone(exec commands.Executor, zone string) (string, error)

GetObjectStorageRegionFromZone retrieves the object storage region for the selected zone. First occurrence is returned

func InitHelmActionConfig

func InitHelmActionConfig(releaseName string, logFile *os.File) (*action.Configuration, error)

initHelmActionConfig initializes the Helm action configuration with the provided chart path and release name.

func MergeHelmValueFiles

func MergeHelmValueFiles(valuesFiles []string) (map[string]interface{}, error)

MergeHelmValueFiles merges multiple Helm values files into a single map. This function is used to combine values from multiple files, allowing for overrides.

func WaitForAPIServer

func WaitForAPIServer(kubeClient *kubernetes.Clientset) error

WaitForAPIServer waits for the Kubernetes API server to be ready.

func WaitForLoadBalancer

func WaitForLoadBalancer(kubeClient *kubernetes.Clientset, namespace, serviceName string, maxRetries int, sleepInterval time.Duration) (string, error)

WaitForLoadBalancer waits for a Kubernetes LoadBalancer service to become available and returns its hostname.

func WaitForManagedObjectStorageState

func WaitForManagedObjectStorageState(uuid string, state upcloud.ManagedObjectStorageOperationalState, exec commands.Executor, msg string)

waitForManagedObjectState waits for database to reach given state and updates progress message with key matching given msg. Finally, progress message is updated back to given msg and either done state or timeout warning.

func WriteKubeconfigToFile

func WriteKubeconfigToFile(exec commands.Executor, clusterID string, configDir string) (string, error)

WriteKubeconfigToFile retrieves the kubeconfig for the given cluster and writes it to a file

Types

type StackType

type StackType string
const (
	StackTypeDokku      StackType = "dokku"
	StackTypeSupabase   StackType = "supabase"
	StackTypeStarterKit StackType = "starter-kit"
)

type Version

type Version string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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