Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ClusterCfgTempl defines the template of cluster configuration file for the existing cluster. ClusterCfgTempl = template.Must(template.New("ClusterCfg").Parse( dedent.Dedent(`apiVersion: kubekey.kubesphere.io/v1alpha2 kind: Cluster metadata: name: {{ .Options.Name }} spec: hosts: ##You should complete the ssh information of the hosts {{- range .Options.Hosts }} - {{ . }} {{- end }} roleGroups: etcd: - SHOULD_BE_REPLACED master: {{- range .Options.MasterGroup }} - {{ . }} {{- end }} worker: {{- range .Options.WorkerGroup }} - {{ . }} {{- end }} controlPlaneEndpoint: ##Internal loadbalancer for apiservers {{- if .Options.InternalLoadbalancer }} internalLoadbalancer: {{ .Options.InternalLoadbalancer }} {{- else }} #internalLoadbalancer: haproxy {{- end }} ##If the external loadbalancer was used, 'address' should be set to loadbalancer's ip. domain: {{ .Options.ControlPlaneEndpointDomain }} address: {{ .Options.ControlPlaneEndpointAddress }} port: {{ .Options.ControlPlaneEndpointPort }} kubernetes: version: {{ .Options.KubeVersion }} clusterName: {{ .Options.ClusterName }} proxyMode: {{ .Options.ProxyMode }} masqueradeAll: {{ .Options.MasqueradeAll }} maxPods: {{ .Options.MaxPods }} nodeCidrMaskSize: {{ .Options.NodeCidrMaskSize }} network: plugin: {{ .Options.NetworkPlugin }} kubePodsCIDR: {{ .Options.PodNetworkCidr }} kubeServiceCIDR: {{ .Options.ServiceNetworkCidr }} registry: privateRegistry: "" `))) )
Functions ¶
func CheckConfigFileStatus ¶
func CheckConfigFileStatus(path string)
CheckConfigFileStatus is used to check the status of cluster configuration file.
func GenerateClusterCfgStr ¶
func GenerateClusterCfgStr(opt *OptionsCluster) (string, error)
GenerateClusterCfgStr is used to generate cluster configuration content.
func GenerateConfigFromCluster ¶
GenerateConfigFromCluster is used to generate cluster configuration file from the existing cluster's information.
Types ¶
type OptionsCluster ¶
type OptionsCluster struct { Name string Hosts []string MasterGroup []string WorkerGroup []string KubeVersion string ImageRepo string ClusterName string MasqueradeAll string ProxyMode string MaxPods string NodeCidrMaskSize string PodNetworkCidr string ServiceNetworkCidr string NetworkPlugin string ControlPlaneEndpointDomain string ControlPlaneEndpointAddress string ControlPlaneEndpointPort string InternalLoadbalancer string }
OptionsCluster defineds the parameters of cluster configuration for the existing cluster.
func GetInfoFromCluster ¶
func GetInfoFromCluster(config, name string) (*OptionsCluster, error)
GetInfoFromCluster is used to fetch information from the existing cluster.
Click to show internal directories.
Click to hide internal directories.