func NewCentosCluster(name string) *cluster.Cluster {

	controlPlaneProviderConfig := &cluster.ControlPlaneProviderConfig{
		Cloud:    cluster.CloudDigitalOcean,
		Location: "sfo2",
		SSH: &cluster.SSH{
			PublicKeyPath: "~/.ssh/id_rsa.pub",
			User:          "root",
		},
		KubernetesAPI: &cluster.KubernetesAPI{
			Port: "443",
		},
		Values: &cluster.Values{
			ItemMap: map[string]string{
				"INJECTEDTOKEN": kubeadm.GetRandomToken(),
			},
		},
	}
	machineSetsProviderConfigs := []*cluster.MachineProviderConfig{
		{
			ServerPool: &cluster.ServerPool{
				Type:     cluster.ServerPoolTypeMaster,
				Name:     fmt.Sprintf("%s-master", name),
				MaxCount: 1,
				Image:    "centos-7-x64",
				Size:     "s-2vcpu-2gb",
				BootstrapScripts: []string{
					"bootstrap/digitalocean_k8s_centos_7_master.sh",
				},
				Firewalls: []*cluster.Firewall{
					{
						Name: fmt.Sprintf("%s-master", name),
						IngressRules: []*cluster.IngressRule{
							{
								IngressToPort:   "22",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "443",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-node", name),
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-node", name),
								IngressProtocol: "udp",
							},
						},
						EgressRules: []*cluster.EgressRule{
							{
								EgressToPort:      "all", // By default all egress from VM
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "tcp",
							},
							{
								EgressToPort:      "all", // By default all egress from VM
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "udp",
							},
						},
					},
				},
			},
		},
		{
			ServerPool: &cluster.ServerPool{
				Type:     cluster.ServerPoolTypeNode,
				Name:     fmt.Sprintf("%s-node", name),
				MaxCount: 2,
				Image:    "centos-7-x64",
				Size:     "s-1vcpu-2gb",
				BootstrapScripts: []string{
					"bootstrap/digitalocean_k8s_centos_7_node.sh",
				},
				Firewalls: []*cluster.Firewall{
					{
						Name: fmt.Sprintf("%s-node", name),
						IngressRules: []*cluster.IngressRule{
							{
								IngressToPort:   "22",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-master", name),
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-master", name),
								IngressProtocol: "udp",
							},
						},
						EgressRules: []*cluster.EgressRule{
							{
								EgressToPort:      "all", // By default all egress from VM
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "tcp",
							},
							{
								EgressToPort:      "all", // By default all egress from VM
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "udp",
							},
						},
					},
				},
			},
		},
	}
	c := cluster.NewCluster(name)
	c.SetProviderConfig(controlPlaneProviderConfig)
	c.NewMachineSetsFromProviderConfigs(machineSetsProviderConfigs)

	secret := &apiv1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "digitalocean",
			Namespace: "kube-system",
		},
		StringData: map[string]string{"access-token": string(os.Getenv("DIGITALOCEAN_ACCESS_TOKEN"))},
	}
	c.APITokenSecret = secret

	return c
}
func NewCentosCluster(name string) *cluster.Cluster {

	controlPlaneProviderConfig := &cluster.ControlPlaneProviderConfig{
		Cloud:    cluster.CloudDigitalOcean,
		Location: "sfo2",
		SSH: &cluster.SSH{
			PublicKeyPath: "~/.ssh/id_rsa.pub",
			User:          "root",
		},
		KubernetesAPI: &cluster.KubernetesAPI{
			Port: "443",
		},
		Values: &cluster.Values{
			ItemMap: map[string]string{
				"INJECTEDTOKEN": kubeadm.GetRandomToken(),
			},
		},
	}
	machineSetsProviderConfigs := []*cluster.MachineProviderConfig{
		{
			ServerPool: &cluster.ServerPool{
				Type:     cluster.ServerPoolTypeMaster,
				Name:     fmt.Sprintf("%s-master", name),
				MaxCount: 1,
				Image:    "centos-7-x64",
				Size:     "s-2vcpu-2gb",
				BootstrapScripts: []string{
					"bootstrap/digitalocean_k8s_centos_7_master.sh",
				},
				Firewalls: []*cluster.Firewall{
					{
						Name: fmt.Sprintf("%s-master", name),
						IngressRules: []*cluster.IngressRule{
							{
								IngressToPort:   "22",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "443",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-node", name),
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-node", name),
								IngressProtocol: "udp",
							},
						},
						EgressRules: []*cluster.EgressRule{
							{
								EgressToPort:      "all", 
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "tcp",
							},
							{
								EgressToPort:      "all", 
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "udp",
							},
						},
					},
				},
			},
		},
		{
			ServerPool: &cluster.ServerPool{
				Type:     cluster.ServerPoolTypeNode,
				Name:     fmt.Sprintf("%s-node", name),
				MaxCount: 2,
				Image:    "centos-7-x64",
				Size:     "s-1vcpu-2gb",
				BootstrapScripts: []string{
					"bootstrap/digitalocean_k8s_centos_7_node.sh",
				},
				Firewalls: []*cluster.Firewall{
					{
						Name: fmt.Sprintf("%s-node", name),
						IngressRules: []*cluster.IngressRule{
							{
								IngressToPort:   "22",
								IngressSource:   "0.0.0.0/0",
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-master", name),
								IngressProtocol: "tcp",
							},
							{
								IngressToPort:   "all",
								IngressSource:   fmt.Sprintf("%s-master", name),
								IngressProtocol: "udp",
							},
						},
						EgressRules: []*cluster.EgressRule{
							{
								EgressToPort:      "all", 
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "tcp",
							},
							{
								EgressToPort:      "all", 
								EgressDestination: "0.0.0.0/0",
								EgressProtocol:    "udp",
							},
						},
					},
				},
			},
		},
	}
	c := cluster.NewCluster(name)
	c.SetProviderConfig(controlPlaneProviderConfig)
	c.NewMachineSetsFromProviderConfigs(machineSetsProviderConfigs)

	secret := &apiv1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "digitalocean",
			Namespace: "kube-system",
		},
		StringData: map[string]string{"access-token": string(os.Getenv("DIGITALOCEAN_ACCESS_TOKEN"))},
	}
	c.APITokenSecret = secret

	return c
}
func NewCentosCluster ( name string ) * cluster . Cluster { controlPlaneProviderConfig := & cluster . ControlPlaneProviderConfig { Cloud : cluster . CloudDigitalOcean , Location : " " , SSH : & cluster . SSH { PublicKeyPath : " " , User : " " , } , KubernetesAPI : & cluster . KubernetesAPI { Port : " " , } , Values : & cluster . Values { ItemMap : map [ string ] string { " " : kubeadm . GetRandomToken ( ) , } , } , } machineSetsProviderConfigs := [ ] * cluster . MachineProviderConfig { { ServerPool : & cluster . ServerPool { Type : cluster . ServerPoolTypeMaster , Name : fmt . Sprintf ( " " , name ) , MaxCount : 1 , Image : " " , Size : " " , BootstrapScripts : [ ] string { " " , } , Firewalls : [ ] * cluster . Firewall { { Name : fmt . Sprintf ( " " , name ) , IngressRules : [ ] * cluster . IngressRule { { IngressToPort : " " , IngressSource : " " , IngressProtocol : " " , } , { IngressToPort : " " , IngressSource : " " , IngressProtocol : " " , } , { IngressToPort : " " , IngressSource : fmt . Sprintf ( " " , name ) , IngressProtocol : " " , } , { IngressToPort : " " , IngressSource : fmt . Sprintf ( " " , name ) , IngressProtocol : " " , } , } , EgressRules : [ ] * cluster . EgressRule { { EgressToPort : " " , // By default all egress from VM EgressDestination : " " , EgressProtocol : " " , } , { EgressToPort : " " , // By default all egress from VM EgressDestination : " " , EgressProtocol : " " , } , } , } , } , } , } , { ServerPool : & cluster . ServerPool { Type : cluster . ServerPoolTypeNode , Name : fmt . Sprintf ( " " , name ) , MaxCount : 2 , Image : " " , Size : " " , BootstrapScripts : [ ] string { " " , } , Firewalls : [ ] * cluster . Firewall { { Name : fmt . Sprintf ( " " , name ) , IngressRules : [ ] * cluster . IngressRule { { IngressToPort : " " , IngressSource : " " , IngressProtocol : " " , } , { IngressToPort : " " , IngressSource : fmt . Sprintf ( " " , name ) , IngressProtocol : " " , } , { IngressToPort : " " , IngressSource : fmt . Sprintf ( " " , name ) , IngressProtocol : " " , } , } , EgressRules : [ ] * cluster . EgressRule { { EgressToPort : " " , // By default all egress from VM EgressDestination : " " , EgressProtocol : " " , } , { EgressToPort : " " , // By default all egress from VM EgressDestination : " " , EgressProtocol : " " , } , } , } , } , } , } , } c := cluster . NewCluster ( name ) c . SetProviderConfig ( controlPlaneProviderConfig ) c . NewMachineSetsFromProviderConfigs ( machineSetsProviderConfigs ) secret := & apiv1 . Secret { ObjectMeta : metav1 . ObjectMeta { Name : " " , Namespace : " " , } , StringData : map [ string ] string { " " : string ( os . Getenv ( " " ) ) } , } c . APITokenSecret = secret return c }
// NewCentosCluster creates a basic CentOS DigitalOcean cluster.
NewCentosCluster creates a basic CentOS DigitalOcean cluster .