config

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

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

func GenerateConfigFromCluster(cfgPath, kubeconfig, name string) error

GenerateConfigFromCluster is used to generate cluster configuration file from the existing cluster's information.

func GenerateKubeKeyConfig

func GenerateKubeKeyConfig(arg common.Argument, name string) error

GenerateKubeKeyConfig is used to generate cluster configuration file

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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