upup: use protokube

This wires up protokube, replacing a lot of the nodeup functionality.

The option of not using protokube is retained, via the _not_protokube
tag.
This commit is contained in:
Justin Santa Barbara 2016-06-07 15:32:37 -04:00
parent 5e4013077a
commit 8a53149eef
22 changed files with 48 additions and 19 deletions

View File

@ -108,6 +108,8 @@ func (c *CreateClusterCmd) LoadConfig(configFile string) error {
}
func (c *CreateClusterCmd) Run() error {
useProtokube := true
if c.StateDir == "" {
return fmt.Errorf("state dir is required")
}
@ -146,6 +148,12 @@ func (c *CreateClusterCmd) Run() error {
c.Config.NodeUp.Location = location
}
if useProtokube {
location := "https://kubeupv2.s3.amazonaws.com/protokube/protokube.tar.gz"
glog.Infof("Using default protokube location: %q", location)
c.Config.Assets = append(c.Config.Assets, location)
}
var cloud fi.Cloud
var project string
@ -155,6 +163,14 @@ func (c *CreateClusterCmd) Run() error {
c.Config.NodeUpTags = append(c.Config.NodeUpTags, "_jessie", "_debian_family", "_systemd")
if useProtokube {
tags["_protokube"] = struct{}{}
c.Config.NodeUpTags = append(c.Config.NodeUpTags, "_protokube")
} else {
tags["_not_protokube"] = struct{}{}
c.Config.NodeUpTags = append(c.Config.NodeUpTags, "_not_protokube")
}
l.AddTypes(map[string]interface{}{
"keypair": &fitasks.Keypair{},
})
@ -204,26 +220,31 @@ func (c *CreateClusterCmd) Run() error {
c.Config.NodeUpTags = append(c.Config.NodeUpTags, "_aws")
l.AddTypes(map[string]interface{}{
"dhcpOptions": &awstasks.DHCPOptions{},
// EC2
"elasticIP": &awstasks.ElasticIP{},
"iamInstanceProfile": &awstasks.IAMInstanceProfile{},
"iamInstanceProfileRole": &awstasks.IAMInstanceProfileRole{},
"iamRole": &awstasks.IAMRole{},
"iamRolePolicy": &awstasks.IAMRolePolicy{},
"instance": &awstasks.Instance{},
"instanceElasticIPAttachment": &awstasks.InstanceElasticIPAttachment{},
"instanceVolumeAttachment": &awstasks.InstanceVolumeAttachment{},
"internetGateway": &awstasks.InternetGateway{},
"internetGatewayAttachment": &awstasks.InternetGatewayAttachment{},
"ebsVolume": &awstasks.EBSVolume{},
"route": &awstasks.Route{},
"routeTable": &awstasks.RouteTable{},
"routeTableAssociation": &awstasks.RouteTableAssociation{},
"securityGroup": &awstasks.SecurityGroup{},
"securityGroupIngress": &awstasks.SecurityGroupIngress{},
"sshKey": &awstasks.SSHKey{},
"subnet": &awstasks.Subnet{},
"vpc": &awstasks.VPC{},
// IAM
"iamInstanceProfile": &awstasks.IAMInstanceProfile{},
"iamInstanceProfileRole": &awstasks.IAMInstanceProfileRole{},
"iamRole": &awstasks.IAMRole{},
"iamRolePolicy": &awstasks.IAMRolePolicy{},
// VPC / Networking
"dhcpOptions": &awstasks.DHCPOptions{},
"internetGateway": &awstasks.InternetGateway{},
"internetGatewayAttachment": &awstasks.InternetGatewayAttachment{},
"route": &awstasks.Route{},
"routeTable": &awstasks.RouteTable{},
"routeTableAssociation": &awstasks.RouteTableAssociation{},
"securityGroup": &awstasks.SecurityGroup{},
"securityGroupIngress": &awstasks.SecurityGroupIngress{},
"subnet": &awstasks.Subnet{},
"vpc": &awstasks.VPC{},
"vpcDHDCPOptionsAssociation": &awstasks.VPCDHCPOptionsAssociation{},
// ELB

View File

@ -21,8 +21,6 @@ func main() {
target := "direct"
flag.StringVar(&target, "target", target, "Target - direct, cloudinit")
flag.Parse()
if dryrun {
target = "dryrun"
}

View File

@ -0,0 +1,5 @@
/srv/kubernetes - secrets
/srv/sshproxy - not used in "normal" environments? Contains SSH keypairs for tunnelling. Secrets, really.
/var/etcd - the etcd data volume. This should be a direct EBS volume

View File

@ -0,0 +1 @@
# Needed to add empty directory to git

View File

@ -0,0 +1 @@
# Needed to add empty directory to git

View File

@ -0,0 +1 @@
# Needed to add empty directory to git

View File

@ -1,5 +1,5 @@
{{ if HasTag "_kubernetes_master" }}
DAEMON_ARGS="--master=true"
DAEMON_ARGS="--master=true --containerized --v=8"
{{ else }}
DAEMON_ARGS="--master=false"
DAEMON_ARGS="--master=false --containerized --v=8"
{{ end }}

View File

@ -1,10 +1,12 @@
[Unit]
Description=Kubernetes Protokube Service
Documentation=https://github.com/kubernetes/kube-deploy/protokube
After=docker.service
[Service]
EnvironmentFile=/etc/sysconfig/protokube
ExecStart=/usr/local/bin/protokube "$DAEMON_ARGS"
ExecStartPre=/usr/bin/docker pull kope/protokube
ExecStart=/usr/bin/docker run -v /:/rootfs/ --privileged kope/protokube /usr/bin/protokube "$DAEMON_ARGS"
Restart=always
RestartSec=2s
StartLimitInterval=0