Documentation
¶
Index ¶
- func ApplyComponentYAML(component, kubeconfigPath, manifest string, logger *utils.Logger, ...)
- func ApplySubstitutions(data []byte, substitutions map[string]string) []byte
- func ApplyYAMLManifest(kubeconfigPath, manifestPathOrURL string, logger *utils.Logger, ...) error
- func BuildSubstitutions(pairs ...string) map[string]string
- func DeleteComponentYAML(component, kubeconfigPath, manifest string, logger *utils.Logger, ...)
- func DeleteYAMLManifest(kubeconfigPath, manifestPathOrURL string, logger *utils.Logger, ...) error
- func EnsureNamespace(kubeconfigPath, namespace string, logger *utils.Logger)
- func ExecuteCommands(client *ssh.Client, commands []string, password string, logger *utils.Logger) error
- func ExecuteRemoteScript(client *ssh.Client, script string, logger *utils.Logger) (string, error)
- func ForEachWorker(workers []types.Worker, fn func(*types.Worker) error) error
- func GetManifestData(manifestPathOrURL string) ([]byte, error)
- func InstallHelmChart(...) error
- func KubeConfigPath(cluster *types.Cluster, logger *utils.Logger) string
- func LabelNode(kubeconfigPath, nodeName string, labels string, logger *utils.Logger) error
- func PipeAndApply(cmd *exec.Cmd, kubeconfig string, logger *utils.Logger)
- func PipeAndDelete(cmd *exec.Cmd, kubeconfig string, logger *utils.Logger)
- func PipeAndLog(cmd *exec.Cmd, logger *utils.Logger)
- func RenameKubeconfigContext(kubeconfigPath, oldContext, newContext string, logger *utils.Logger)
- func ResolveYamlPath(filename string) string
- func SSHConnect(userName, password, host string) (*ssh.Client, error)
- func SplitYAMLDocs(data []byte) []string
- func StreamOutput(r io.Reader, isErr bool, logger *utils.Logger)
- func UninstallHelmRelease(kubeconfigPath, releaseName, namespace string, logger *utils.Logger) error
- func WaitForDeploymentReady(kubeconfigPath, deployment, namespace string, logger *utils.Logger)
- type AddonMigrationStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyComponentYAML ¶
func ApplyComponentYAML(component, kubeconfigPath, manifest string, logger *utils.Logger, substitutions map[string]string)
ApplyComponentYAML applies a YAML manifest for a given component to the cluster. It logs the operation and any errors encountered.
Parameters:
component: Name of the component being applied. kubeconfigPath: Path to the kubeconfig file. manifest: Path or URL to the manifest YAML. logger: Logger for output. substitutions: Map of string substitutions to apply to the manifest.
func ApplySubstitutions ¶
func ApplyYAMLManifest ¶
func BuildSubstitutions ¶
func DeleteComponentYAML ¶ added in v1.0.29
func DeleteComponentYAML(component, kubeconfigPath, manifest string, logger *utils.Logger, substitutions map[string]string)
DeleteComponentYAML deletes a YAML manifest for a given component from the cluster. It logs the operation and any errors encountered.
func DeleteYAMLManifest ¶ added in v1.0.29
func DeleteYAMLManifest(kubeconfigPath, manifestPathOrURL string, logger *utils.Logger, substitutions map[string]string) error
DeleteYAMLManifest deletes the resources defined in a manifest from the cluster using kubectl delete -f.
func EnsureNamespace ¶
func ExecuteCommands ¶
func ExecuteCommands(client *ssh.Client, commands []string, password string, logger *utils.Logger) error
ExecuteCommands runs a list of shell commands on the remote host via SSH.
Parameters:
client: SSH client. commands: List of shell commands to execute. password: Password for sudo commands (optional). logger: Logger for output.
Returns:
Error if any command fails.
func ExecuteRemoteScript ¶
ExecuteRemoteScript runs a shell script on the remote host via SSH and returns its output.
Parameters:
client: SSH client. script: Shell script to execute. logger: Logger for output.
Returns:
Output string and error if execution fails.
func GetManifestData ¶
func InstallHelmChart ¶
func InstallHelmChart(kubeconfigPath, releaseName, namespace, repoName, repoURL, chartName, chartVersion, valuesFile string, logger *utils.Logger) error
InstallHelmChart installs or upgrades a Helm chart on the cluster using the provided parameters. It adds the repo, updates it, and runs the upgrade/install command.
Parameters:
kubeconfigPath: Path to the kubeconfig file. releaseName: Name of the Helm release. namespace: Kubernetes namespace for the release. repoName: Name of the Helm repo. repoURL: URL of the Helm repo. chartName: Name of the chart in the repo. chartVersion: Version of the chart to install. valuesFile: Path to a values.yaml file (optional). logger: Logger for output.
Returns:
Error if any Helm operation fails.
func KubeConfigPath ¶
KubeConfigPath returns the path to the kubeconfig file for the given cluster and logger session.
Parameters:
cluster: The cluster for which to get the kubeconfig path. logger: Logger (used for session ID).
Returns:
Path to the kubeconfig YAML file.
func PipeAndDelete ¶ added in v1.0.29
PipeAndDelete pipes the output of a command to 'kubectl delete -f -' using the given kubeconfig. Used for uninstalling resources generated by CLI tools like linkerd.
func RenameKubeconfigContext ¶ added in v1.0.22
func ResolveYamlPath ¶
func SSHConnect ¶
SSHConnect establishes an SSH connection to the given host using username and password or available private keys.
Parameters:
userName: SSH username. password: SSH password (optional if key is available). host: Hostname or IP address.
Returns:
SSH client and error if connection fails.
func SplitYAMLDocs ¶
func UninstallHelmRelease ¶ added in v1.0.29
func UninstallHelmRelease(kubeconfigPath, releaseName, namespace string, logger *utils.Logger) error
UninstallHelmRelease uninstalls a Helm release from the given namespace.
Parameters:
kubeconfigPath: Path to the kubeconfig file. releaseName: Name of the Helm release to uninstall. namespace: Kubernetes namespace of the release. logger: Logger for output.
Returns:
Error if the Helm uninstall command fails.
func WaitForDeploymentReady ¶
WaitForDeploymentReady waits until the specified deployment exists and is ready in the given namespace. It checks for deployment existence, then waits for rollout status.
Parameters:
kubeconfigPath: Path to the kubeconfig file. deployment: Name of the deployment to check. namespace: Kubernetes namespace. logger: Logger for output.
Types ¶
type AddonMigrationStatus ¶ added in v1.0.29
type AddonMigrationStatus int
AddonMigrationStatus represents the migration status of an addon (noop, apply, delete).
const ( // AddonNoop indicates no migration action is needed for the addon. AddonNoop AddonMigrationStatus = iota // AddonApply indicates the addon should be applied (installed or upgraded). AddonApply // AddonDelete indicates the addon should be deleted (uninstalled). AddonDelete )