utils

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// File name for the ansible inventory.
	InventoryFileName = "inventory.ini"
)

Variables

This section is empty.

Functions

func ChangeAPIEndpoint

func ChangeAPIEndpoint(clusterName, oldEndpoint, newEndpoint, directory string, spawnProcessLimit *semaphore.Weighted) error

ChangeAPIEndpoint will change the kubeadm configuration. It will set the Api endpoint of the cluster to the public IP of the newly selected ApiEndpoint node.

func GenerateInventoryFile

func GenerateInventoryFile(inventoryTemplate, outputDirectory string, data interface{}) error

GenerateInventoryFile generates an Ansible inventory file that defines the hosts and groups of hosts that Ansible can manage.

func GenerateLBBaseFiles

func GenerateLBBaseFiles(outputDirectory string, lbClustersInfo *LBClustersInfo) error

GenerateLBBaseFiles generates the files like Ansible inventory file and SSH keys to be used by Ansible. Returns error if not successful, nil otherwise

Types

type Ansible

type Ansible struct {
	Playbook  string
	Inventory string
	Flags     string
	Directory string
	// SpawnProcessLimit limits the number of spawned ansible processes.
	SpawnProcessLimit *semaphore.Weighted
}

func (*Ansible) RunAnsiblePlaybook

func (a *Ansible) RunAnsiblePlaybook(prefix string) error

RunAnsiblePlaybook executes ansible-playbook with the default forks of defaultAnsibleForks any additional flags like -l <name>, or --extra-vars <vars> include in flags parameter if command unsuccessful, the function will retry it until successful or maxAnsibleRetries reached all commands are executed with ANSIBLE_HOST_KEY_CHECKING set to false

type LBClusterRolesInfo

type LBClusterRolesInfo struct {
	Role        *spec.Role
	TargetNodes []*spec.Node
}

type LBClustersInfo

type LBClustersInfo struct {
	// LbClusters are Load-Balancers that share the targeted k8s cluster.
	Lbs []*spec.LBcluster
	// TargetK8sNodepool are all nodepools used by the targeted k8s cluster.
	TargetK8sNodepool []*spec.NodePool
	// ClusterID contains the ClusterName-Hash- prefix of the kubernetes cluster
	ClusterID string
}

LBClustersInfo wraps all Load-balancers and Nodepools used for a single K8s cluster.

type LBInventoryFileParameters

type LBInventoryFileParameters struct {
	K8sNodepools NodePools
	LBClusters   []LBcluster
	ClusterID    string
}

type LBPlaybookParameters

type LBPlaybookParameters struct {
	Loadbalancer string
}

type LBcluster

type LBcluster struct {
	Name        string
	Hash        string
	LBnodepools NodePools
}

type NginxConfigTemplateParameters

type NginxConfigTemplateParameters struct {
	Roles []LBClusterRolesInfo
}

type NodePools

type NodePools struct {
	Dynamic []*spec.NodePool
	Static  []*spec.NodePool
}

type ProxyInventoryFileParameters added in v0.9.1

type ProxyInventoryFileParameters struct {
	K8sNodepools NodePools
	ClusterID    string
	NoProxyList  string
	HttpProxyUrl string
}

Jump to

Keyboard shortcuts

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