cluster

package
v0.1.6-rc3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: Apache-2.0 Imports: 37 Imported by: 182

Documentation

Index

Constants

View Source
const (
	KubeDNSAddonResourceName      = "rke-kubedns-addon"
	UserAddonResourceName         = "rke-user-addon"
	IngressAddonResourceName      = "rke-ingress-controller"
	UserAddonsIncludeResourceName = "rke-user-includes-addons"
)
View Source
const (
	CloudConfigDeployer    = "cloud-config-deployer"
	CloudConfigServiceName = "cloud"
	CloudConfigPath        = "/etc/kubernetes/cloud-config.json"
	CloudConfigEnv         = "RKE_CLOUD_CONFIG"
)
View Source
const (
	X509AuthenticationProvider = "x509"
	StateConfigMapName         = "cluster-state"
	UpdateStateTimeout         = 30
	GetStateTimeout            = 30
	KubernetesClientTimeOut    = 30
	NoneAuthorizationMode      = "none"
	LocalNodeAddress           = "127.0.0.1"
	LocalNodeHostname          = "localhost"
	LocalNodeUser              = "root"
	CloudProvider              = "CloudProvider"
	AzureCloudProvider         = "azure"
	AWSCloudProvider           = "aws"
	ControlPlane               = "controlPlane"
	WorkerPlane                = "workerPlan"
	EtcdPlane                  = "etcd"
)
View Source
const (
	DefaultServiceClusterIPRange = "10.43.0.0/16"
	DefaultClusterCIDR           = "10.42.0.0/16"
	DefaultClusterDNSService     = "10.43.0.10"
	DefaultClusterDomain         = "cluster.local"
	DefaultClusterName           = "local"
	DefaultClusterSSHKeyPath     = "~/.ssh/id_rsa"

	DefaultK8sVersion = v3.DefaultK8s

	DefaultSSHPort        = "22"
	DefaultDockerSockPath = "/var/run/docker.sock"

	DefaultAuthStrategy      = "x509"
	DefaultAuthorizationMode = "rbac"

	DefaultNetworkPlugin        = "canal"
	DefaultNetworkCloudProvider = "none"

	DefaultIngressController = "nginx"
)
View Source
const (
	NetworkPluginResourceName = "rke-network-plugin"

	PortCheckContainer        = "rke-port-checker"
	EtcdPortListenContainer   = "rke-etcd-port-listener"
	CPPortListenContainer     = "rke-cp-port-listener"
	WorkerPortListenContainer = "rke-worker-port-listener"

	KubeAPIPort         = "6443"
	EtcdPort1           = "2379"
	EtcdPort2           = "2380"
	ScedulerPort        = "10251"
	ControllerPort      = "10252"
	KubeletPort         = "10250"
	KubeProxyPort       = "10256"
	FlannetVXLANPortUDP = "8472"

	ProtocolTCP = "TCP"
	ProtocolUDP = "UDP"

	FlannelNetworkPlugin = "flannel"
	FlannelImage         = "flannel_image"
	FlannelCNIImage      = "flannel_cni_image"
	FlannelIface         = "flannel_iface"

	CalicoNetworkPlugin    = "calico"
	CalicoNodeImage        = "calico_node_image"
	CalicoCNIImage         = "calico_cni_image"
	CalicoControllersImage = "calico_controllers_image"
	CalicoctlImage         = "calicoctl_image"
	CalicoCloudProvider    = "calico_cloud_provider"

	CanalNetworkPlugin = "canal"
	CanalNodeImage     = "canal_node_image"
	CanalCNIImage      = "canal_cni_image"
	CanalFlannelImage  = "canal_flannel_image"

	WeaveNetworkPlugin = "weave"
	WeaveImage         = "weave_node_image"
	WeaveCNIImage      = "weave_cni_image"

	// EtcdEndpoints is the server address for Etcd, used by calico
	EtcdEndpoints = "EtcdEndpoints"
	// APIRoot is the kubernetes API address
	APIRoot = "APIRoot"

	EtcdClientCert     = "EtcdClientCert"
	EtcdClientKey      = "EtcdClientKey"
	EtcdClientCA       = "EtcdClientCA"
	EtcdClientCertPath = "EtcdClientCertPath"
	EtcdClientKeyPath  = "EtcdClientKeyPath"
	EtcdClientCAPath   = "EtcdClientCAPath"

	ClientCertPath = "ClientCertPath"
	ClientKeyPath  = "ClientKeyPath"
	ClientCAPath   = "ClientCAPath"

	KubeCfg = "KubeCfg"

	ClusterCIDR = "ClusterCIDR"

	Image            = "Image"
	CNIImage         = "CNIImage"
	NodeImage        = "NodeImage"
	ControllersImage = "ControllersImage"
	CanalFlannelImg  = "CanalFlannelImg"

	Calicoctl = "Calicoctl"

	FlannelInterface = "FlannelInterface"
	RBACConfig       = "RBACConfig"
)
View Source
const (
	EtcdPathPrefix = "/registry"
	B2DOS          = "Boot2Docker"
	B2DPrefixPath  = "/mnt/sda1/rke"
	ROS            = "RancherOS"
	ROSPrefixPath  = "/opt/rke"
)

Variables

View Source
var ControlPlanePortList = []string{
	KubeAPIPort,
}
View Source
var EtcdPortList = []string{
	EtcdPort1,
	EtcdPort2,
}
View Source
var WorkerPortList = []string{
	KubeletPort,
}

Functions

func ApplyAuthzResources added in v0.1.2

func ApplyAuthzResources(ctx context.Context, rkeConfig v3.RancherKubernetesEngineConfig, clusterFilePath, configDir string, k8sWrapTransport k8s.WrapTransport) error

func BuildPortChecksFromPortList added in v0.1.2

func BuildPortChecksFromPortList(host *hosts.Host, portList []string, proto string) []v3.PortCheck

func BuildRKEConfigNodePlan added in v0.1.2

func BuildRKEConfigNodePlan(ctx context.Context, myCluster *Cluster, host *hosts.Host, hostDockerInfo types.Info) v3.RKEConfigNodePlan

func CheckEtcdHostsChanged

func CheckEtcdHostsChanged(kubeCluster, currentCluster *Cluster) error

func ConfigureCluster added in v0.1.2

func ConfigureCluster(
	ctx context.Context,
	rkeConfig v3.RancherKubernetesEngineConfig,
	crtBundle map[string]pki.CertificatePKI,
	clusterFilePath, configDir string,
	k8sWrapTransport k8s.WrapTransport,
	useKubectl bool) error

func GeneratePlan added in v0.1.2

func GeneratePlan(ctx context.Context, rkeConfig *v3.RancherKubernetesEngineConfig, hostsInfoMap map[string]types.Info) (v3.RKEPlan, error)

func GetK8sVersion

func GetK8sVersion(localConfigPath string, k8sWrapTransport k8s.WrapTransport) (string, error)

func GetLocalRKEConfig

func GetLocalRKEConfig() *v3.RancherKubernetesEngineConfig

func GetLocalRKENodeConfig

func GetLocalRKENodeConfig() *v3.RKEConfigNode

func ParseConfig

func ParseConfig(clusterFile string) (*v3.RancherKubernetesEngineConfig, error)

func ReconcileCluster

func ReconcileCluster(ctx context.Context, kubeCluster, currentCluster *Cluster, updateOnly bool) error

func SetUpAuthentication

func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Cluster) error

func ValidateHostCount added in v0.1.2

func ValidateHostCount(c *Cluster) error

Types

type Cluster

type Cluster struct {
	v3.RancherKubernetesEngineConfig `yaml:",inline"`
	ConfigPath                       string
	LocalKubeConfigPath              string
	EtcdHosts                        []*hosts.Host
	WorkerHosts                      []*hosts.Host
	ControlPlaneHosts                []*hosts.Host
	InactiveHosts                    []*hosts.Host
	EtcdReadyHosts                   []*hosts.Host
	KubeClient                       *kubernetes.Clientset
	KubernetesServiceIP              net.IP
	Certificates                     map[string]pki.CertificatePKI
	ClusterDomain                    string
	ClusterCIDR                      string
	ClusterDNSServer                 string
	DockerDialerFactory              hosts.DialerFactory
	LocalConnDialerFactory           hosts.DialerFactory
	PrivateRegistriesMap             map[string]v3.PrivateRegistry
	K8sWrapTransport                 k8s.WrapTransport
	UseKubectlDeploy                 bool
	UpdateWorkersOnly                bool
	CloudConfigFile                  string
}

func ParseCluster

func ParseCluster(
	ctx context.Context,
	rkeConfig *v3.RancherKubernetesEngineConfig,
	clusterFilePath, configDir string,
	dockerDialerFactory,
	localConnDialerFactory hosts.DialerFactory,
	k8sWrapTransport k8s.WrapTransport) (*Cluster, error)

func (*Cluster) ApplySystemAddonExcuteJob

func (c *Cluster) ApplySystemAddonExcuteJob(addonJob string) error

func (*Cluster) BuildEtcdProcess added in v0.1.2

func (c *Cluster) BuildEtcdProcess(host *hosts.Host, etcdHosts []*hosts.Host, prefixPath string) v3.Process

func (*Cluster) BuildKubeAPIProcess added in v0.1.2

func (c *Cluster) BuildKubeAPIProcess(prefixPath string) v3.Process

func (*Cluster) BuildKubeControllerProcess added in v0.1.2

func (c *Cluster) BuildKubeControllerProcess(prefixPath string) v3.Process

func (*Cluster) BuildKubeProxyProcess added in v0.1.2

func (c *Cluster) BuildKubeProxyProcess(prefixPath string) v3.Process

func (*Cluster) BuildKubeletProcess added in v0.1.2

func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string) v3.Process

func (*Cluster) BuildProxyProcess added in v0.1.2

func (c *Cluster) BuildProxyProcess() v3.Process

func (*Cluster) BuildSchedulerProcess added in v0.1.2

func (c *Cluster) BuildSchedulerProcess(prefixPath string) v3.Process

func (*Cluster) BuildSidecarProcess added in v0.1.2

func (c *Cluster) BuildSidecarProcess() v3.Process

func (*Cluster) CheckClusterPorts

func (c *Cluster) CheckClusterPorts(ctx context.Context, currentCluster *Cluster) error

func (*Cluster) CleanDeadLogs added in v0.1.3

func (c *Cluster) CleanDeadLogs(ctx context.Context) error

func (*Cluster) ClusterRemove

func (c *Cluster) ClusterRemove(ctx context.Context) error

func (*Cluster) DeployControlPlane

func (c *Cluster) DeployControlPlane(ctx context.Context) error

func (*Cluster) DeployWorkerPlane

func (c *Cluster) DeployWorkerPlane(ctx context.Context) error

func (*Cluster) GetClusterState

func (c *Cluster) GetClusterState(ctx context.Context) (*Cluster, error)

func (*Cluster) GetKubernetesServicesOptions added in v0.1.6

func (c *Cluster) GetKubernetesServicesOptions() v3.KubernetesServicesOptions

func (*Cluster) InvertIndexHosts

func (c *Cluster) InvertIndexHosts() error

func (*Cluster) PrePullK8sImages added in v0.1.1

func (c *Cluster) PrePullK8sImages(ctx context.Context) error

func (*Cluster) SaveClusterState

func (c *Cluster) SaveClusterState(ctx context.Context, rkeConfig *v3.RancherKubernetesEngineConfig) error

func (*Cluster) SetUpHosts

func (c *Cluster) SetUpHosts(ctx context.Context) error

func (*Cluster) StoreAddonConfigMap

func (c *Cluster) StoreAddonConfigMap(ctx context.Context, addonYaml string, addonName string) error

func (*Cluster) SyncLabelsAndTaints added in v0.1.1

func (c *Cluster) SyncLabelsAndTaints(ctx context.Context) error

func (*Cluster) TunnelHosts

func (c *Cluster) TunnelHosts(ctx context.Context, local bool) error

func (*Cluster) ValidateCluster

func (c *Cluster) ValidateCluster() error

Jump to

Keyboard shortcuts

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