config

package
v0.0.0-...-603c858 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AWSAccessKey,
	AWSSecretKey,
	AWSSessionToken,
	AWSRegion string
)
View Source
var ConfigFilePath string
View Source
var (
	HetznerAPIToken,
	HetznerRobotUser,
	HetznerRobotPassword string
)
View Source
var ParsedConfig = &Config{}
View Source
var SampleConfigs embed.FS

Functions

func GenerateSampleConfig

func GenerateSampleConfig(ctx context.Context, cloudProvider string)

func InitConfig

func InitConfig()

Read config file from the given file path. Then, parse and validate it.

func ParseConfig

func ParseConfig(ctx context.Context, configAsString string)

func RegisterAWSCredentialsFlags

func RegisterAWSCredentialsFlags(command *cobra.Command)

func RegisterConfigFilePathFlag

func RegisterConfigFilePathFlag(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 AMIConfig

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

AWS specific.

type AWSConfig

type AWSConfig struct {
	Credentials AWSCredentials

	Region         string             `yaml:"region"`
	BastionEnabled bool               `yaml:"bastionEnabled" default:"True"`
	ControlPlane   ControlPlaneConfig `yaml:"controlPlane" validate:"required"`
	NodeGroups     []NodeGroups       `yaml:"nodeGroups" validate:"required"`
	SSHKeyName     string             `yaml:"sshKeyName" validate:"required,notblank"`

	DisasterRecovery *AWSDisasterRecoveryConfig `yaml:"disasterRecovery"`
}

AWS specific.

type AWSCredentials

type AWSCredentials struct {
	AWSAccessKey    string `validate:"required,notblank"`
	AWSSecretKey    string `validate:"required,notblank"`
	AWSSessionToken string
	AWSRegion       string `validate:"required,notblank"`
}

AWS specific.

type AWSDisasterRecoveryConfig

type AWSDisasterRecoveryConfig struct {
	VeleroBackupsS3BucketName       string `yaml:"veleroBackupsS3BucketName" validate:"required,notblank"`
	SealedSecretsBackupS3BucketName string `yaml:"sealedSecretsBackupS3BucketName" validate:"required,notblank"`
}

AWS specific.

type AzureConfig

type AzureConfig struct{}

Azure specific.

type CloudConfig

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

type ClusterConfig

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

type Config

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

type ControlPlaneConfig

type ControlPlaneConfig struct {
	Replicas     int       `yaml:"replicas" validate:"required"`
	InstanceType string    `yaml:"instanceType" validate:"required,notblank"`
	AMI          AMIConfig `yaml:"ami" validate:"required"`
}

AWS specific.

type ForksConfig

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

type GitConfig

type GitConfig struct {
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	SSHPrivateKey   string `yaml:"sshPrivateKey"`
	UseSSHAgentAuth bool   `yaml:"useSSHAgentAuth"`
}

type HetznerConfig

type HetznerConfig struct {
	Credentials HetznerCredentials

	// Robot is Hetzner's administration panel for dedicated root servers, colocation, Storage Boxes,
	// and domains (via the Domain Registration Robot add-on).
	RobotSSHKeyPair SSHKeyPairConfig `yaml:"robotSSHKey" validate:"required"`

	ControlPlaneEndpoint string                        `yaml:"controlPlaneEndpoint" validate:"required,notblank"`
	BareMetalNodes       map[string]HetznerNodeConfigs `yaml:"bareMetalNodes" validate:"required"`
}

Hetzner specific.

type HetznerCredentials

type HetznerCredentials struct {
	HetznerAPIToken      string `validate:"required,notblank"`
	HetznerRobotUser     string `validate:"required,notblank"`
	HetznerRobotPassword string `validate:"required,notblank"`
}

Hetzner specific.

type HetznerNodeConfigs

type HetznerNodeConfigs struct {
	Name string   `yaml:"name" validate:"required,notblank"`
	WWN  []string `yaml:"wwn" validate:"required,notblank"` // World Wide Name, a unique identifier.
}

Hetzner 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 NodeGroups

type NodeGroups struct {
	Name           string            `yaml:"name" validate:"required,notblank"`
	Replicas       int               `yaml:"replicas" validate:"required"`
	InstanceType   string            `yaml:"instanceType" validate:"required,notblank"`
	SSHKeyName     string            `yaml:"sshKeyName" validate:"required,notblank"`
	AMI            AMIConfig         `yaml:"ami" validate:"required"`
	RootVolumeSize int               `yaml:"rootVolumeSize" validate:"required"`
	Labels         map[string]string `yaml:"labels" default:"[]"`
	Taints         []*coreV1.Taint   `yaml:"taints" default:"[]"`
}

AWS specific.

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"`
}

Jump to

Keyboard shortcuts

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