config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParsedGeneralConfig = &GeneralConfig{}
	ParsedSecretsConfig = &SecretsConfig{}
)
View Source
var AWSAccessKeyID,
	AWSSecretAccessKey,
	AWSSessionToken string
View Source
var AzureClientSecret string
View Source
var ConfigsDirectory string
View Source
var HetznerAPIToken,
	HetznerRobotUsername,
	HetznerRobotPassword string
View Source
var SampleConfigs embed.FS

Functions

func GenerateSampleConfig

func GenerateSampleConfig(ctx context.Context, cloudProvider string)

func NewAWSCloudProvider

func NewAWSCloudProvider() cloud.CloudProvider

func NewAzureCloudProvider

func NewAzureCloudProvider() cloud.CloudProvider

func ParseConfigFiles added in v0.7.2

func ParseConfigFiles(ctx context.Context, configsDirectory string)

func RegisterAWSCredentialsFlags

func RegisterAWSCredentialsFlags(command *cobra.Command)

func RegisterAzureCredentialsFlags

func RegisterAzureCredentialsFlags(command *cobra.Command)

func RegisterConfigsDirectoryFlag added in v0.7.2

func RegisterConfigsDirectoryFlag(command *cobra.Command)

func RegisterHetznerCredentialsFlags

func RegisterHetznerCredentialsFlags(command *cobra.Command)

func ValidateK8sVersion

func ValidateK8sVersion(ctx context.Context, k8sVersion string)

Checks whether the given string represents a valid and supported Kubernetes version or not. If not, then panics.

Types

type AADApplication

type AADApplication struct {
	Name               string `yaml:"name"               validate:"required,notblank"`
	ObjectID           string `yaml:"objectID"           validate:"required,notblank"`
	ServicePrincipalID string `yaml:"servicePrincipalID" validate:"required,notblank"`
}

Azure specific.

type AMIConfig

type AMIConfig struct {
	ID string `yaml:"id" validate:"required,notblank"`
}

AWS specific.

type APIServerConfig

type APIServerConfig struct {
	ExtraArgs    map[string]string     `yaml:"extraArgs"    default:"{}"`
	ExtraVolumes []HostPathMountConfig `yaml:"extraVolumes" default:"[]"`
	Files        []FileConfig          `yaml:"files"        default:"[]"`
}

REFER : https://github.com/kubernetes-sigs/cluster-api/blob/main/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml.

NOTE : Generally, refer to the KubeadmControlPlane CRD instead of the corresponding GoLang

source types linked below.
There are some configuration options which appear in the corresponding GoLang source
type, but not in the CRD. If you set those fields, then they get removed by the Kubeadm
control-plane provider. This causes the capi-cluster ArgoCD App to always be in an
OutOfSync state, resulting to the KubeAid Bootstrap Script not making any progress!

type AWSConfig

type AWSConfig struct {
	Region string `yaml:"region" validate:"required,notblank"`

	SSHKeyName     string          `yaml:"sshKeyName"     validate:"required,notblank"`
	VPCID          *string         `yaml:"vpcID"`
	BastionEnabled bool            `yaml:"bastionEnabled"                              default:"True"`
	ControlPlane   AWSControlPlane `yaml:"controlPlane"   validate:"required"`
	NodeGroups     []AWSNodeGroup  `yaml:"nodeGroups"     validate:"required"`
}

AWS specific.

type AWSControlPlane

type AWSControlPlane struct {
	LoadBalancerScheme string    `yaml:"loadBalancerScheme" default:"internet-facing" validate:"required,notblank"`
	Replicas           uint32    `yaml:"replicas"                                     validate:"required"`
	InstanceType       string    `yaml:"instanceType"                                 validate:"required,notblank"`
	AMI                AMIConfig `yaml:"ami"                                          validate:"required"`
}

AWS specific.

type AWSCredentials

type AWSCredentials struct {
	AWSAccessKeyID     string `yaml:"accessKeyID"     validate:"required,notblank"`
	AWSSecretAccessKey string `yaml:"secretAccessKey" validate:"required,notblank"`
	AWSSessionToken    string `yaml:"sessionToken"`
}

type AWSNodeGroup

type AWSNodeGroup struct {
	NodeGroup `yaml:",inline"`

	AMI            AMIConfig `yaml:"ami"            validate:"required"`
	InstanceType   string    `yaml:"instanceType"   validate:"required,notblank"`
	RootVolumeSize uint32    `yaml:"rootVolumeSize" validate:"required"`
	SSHKeyName     string    `yaml:"sshKeyName"     validate:"required,notblank"`
}

AWS specific.

type AzureConfig

type AzureConfig struct {
	TenantID       string         `yaml:"tenantID"       validate:"required,notblank"`
	SubscriptionID string         `yaml:"subscriptionID" validate:"required,notblank"`
	AADApplication AADApplication `yaml:"aadApplication" validate:"required"`
	Location       string         `yaml:"location"       validate:"required,notblank"`

	StorageAccount string `yaml:"storageAccount" validate:"required,notblank"`

	WorkloadIdentity WorkloadIdentity `yaml:"workloadIdentity" validate:"required"`

	SSHPublicKey string `yaml:"sshPublicKey" validate:"required,notblank"`

	ImageID *string `yaml:"imageID" validate:"notblank"`

	ControlPlane AzureControlPlane `yaml:"controlPlane" validate:"required"`
	NodeGroups   []AzureNodeGroup  `yaml:"nodeGroups"   validate:"required,gt=0"`
}

Azure specific.

type AzureControlPlane

type AzureControlPlane struct {
	LoadBalancerType string `yaml:"loadBalancerType" validate:"required,notblank" default:"Public"`
	DiskSizeGB       uint32 `yaml:"diskSizeGB"       validate:"required,gt=100"`
	VMSize           string `yaml:"vmSize"           validate:"required,notblank"`
	Replicas         uint32 `yaml:"replicas"         validate:"required,gt=0"`
}

Azure specific.

type AzureCredentials added in v0.7.2

type AzureCredentials struct {
	ClientID     string `yaml:"clientID"     validate:"required,notblank"`
	ClientSecret string `yaml:"clientSecret" validate:"required,notblank"`
}

type AzureNodeGroup

type AzureNodeGroup struct {
	NodeGroup `yaml:",inline"`

	VMSize     string `yaml:"vmSize"     validate:"required,notblank"`
	DiskSizeGB uint32 `yaml:"diskSizeGB" validate:"required"`
}

Azure specific.

type CloudConfig

type CloudConfig struct {
	AWS     *AWSConfig     `yaml:"aws"`
	Hetzner *HetznerConfig `yaml:"hetzner"`
	Azure   *AzureConfig   `yaml:"azure"`
	Local   *LocalConfig   `yaml:"local"`

	DisasterRecovery *DisasterRecoveryConfig `yaml:"disasterRecovery"`
}

type ClusterConfig

type ClusterConfig struct {
	Name           string `yaml:"name"           validate:"required,notblank"`
	K8sVersion     string `yaml:"k8sVersion"     validate:"required,notblank"`
	KubeaidVersion string `yaml:"kubeaidVersion" validate:"required,notblank"`

	EnableAuditLogging bool `yaml:"enableAuditLogging" default:"True"`

	APIServer APIServerConfig `yaml:"apiServer"`

	AdditionalUsers []UserConfig `yaml:"additionalUsers"`
}

type DisasterRecoveryConfig added in v0.9.0

type DisasterRecoveryConfig struct {
	VeleroBackupsBucketName        string `yaml:"veleroBackupsBucketName"        validate:"required,notblank"`
	SealedSecretsBackupsBucketName string `yaml:"sealedSecretsBackupsBucketName" validate:"required,notblank"`
}

type FileConfig

type FileConfig struct {
	Path    string `yaml:"path"    validate:"required,notblank"`
	Content string `yaml:"content" validate:"required,notblank"`
}

REFER : "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1".File

type ForksConfig

type ForksConfig struct {
	KubeaidForkURL       string `yaml:"kubeaid"       default:"https://github.com/Obmondo/KubeAid"`
	KubeaidConfigForkURL string `yaml:"kubeaidConfig"                                              validate:"required,notblank"`
}

type GeneralConfig added in v0.7.2

type GeneralConfig struct {
	CustomerID string           `yaml:"customerID"`
	Git        GitConfig        `yaml:"git"`
	Cluster    ClusterConfig    `yaml:"cluster"    validate:"required"`
	Forks      ForksConfig      `yaml:"forkURLs"   validate:"required"`
	Cloud      CloudConfig      `yaml:"cloud"      validate:"required"`
	Monitoring MonitoringConfig `yaml:"monitoring"`
}

type GitConfig

type GitConfig struct {
	CABundlePath string `yaml:"caBundlePath" validate:"notblank"`
	CABundle     []byte `yaml:"caBundle"`

	UseSSHAgentAuth bool `yaml:"useSSHAgentAuth"`
}

type GitCredentials added in v0.7.2

type GitCredentials struct {
	Username      string `yaml:"username"`
	Password      string `yaml:"password"`
	SSHPrivateKey string `yaml:"sshPrivateKey"`
}

type HCloud

type HCloud struct {
	SSHKeyName   string             `yaml:"sshKeyName"   validate:"required,notblank"`
	Enabled      bool               `yaml:"enabled"`
	ControlPlane HCloudControlPlane `yaml:"controlPlane"`
	NodeGroups   []HCloudNodeGroup  `yaml:"nodeGroups"`
}

Hetzner specific.

type HCloudControlPlane

type HCloudControlPlane struct {
	LoadBalancer HetznerControlPlaneLoadBalancer `yaml:"loadBalancer"`
	Regions      []string                        `yaml:"regions"`
	MachineType  string                          `yaml:"machineType"  validate:"required,notblank"`
	Replicas     int                             `yaml:"replicas"     validate:"required"`
}

Hetzner specific.

type HCloudNodeGroup

type HCloudNodeGroup struct {
	NodeGroup `yaml:",inline"`

	FailureDomain string                  `yaml:"failureDomain" validate:"required,notblank"`
	SSHKeys       []HCloudNodeGroupSSHKey `yaml:"sshKeys"       validate:"required"`
}

Hetzner specific.

type HCloudNodeGroupSSHKey

type HCloudNodeGroupSSHKey struct {
	Name string `yaml:"name" validate:"required,notblank"`
}

Hetzner specific.

type HetznerBareMetal

type HetznerBareMetal struct {
	Enabled         bool                         `yaml:"enabled"      validate:"required"`
	RobotSSHKeyPair SSHKeyPairConfig             `yaml:"robotSSHKey"  validate:"required"`
	ControlPlane    HetznerBareMetalControlPlane `yaml:"controlPlane"`
	NodeGroups      []HetznerBareMetalNodeGroup  `yaml:"nodeGroups"`
}

Hetzner specific.

type HetznerBareMetalControlPlane

type HetznerBareMetalControlPlane struct {
	Endpoint HetznerControlPlaneEndpoint `yaml:"endpoint" validate:"required,notblank"`
	Nodes    []HetznerBareMetalNode      `yaml:"nodes"`
}

Hetzner specific.

type HetznerBareMetalNode

type HetznerBareMetalNode struct {
	Name string `yaml:"name" validate:"required,notblank"`

	// WWN (World Wide Name) is the unique identifier.
	WWN []string `yaml:"wwn" validate:"required,notblank"`
}

Hetzner specific.

type HetznerBareMetalNodeGroup

type HetznerBareMetalNodeGroup struct {
	NodeGroup `yaml:",inline"`

	Nodes []HetznerBareMetalNode `yaml:"nodes" validate:"required"`
}

Hetzner specific.

type HetznerConfig

type HetznerConfig struct {
	HCloud           HCloud            `yaml:"hcloud" validate:"required"`
	HetznerBareMetal *HetznerBareMetal `yaml:"robot"`
}

Hetzner specific.

type HetznerControlPlaneEndpoint

type HetznerControlPlaneEndpoint struct {
	Host string `yaml:"host" validate:"required,notblank"`
	Port int    `yaml:"port"`
}

Hetzner specific.

type HetznerControlPlaneLoadBalancer

type HetznerControlPlaneLoadBalancer struct {
	Enabled bool   `yaml:"enabled" validate:"required"`
	Region  string `yaml:"region"  validate:"required,notblank"`
}

Hetzner specific.

type HetznerCredentials

type HetznerCredentials struct {
	HetznerAPIToken      string `yaml:"apiToken"      validate:"required,notblank"`
	HetznerRobotUsername string `yaml:"robotUsername" validate:"required,notblank"`
	HetznerRobotPassword string `yaml:"robotPassword" validate:"required,notblank"`
}

type HostPathMountConfig

type HostPathMountConfig struct {
	Name      string              `yaml:"name"      validate:"required,notblank"`
	HostPath  string              `yaml:"hostPath"  validate:"required,notblank"`
	MountPath string              `yaml:"mountPath" validate:"required,notblank"`
	PathType  coreV1.HostPathType `yaml:"pathType"  validate:"required"`

	/*
		Whether the mount should be read-only or not.
		Defaults to true.

		NOTE : If you want the mount to be read-only, then set this true.
		       Otherwise, omit setting this field. It gets removed by the Kubeadm control-plane
		       provider component, which results to the capi-cluster ArgoCD App always being in
		       OutOfSync state.
	*/
	ReadOnly bool `yaml:"readOnly,omitempty"`
}

REFER : "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1".HostPathMount

type LocalConfig

type LocalConfig struct{}

Local specific.

type MonitoringConfig

type MonitoringConfig struct {
	KubePrometheusVersion string `yaml:"kubePrometheusVersion" default:"v0.14.0"`
	GrafanaURL            string `yaml:"grafanaURL"`
	ConnectObmondo        bool   `yaml:"connectObmondo"        default:"False"`
}

type NodeGroup

type NodeGroup struct {
	Name string `yaml:"name" validate:"required,notblank"`

	CPU    uint32 `validate:"required"`
	Memory uint32 `validate:"required"`

	MinSize uint `yaml:"minSize" validate:"required"`
	Maxsize uint `yaml:"maxSize" validate:"required"`

	Labels map[string]string `yaml:"labels" default:"[]"`
	Taints []*coreV1.Taint   `yaml:"taints" default:"[]"`
}

type SSHKeyPairConfig

type SSHKeyPairConfig struct {
	PublicKeyFilePath string `yaml:"publicKeyFilePath" validate:"required,notblank"`
	PublicKey         string `                         validate:"required,notblank"`

	PrivateKeyFilePath string `yaml:"privateKeyFilePath" validate:"required,notblank"`
	PrivateKey         string `                          validate:"required,notblank"`
}

type SecretsConfig added in v0.7.2

type SecretsConfig struct {
	Git     GitCredentials      `yaml:"git"`
	AWS     *AWSCredentials     `yaml:"aws"`
	Azure   *AzureCredentials   `yaml:"azure"`
	Hetzner *HetznerCredentials `yaml:"hetzner"`
}

type UserConfig

type UserConfig struct {
	Name         string `yaml:"name"         validate:"required"`
	SSHPublicKey string `yaml:"sshPublicKey" validate:"required"`
}

type WorkloadIdentity

type WorkloadIdentity struct {
	OpenIDProviderSSHKeyPair SSHKeyPairConfig `yaml:"openIDProviderSSHKeyPair" validate:"required,notblank"`
}

Azure specific.

Jump to

Keyboard shortcuts

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