config

package
v0.0.0-...-723a762 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindFluxVersion = "2.2.2"
	FluxNamespace   = "flux-system"

	// https://github.blog/changelog/2022-01-18-githubs-ssh-host-keys-are-now-published-in-the-api/
	// curl -H "Accept: application/vnd.github.v3+json" -s https://api.github.com/meta | jq -r '.ssh_keys'
	// select the one that starts with "ecdsa-sha2-nistp256"
	GithubKnownHosts = "" /* 171-byte string literal not displayed */

	// Cluster names and contexts
	// CURRENT   NAME                              CLUSTER         AUTHINFO             NAMESPACE
	//           cluster-mgmt-admin@cluster-mgmt   cluster-mgmt    cluster-mgmt-admin
	//           kind-tmp-mgmt                     kind-tmp-mgmt   kind-tmp-mgmt
	DefaultKindClusterName    = "tmp-mgmt"
	DefaultKindClusterCtxName = "kind-tmp-mgmt"
	DefaultCAPIClusterNameTpl = "cluster-{{.Name}}"
	DefaultCAPIContextNameTpl = "cluster-{{.Name}}-admin@cluster-{{.Name}}"
)

Variables

View Source
var ProjectNamespaces = []string{FluxNamespace, "caaph-system"}

Functions

This section is empty.

Types

type AWSConfig

type AWSConfig struct {
	SSHKeyName string `mapstructure:"sshKeyName"`
	Region     string `mapstructure:"region"`
}

type CNIConfig

type CNIConfig struct {
	Type   string `mapstructure:"type"`
	Config string `mapstructure:"config"`
}

type ClusterConfig

type ClusterConfig struct {
	Name              string     `mapstructure:"name"`
	Provider          string     `mapstructure:"provider"`
	KubernetesVersion string     `mapstructure:"kubernetesVersion"`
	PodCIDR           string     `mapstructure:"podCIDR"`
	ManagementCluster string     `mapstructure:"managementCluster"`
	Flux              FluxConfig `mapstructure:"flux"`
	CNI               CNIConfig  `mapstructure:"cni"`
	AWS               AWSConfig  `mapstructure:"aws"`
}

func GetCapiClusterConfig

func GetCapiClusterConfig(clusterName string) ClusterConfig

TODO - this is a terrible terrible name. "ClusterConfig" here comes from the config of this app, but this misleading because CAPI client also has a config file TODO - also we might want to store the clusterName and context name inside this config instead of keeping it in stray variables and passing around.

type Config

type Config struct {
	Clusters       []ClusterConfig
	Github         GithubConfig `mapstructure:"github"`
	KubeconfigPath string       `mapstructure:"kubeconfigPath"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

type FluxConfig

type FluxConfig struct {
	KeyPath   string `mapstructure:"keyPath"`
	Version   string `mapstructure:"version"`
	Namespace string `mapstructure:"namespace"`
}

type GithubConfig

type GithubConfig struct {
	User             string `mapstructure:"user"`
	Branch           string `mapstructure:"branch"`
	RepoName         string `mapstructure:"repoName"`
	URL              string
	GithubKnownHosts string
}

TODO - URL and GithubKnownHosts are not expected to be provided by the user Is there a pattern to manage a data type where fields exposed to the user while others are used by other packages in the app, but preset with calculated const or default values

Jump to

Keyboard shortcuts

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