Documentation
¶
Index ¶
- Constants
- func SetSystemEnv(key, value string)
- type Argument
- func (a *Argument) GetWslUserPath() string
- func (a *Argument) LoadMasterHostConfigIfAny() error
- func (a *Argument) LoadReleaseInfo() error
- func (a *Argument) SaveReleaseInfo(withoutName bool) error
- func (a *Argument) SetBaseDir(dir string)
- func (a *Argument) SetConsoleLog(fileName string, truncate bool)
- func (a *Argument) SetCudaVersion(cudaVersion string)
- func (a *Argument) SetDeleteCRI(deleteCRI bool)
- func (a *Argument) SetGPU(enable bool)
- func (a *Argument) SetKubeVersion(kubeType string)
- func (a *Argument) SetKubernetesVersion(kubeType string, kubeVersion string)
- func (a *Argument) SetManifest(manifest string)
- func (a *Argument) SetMasterHostOverride(config MasterHostConfig)
- func (a *Argument) SetMinikubeProfile(profile string)
- func (a *Argument) SetOlaresCDNService(url string)
- func (a *Argument) SetOlaresVersion(version string)
- func (a *Argument) SetRegistryMirrors(registryMirrors string)
- func (a *Argument) SetStorage(storage *Storage)
- func (a *Argument) SetSwapConfig(config SwapConfig)
- func (a *Argument) SetWSLDistribution(distribution string)
- type CommandLineLoader
- type ConfigMapLoader
- type DefaultLoader
- type EnableKubeProxy
- type ExtraAddon
- type FileLoader
- type GPU
- type IsMaster
- type IsWorker
- type KubeAction
- type KubeConf
- type KubeCustomModule
- type KubeModule
- type KubePrepare
- type KubeRollback
- type KubeRuntime
- type Loader
- type LocalRuntime
- type MasterHostConfig
- type NetworkSettings
- type OnlyETCD
- type OnlyFirstMaster
- type OnlyK3s
- type OnlyKubernetes
- type OnlyWorker
- type Options
- type Storage
- type SwapConfig
- type User
Constants ¶
View Source
const ( DefaultK8sVersion = "v1.33.3" DefaultK3sVersion = "v1.33.3-k3s" DefaultKubernetesVersion = "" DefaultKubeSphereVersion = "v3.3.0" CurrentVerifiedCudaVersion = "13.1" )
View Source
const ( K3s = "k3s" K8e = "k8e" Kubernetes = "kubernetes" LocalHost = "localhost" AllInOne = "allInOne" File = "file" Operator = "operator" CommandLine = "commandLine" Master = "master" Worker = "worker" ETCD = "etcd" K8s = "k8s" Registry = "registry" KubeKey = "kubekey" Harbor = "harbor" DockerCompose = "compose" KubeBinaries = "KubeBinaries" WslBinaries = "WslBinaries" WslUbuntuBinaries = "WslUbuntuBinaries" RootDir = "/" TmpDir = "/tmp/kubekey" BinDir = "/usr/local/bin" KubeConfigDir = "/etc/kubernetes" KubeAddonsDir = "/etc/kubernetes/addons" KubeEtcdCertDir = "/etc/kubernetes/etcd" KubeCertDir = "/etc/kubernetes/pki" KubeManifestDir = "/etc/kubernetes/manifests" KubeScriptDir = "/usr/local/bin/kube-scripts" KubeletFlexvolumesPluginsDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec" K3sImageDir = "/var/lib/images" MinikubeDefaultProfile = "olares-0" MinikubeEtcdCertDir = "/var/lib/minikube/certs/etcd" WSLDefaultDistribution = "Ubuntu" RunLockDir = "/var/run/lock" InstallerScriptsDir = "scripts" ETCDCertDir = "/etc/ssl/etcd/ssl" RegistryCertDir = "/etc/ssl/registry/ssl" HaproxyDir = "/etc/kubekey/haproxy" IPv4Regexp = "[\\d]+\\.[\\d]+\\.[\\d]+\\.[\\d]+" IPv6Regexp = "[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7}" Calico = "calico" Flannel = "flannel" Cilium = "cilium" Kubeovn = "kubeovn" Docker = "docker" Crictl = "crictl" Containerd = "containerd" Crio = "crio" Isula = "isula" Runc = "runc" // global cache key // PreCheckModule NodePreCheck = "nodePreCheck" K8sVersion = "k8sVersion" // current k8s version MaxK8sVersion = "maxK8sVersion" // max k8s version of nodes KubeSphereVersion = "kubeSphereVersion" // current KubeSphere version ClusterNodeStatus = "clusterNodeStatus" ClusterNodeCRIRuntimes = "ClusterNodeCRIRuntimes" DesiredK8sVersion = "desiredK8sVersion" PlanK8sVersion = "planK8sVersion" NodeK8sVersion = "NodeK8sVersion" // ETCDModule ETCDCluster = "etcdCluster" ETCDName = "etcdName" ETCDExist = "etcdExist" // KubernetesModule ClusterStatus = "clusterStatus" ClusterExist = "clusterExist" MasterInfo = "masterInfo" // CertsModule Certificate = "certificate" CaCertificate = "caCertificate" // Artifact pipeline Artifact = "artifact" SkipMasterNodePullImages = "skipMasterNodePullImages" )
View Source
const ( Linux = "linux" Darwin = "darwin" Windows = "windows" Intel64 = "x86_64" Amd64 = "amd64" Arm = "arm" Arm7 = "arm7" Armv7l = "Armv7l" Armhf = "armhf" Arm64 = "arm64" PPC64el = "ppc64el" PPC64le = "ppc64le" S390x = "s390x" Riscv64 = "riscv64" Ubuntu = "ubuntu" Debian = "debian" CentOs = "centos" Fedora = "fedora" RHEl = "rhel" Raspbian = "raspbian" PVE = "pve" WSL = "wsl" )
View Source
const ( TRUE = "true" FALSE = "false" YES = "yes" NO = "no" )
View Source
const ( OSS = "oss" COS = "cos" S3 = "s3" MinIO = "minio" //ManagedMinIO is MinIO instance that's managed by us ManagedMinIO = "managed-minio" )
View Source
const ( OlaresRegistryMirrorHost = "mirrors.joinolares.cn" OlaresRegistryMirrorHostLegacy = "mirrors.jointerminus.cn" )
View Source
const ( RaspbianCmdlineFile = "/boot/cmdline.txt" RaspbianFirmwareFile = "/boot/firmware/cmdline.txt" )
View Source
const ( ManifestImageList = "images.mf" TerminusStateFilePrepared = ".prepared" TerminusStateFileInstalled = ".installed" MasterHostConfigFile = "master.conf" OlaresReleaseFile = "/etc/olares/release" )
View Source
const ( CommandIpset = "ipset" CommandIptables = "iptables" CommandIp6tables = "ip6tables" CommandGPG = "gpg" CommandSudo = "sudo" CommandSocat = "socat" CommandConntrack = "conntrack" CommandNtpdate = "ntpdate" CommandTimeCtl = "timedatectl" CommandHwclock = "hwclock" CommandKubectl = "kubectl" CommandDocker = "docker" CommandMinikube = "minikube" CommandUnzip = "unzip" CommandVelero = "velero" CommandUpdatePciids = "update-pciids" CommandNmcli = "nmcli" CommandZRAMCtl = "zramctl" CacheCommandKubectlPath = "kubectl_bin_path" CacheCommandMinikubePath = "minikube_bin_path" CacheCommandDockerPath = "docker_bin_path" )
View Source
const ( CacheKubeletVersion = "version_kubelet" CacheKubectlKey = "cmd_kubectl" CacheStorageVendor = "storage_vendor" CacheProxy = "proxy" CacheEnableHA = "enable_ha" CacheMasterNum = "master_num" CacheNodeNum = "node_num" CacheRedisPassword = "redis_password" CacheSecretsNum = "secrets_num" CacheCrdsNUm = "users_iam_num" CacheMinioPath = "minio_binary_path" CacheMinioDataPath = "minio_data_path" CacheMinioPassword = "minio_password" CacheMinioOperatorPath = "minio_operator_path" CacheHostRedisPassword = "hostredis_password" CacheHostRedisAddress = "hostredis_address" CachePreparedState = "prepare_state" CacheInstalledState = "install_state" CacheJuiceFsPath = "juicefs_binary_path" CacheJuiceFsFileName = "juicefs_binary_filename" CacheMinikubeNodeIp = "minikube_node_ip" CacheMinikubeTmpContainerdConfigFile = "minikube_tmp_containerd_config_file" CacheAccessKey = "storage_access_key" CacheSecretKey = "storage_secret_key" CacheToken = "storage_token" CacheClusterId = "storage_cluster_id" CacheAppServicePod = "app_service_pod_name" CacheAppValues = "app_built_in_values" CacheCountPodsWaitForRecreation = "count_pods_wait_for_recreation" CacheUpgradeUsers = "upgrade_users" CacheUpgradeAdminUser = "upgrade_admin_user" CacheWindowsDistroStoreLocation = "windows_distro_store_location" CacheWindowsDistroStoreLocationNums = "windows_distro_store_location_nums" )
View Source
const ( CacheLaunchAppKey = "launch_app_key" CacheLaunchAppSecret = "launch_app_secret" )
View Source
const ( ENV_OLARES_BASE_DIR = "OLARES_BASE_DIR" ENV_OLARES_VERSION = "OLARES_VERSION" ENV_TERMINUS_IS_CLOUD_VERSION = "TERMINUS_IS_CLOUD_VERSION" ENV_KUBE_TYPE = "KUBE_TYPE" ENV_REGISTRY_MIRRORS = "REGISTRY_MIRRORS" ENV_OLARES_CDN_SERVICE = "OLARES_SYSTEM_CDN_SERVICE" ENV_STORAGE = "STORAGE" ENV_S3_BUCKET = "S3_BUCKET" ENV_LOCAL_GPU_ENABLE = "LOCAL_GPU_ENABLE" ENV_AWS_ACCESS_KEY_ID_SETUP = "AWS_ACCESS_KEY_ID_SETUP" ENV_AWS_SECRET_ACCESS_KEY_SETUP = "AWS_SECRET_ACCESS_KEY_SETUP" ENV_AWS_SESSION_TOKEN_SETUP = "AWS_SESSION_TOKEN_SETUP" ENV_BACKUP_KEY_PREFIX = "BACKUP_KEY_PREFIX" ENV_BACKUP_SECRET = "BACKUP_SECRET" ENV_CLUSTER_ID = "CLUSTER_ID" ENV_BACKUP_CLUSTER_BUCKET = "BACKUP_CLUSTER_BUCKET" ENV_HOST_IP = "HOST_IP" ENV_PREINSTALL = "PREINSTALL" ENV_DISABLE_HOST_IP_PROMPT = "DISABLE_HOST_IP_PROMPT" ENV_AUTO_ADD_FIREWALL_RULES = "AUTO_ADD_FIREWALL_RULES" ENV_TERMINUS_OS_DOMAINNAME = "TERMINUS_OS_DOMAINNAME" ENV_DEFAULT_WSL_DISTRO_LOCATION = "DEFAULT_WSL_DISTRO_LOCATION" // If set to 1, the default WSL distro storage will be used. ENV_CONTAINER = "container" ENV_CONTAINER_MODE = "CONTAINER_MODE" // running in docker container OLARES_SYSTEM_ENV_FILENAME = "system-env.yaml" OLARES_USER_ENV_FILENAME = "user-env.yaml" )
View Source
const ( NamespaceDefault = "default" NamespaceKubeNodeLease = "kube-node-lease" NamespaceKubePublic = "kube-public" NamespaceKubeSystem = "kube-system" NamespaceKubekeySystem = "kubekey-system" NamespaceKubesphereMonitoringSystem = "kubesphere-monitoring-system" NamespaceKubesphereSystem = "kubesphere-system" NamespaceKubesphereControlsSystem = "kubesphere-controls-system" NamespaceOsFramework = "os-framework" NamespaceOsPlatform = "os-platform" ChartNameRedis = "redis" ChartNameSnapshotController = "snapshot-controller" ChartNameKsCore = "ks-core" ChartNameKsCoreConfig = "ks-core-config" ChartNameKsConfig = "ks-config" ChartNameMonitorNotification = "monitor-notification" ChartNameAccount = "account" ChartNameOSFramework = "os-framework" ChartNameOSPlatform = "os-platform" ChartNameSettings = "settings" )
View Source
const (
HelmValuesKeyOlaresRootFSPath = "rootPath"
)
Variables ¶
This section is empty.
Functions ¶
func SetSystemEnv ¶
func SetSystemEnv(key, value string)
Types ¶
type Argument ¶
type Argument struct {
NodeName string `json:"node_name"`
FilePath string `json:"file_path"`
KubernetesVersion string `json:"kubernetes_version"`
KsEnable bool `json:"ks_enable"`
KsVersion string `json:"ks_version"`
OlaresVersion string `json:"olares_version"`
Debug bool `json:"debug"`
IgnoreErr bool `json:"ignore_err"`
SkipPullImages bool `json:"skip_pull_images"`
SKipPushImages bool `json:"skip_push_images"`
SecurityEnhancement bool `json:"security_enhancement"`
DeployLocalStorage *bool `json:"deploy_local_storage"`
// DownloadCommand func(path, url string) string
SkipConfirmCheck bool `json:"skip_confirm_check"`
InCluster bool `json:"in_cluster"`
ContainerManager string `json:"container_manager"`
FromCluster bool `json:"from_cluster"`
KubeConfig string `json:"kube_config"`
Artifact string `json:"artifact"`
InstallPackages bool `json:"install_packages"`
ImagesDir string `json:"images_dir"`
Namespace string `json:"namespace"`
DeleteCRI bool `json:"delete_cri"`
Role string `json:"role"`
Type string `json:"type"`
Kubetype string `json:"kube_type"`
SystemInfo connector.Systems
// Extra args
ExtraAddon string `json:"extra_addon"` // addon yaml config
RegistryMirrors string `json:"registry_mirrors"`
OlaresCDNService string `json:"olares_cdn_service"`
// Swap config
*SwapConfig
// master node ssh config
*MasterHostConfig
LocalSSHPort int `json:"-"`
SkipMasterPullImages bool `json:"skip_master_pull_images"`
// User
User *User `json:"user"`
// if juicefs is opted off, the local storage is used directly
// only used in prepare phase
// the existence of juicefs should be checked in other phases
// to avoid wrong information given by user
WithJuiceFS bool `json:"with_juicefs"`
// the object storage service used as backend for JuiceFS
Storage *Storage `json:"storage"`
NetworkSettings *NetworkSettings `json:"network_settings"`
GPU *GPU `json:"gpu"`
Request any `json:"-"`
IsCloudInstance bool `json:"is_cloud_instance"`
MinikubeProfile string `json:"minikube_profile"`
WSLDistribution string `json:"wsl_distribution"`
Environment []string `json:"environment"`
BaseDir string `json:"base_dir"`
Manifest string `json:"manifest"`
ConsoleLogFileName string `json:"console_log_file_name"`
ConsoleLogTruncate bool `json:"console_log_truncate"`
HostIP string `json:"host_ip"`
CudaVersion string `json:"cuda_version"`
IsOlaresInContainer bool `json:"is_olares_in_container"`
}
func NewArgument ¶
func NewArgument() *Argument
func (*Argument) GetWslUserPath ¶
func (*Argument) LoadMasterHostConfigIfAny ¶
func (*Argument) LoadReleaseInfo ¶
LoadReleaseInfo loads base directory and version settings from /etc/olares/release and environment variables, with the latter takes precedence. Note that the command line options --base-dir and --version still have the highest priority and will override any values loaded here
func (*Argument) SaveReleaseInfo ¶
func (*Argument) SetBaseDir ¶
func (*Argument) SetConsoleLog ¶
func (*Argument) SetCudaVersion ¶
func (*Argument) SetDeleteCRI ¶
func (*Argument) SetKubeVersion ¶
func (*Argument) SetKubernetesVersion ¶
func (*Argument) SetManifest ¶
func (*Argument) SetMasterHostOverride ¶
func (a *Argument) SetMasterHostOverride(config MasterHostConfig)
func (*Argument) SetMinikubeProfile ¶
func (*Argument) SetOlaresCDNService ¶
func (*Argument) SetOlaresVersion ¶
func (*Argument) SetRegistryMirrors ¶
func (*Argument) SetStorage ¶
func (*Argument) SetSwapConfig ¶
func (a *Argument) SetSwapConfig(config SwapConfig)
func (*Argument) SetWSLDistribution ¶
type CommandLineLoader ¶
type CommandLineLoader struct {
// contains filtered or unexported fields
}
func NewCommandLineLoader ¶
func NewCommandLineLoader(arg Argument) *CommandLineLoader
func (*CommandLineLoader) Load ¶
func (c *CommandLineLoader) Load() (*kubekeyapiv1alpha2.Cluster, error)
type ConfigMapLoader ¶
type ConfigMapLoader struct {
}
func (ConfigMapLoader) Load ¶
func (c ConfigMapLoader) Load() (*kubekeyapiv1alpha2.Cluster, error)
type DefaultLoader ¶
type DefaultLoader struct {
KubernetesVersion string
KubeSphereVersion string
KubeSphereEnable bool
// contains filtered or unexported fields
}
func NewDefaultLoader ¶
func NewDefaultLoader(arg Argument) *DefaultLoader
func (*DefaultLoader) Load ¶
func (d *DefaultLoader) Load() (*kubekeyapiv1alpha2.Cluster, error)
type EnableKubeProxy ¶
type EnableKubeProxy struct {
KubePrepare
}
type ExtraAddon ¶
type ExtraAddon struct {
Addons []kubekeyapiv1alpha2.Addon `yaml:"Addons"`
}
type FileLoader ¶
type FileLoader struct {
FilePath string
KubernetesVersion string
KubeSphereVersion string
KubeSphereEnable bool
// contains filtered or unexported fields
}
func NewFileLoader ¶
func NewFileLoader(arg Argument) *FileLoader
func (FileLoader) Load ¶
func (f FileLoader) Load() (*kubekeyapiv1alpha2.Cluster, error)
type IsMaster ¶
type IsMaster struct {
KubePrepare
}
type IsWorker ¶
type IsWorker struct {
KubePrepare
Not bool
}
type KubeAction ¶
type KubeAction struct {
action.BaseAction
KubeConf *KubeConf
}
func (*KubeAction) AutoAssert ¶
func (k *KubeAction) AutoAssert(runtime connector.Runtime)
type KubeConf ¶
type KubeConf struct {
ClusterHosts []string
ClusterName string
Cluster *kubekeyapiv1alpha2.ClusterSpec
Kubeconfig string
Arg *Argument
}
type KubeCustomModule ¶
type KubeCustomModule struct {
module.CustomModule
KubeConf *KubeConf
}
func (*KubeCustomModule) AutoAssert ¶
func (k *KubeCustomModule) AutoAssert()
type KubeModule ¶
type KubeModule struct {
module.BaseTaskModule
KubeConf *KubeConf
}
func (*KubeModule) AutoAssert ¶
func (k *KubeModule) AutoAssert()
func (*KubeModule) IsSkip ¶
func (k *KubeModule) IsSkip() bool
type KubePrepare ¶
type KubePrepare struct {
prepare.BasePrepare
KubeConf *KubeConf
}
func (*KubePrepare) AutoAssert ¶
func (k *KubePrepare) AutoAssert(runtime connector.Runtime)
type KubeRollback ¶
type KubeRollback struct {
rollback.BaseRollback
KubeConf *KubeConf
}
func (*KubeRollback) AutoAssert ¶
func (k *KubeRollback) AutoAssert(runtime connector.Runtime)
type KubeRuntime ¶
type KubeRuntime struct {
connector.BaseRuntime
ClusterName string
Cluster *kubekeyapiv1alpha2.ClusterSpec
Kubeconfig string
Arg *Argument
}
func NewKubeRuntime ¶
func NewKubeRuntime(flag string, arg Argument) (*KubeRuntime, error)
func (*KubeRuntime) Copy ¶
func (k *KubeRuntime) Copy() connector.Runtime
Copy is used to create a copy for Runtime.
type Loader ¶
type Loader interface {
Load() (*kubekeyapiv1alpha2.Cluster, error)
}
type LocalRuntime ¶
type LocalRuntime struct {
connector.BaseRuntime
}
func NewLocalRuntime ¶
func NewLocalRuntime(debug, ingoreErr bool) (LocalRuntime, error)
type MasterHostConfig ¶
type MasterHostConfig struct {
MasterHost string `json:"master_host"`
MasterNodeName string `json:"master_node_name"`
MasterSSHUser string `json:"master_ssh_user"`
MasterSSHPassword string `json:"master_ssh_password"`
MasterSSHPrivateKeyPath string `json:"master_ssh_private_key_path"`
MasterSSHPort int `json:"master_ssh_port"`
}
func (*MasterHostConfig) AddFlags ¶
func (cfg *MasterHostConfig) AddFlags(fs *pflag.FlagSet)
func (*MasterHostConfig) Validate ¶
func (cfg *MasterHostConfig) Validate() error
type NetworkSettings ¶
type NetworkSettings struct {
// OSPublicIPs contains a list of public ip(s)
// by looking at local network interfaces
// if any
OSPublicIPs []net.IP `json:"os_public_ips"`
// CloudProviderPublicIP contains the info retrieved from the cloud provider instance metadata service
// if any
CloudProviderPublicIP net.IP `json:"cloud_provider_public_ip"`
// ExternalPublicIP is the IP address seen by others on the internet
// it may not be an IP address
// that's directly bound to a local network interface, e.g. on an AWS EC2 instance
// or may not be an IP address
// that can be used to access the machine at all, e.g. a machine behind multiple NAT gateways
// this is used as a fallback method to determine the machine's public IP address
// if none can be found from the OS or AWS IMDS service
// but the user explicitly specifies that the machine is publicly accessible
ExternalPublicIP net.IP `json:"external_public_ip"`
EnableReverseProxy *bool `json:"enable_reverse_proxy"`
}
type OnlyETCD ¶
type OnlyETCD struct {
KubePrepare
Not bool
}
type OnlyFirstMaster ¶
type OnlyFirstMaster struct {
KubePrepare
Not bool
}
type OnlyK3s ¶
type OnlyK3s struct {
KubePrepare
}
type OnlyKubernetes ¶
type OnlyKubernetes struct {
KubePrepare
}
type OnlyWorker ¶
type OnlyWorker struct {
KubePrepare
}
type Storage ¶
type Storage struct {
StorageVendor string `json:"storage_vendor"`
StorageType string `json:"storage_type"`
StorageBucket string `json:"storage_bucket"`
StoragePrefix string `json:"storage_prefix"`
StorageAccessKey string `json:"storage_access_key"`
StorageSecretKey string `json:"storage_secret_key"`
StorageToken string `json:"storage_token"` // juicefs --> from env
StorageClusterId string `json:"storage_cluster_id"` // use only on the Terminus cloud, juicefs --> from env
StorageSyncSecret string `json:"storage_sync_secret"` // use only on the Terminus cloud --> from env
BackupClusterBucket string `json:"backup_cluster_bucket"`
}
type SwapConfig ¶
type SwapConfig struct {
EnablePodSwap bool `json:"enable_pod_swap"`
Swappiness int `json:"swappiness"`
EnableZRAM bool `json:"enable_zram"`
ZRAMSize string `json:"zram_size"`
ZRAMSwapPriority int `json:"zram_swap_priority"`
}
func (*SwapConfig) AddFlags ¶
func (cfg *SwapConfig) AddFlags(fs *pflag.FlagSet)
func (*SwapConfig) Validate ¶
func (cfg *SwapConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.