diff --git a/api/server.go b/api/server.go index b4f94e5a..4e36ebcf 100644 --- a/api/server.go +++ b/api/server.go @@ -53,21 +53,15 @@ func newServer() *Server { } case "gcp": var bucket, zone, projectId, projectNumber string + password = os.Getenv("DATACOL_API_KEY") bucket = os.Getenv("DATACOL_BUCKET") name = os.Getenv("DATACOL_STACK") + zone = os.Getenv("GCP_DEFAULT_ZONE") region := os.Getenv("GCP_REGION") - - projectId, err := metadata.ProjectID() - if err != nil { - log.Fatal(err) - } - - projectNumber, err = metadata.NumericProjectID() - if err != nil { - log.Fatal(err) - } + projectId = os.Getenv("GCP_PROJECT") + projectNumber = os.Getenv("GCP_PROJECT_NUMBER") provider = &google.GCPCloud{ Project: projectId, diff --git a/cloud/aws/templates.go b/cloud/aws/templates.go index 3cd17d50..d96595fa 100644 --- a/cloud/aws/templates.go +++ b/cloud/aws/templates.go @@ -86,7 +86,7 @@ func cloudAwsTemplatesAppTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/aws/templates/app.tmpl", size: 6223, mode: os.FileMode(420), modTime: time.Unix(1500318804, 0)} + info := bindataFileInfo{name: "cloud/aws/templates/app.tmpl", size: 6223, mode: os.FileMode(420), modTime: time.Unix(1500616848, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -106,7 +106,7 @@ func cloudAwsTemplatesMysqlTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/aws/templates/mysql.tmpl", size: 3587, mode: os.FileMode(420), modTime: time.Unix(1500220644, 0)} + info := bindataFileInfo{name: "cloud/aws/templates/mysql.tmpl", size: 3587, mode: os.FileMode(420), modTime: time.Unix(1500616848, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -126,7 +126,7 @@ func cloudAwsTemplatesPostgresTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/aws/templates/postgres.tmpl", size: 4430, mode: os.FileMode(420), modTime: time.Unix(1500220644, 0)} + info := bindataFileInfo{name: "cloud/aws/templates/postgres.tmpl", size: 4430, mode: os.FileMode(420), modTime: time.Unix(1500616848, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -146,7 +146,7 @@ func cloudAwsTemplatesRedisTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/aws/templates/redis.tmpl", size: 3164, mode: os.FileMode(420), modTime: time.Unix(1500220644, 0)} + info := bindataFileInfo{name: "cloud/aws/templates/redis.tmpl", size: 3164, mode: os.FileMode(420), modTime: time.Unix(1500616848, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/cloud/google/kubeconfig.go b/cloud/google/kubeconfig.go index b9edf16f..dc332b0f 100644 --- a/cloud/google/kubeconfig.go +++ b/cloud/google/kubeconfig.go @@ -9,7 +9,6 @@ import ( "os" "path/filepath" - "cloud.google.com/go/compute/metadata" log "github.com/Sirupsen/logrus" container "google.golang.org/api/container/v1" ) @@ -45,12 +44,12 @@ type configOptions struct { } func (g *GCPCloud) K8sConfigPath() (string, error) { - c, err := metadata.InstanceAttributeValue("DATACOL_CLUSTER") - if err != nil { - return "", err + cname, ok := os.LookupEnv("DATACOL_CLUSTER") + if !ok { + return "", fmt.Errorf("DATACOL_CLUSTER env var not found") } - return cacheKubeConfig(g.DeploymentName, g.Project, g.DefaultZone, c) + return cacheKubeConfig(g.DeploymentName, g.Project, g.DefaultZone, cname) } func cacheKubeConfig(sName, project, zone, cname string) (string, error) { diff --git a/cloud/google/resources.go b/cloud/google/resources.go index 455bff88..003f22de 100644 --- a/cloud/google/resources.go +++ b/cloud/google/resources.go @@ -103,6 +103,7 @@ func (g *GCPCloud) resourceListFromStack() (pb.Resources, error) { func (g *GCPCloud) ResourceCreate(name, kind string, params map[string]string) (*pb.Resource, error) { rs := &pb.Resource{Name: name, Kind: kind} + params["project"] = g.Project if kind == "postgres" { if _, ok := params["tier"]; !ok { diff --git a/cloud/google/templates.go b/cloud/google/templates.go index c2165966..e2feab47 100644 --- a/cloud/google/templates.go +++ b/cloud/google/templates.go @@ -69,7 +69,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _cloudGoogleTemplatesMysqlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x53\xcf\x6b\xdb\x30\x14\xbe\xe7\xaf\x78\x87\x41\xb7\x43\xc3\x0a\x3d\x0c\xdf\x46\x6c\x4a\x21\x4b\x33\xdc\xee\x6a\x64\xfb\xd9\x13\x55\x24\xe7\x49\xf2\x48\x4b\xfe\xf7\x21\x4b\x76\x14\x67\x0d\xcc\x17\x4b\xef\xfb\xbe\xf7\x5b\x84\x5a\x59\xaa\x50\x27\x0b\x80\x5b\x30\x87\x0e\x13\xd0\x7b\xc1\xea\x1d\x97\xcb\xfe\xae\x44\xc3\xee\x97\x5c\x6a\xc3\x64\x85\x0b\x00\x00\xc9\x76\x98\xc0\xcd\xfb\x3b\x2c\xdd\x11\x8e\xc7\x9b\xc1\xde\x91\xea\x90\x0c\xf7\xbe\xdc\x47\xd8\x72\x25\x03\xd7\x5f\x26\x36\x40\xcd\x0c\x2b\x99\xc6\x5f\x48\xfa\x44\xab\xcb\xa2\xf7\x86\x88\x3a\xc6\x7f\x1e\xd2\x5b\xad\x9f\x5e\xd2\x22\xff\xb9\x2e\x1e\x37\xf9\xf3\xf7\xcd\x2a\x0b\xb4\x92\x55\xaf\x28\x6b\xcf\xca\xb3\xd5\xd3\x26\x2d\x1e\xb2\x4d\x40\x35\x1a\xc3\x65\x3b\x65\x07\x60\x38\x52\x08\xeb\x8e\x51\x40\xef\xcb\x76\x2b\x25\x1b\xde\x5a\x62\xc6\x65\x38\x81\x00\x28\x59\x29\xb0\x4e\xa0\x61\x42\x63\x04\x94\x5c\x32\x3a\xac\x55\x9b\xfd\x9b\xc1\x3f\xf6\xc9\xbb\xfe\x7e\x52\x19\xb2\xb1\x5b\xc2\xbd\xe5\x84\xb9\x16\x33\xc8\x75\x31\xe5\xfa\x35\xe7\x6f\xf8\x50\x26\x70\xf7\xf5\x02\xf2\xfd\xd8\xa6\x45\x9e\xa7\x13\xc8\x2a\xc3\xfb\x21\x85\xad\x12\xbc\x3a\x84\x3e\x9c\xcc\x45\x37\xd8\xcf\x9a\x22\x54\xe5\x25\x84\x0d\x12\xca\x0a\xe3\xfc\xdf\x94\xc4\x04\x9c\x17\x77\x82\xe3\x71\x71\x6d\xa7\xc6\xf1\x47\x3b\x15\xad\xd4\xed\x19\x7c\xb9\x5a\x27\xc1\x48\x74\xf1\xce\xb7\x25\x81\x4f\x9f\x09\x9b\x65\xe4\x76\xf8\x7f\x09\xbc\xea\x37\x23\x8d\x26\x01\x6b\x9a\x6f\xbb\xf2\x7e\x34\x2b\x21\xfc\x6c\x46\xa0\x68\x51\x22\x31\x51\x54\xfc\x6a\x49\x56\x23\x7d\x50\xce\x04\x5d\x2b\xc5\x91\x82\x20\x60\x1d\xd3\xfa\x8f\xa2\xda\xe3\xe3\xed\x7f\x4a\x5d\x28\x6b\x3a\x6b\xc2\xfb\xf6\xb1\x32\xd9\xff\x38\xe8\xbd\x78\x8c\x9f\x75\xcf\x84\xbd\xda\xb2\xb9\x3a\x8d\x27\x14\xd4\x97\x03\x99\xab\xb6\xa1\x86\xb9\xea\xbc\xb6\xb9\xea\x25\x74\x66\xae\x8a\x3b\xf6\x37\x00\x00\xff\xff\x5c\xf3\xaf\x1c\xcb\x04\x00\x00") +var _cloudGoogleTemplatesMysqlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x54\x4d\x8b\xdb\x30\x10\xbd\xe7\x57\xcc\xa1\xb0\xed\x21\xa1\x0b\x39\x14\xdf\x4a\x6c\x96\x85\x34\x49\xf1\x6e\xaf\x46\xb6\xc7\xae\xba\x8a\xe4\x8c\x24\x97\xec\x92\xff\x5e\x6c\x4b\xae\xea\x7c\x40\x4b\x4f\x91\xe6\xbd\x37\xf3\x66\x34\x31\xa1\x56\x96\x0a\xd4\xd1\x0c\x60\x0e\xe6\xd8\x60\x04\xfa\x20\x58\xb9\xe7\x72\xd1\xde\xe7\x68\xd8\x72\xc1\xa5\x36\x4c\x16\x38\x03\x00\x90\x6c\x8f\x11\xdc\xbd\xbd\xc1\xa2\x3b\xc2\xe9\x74\xd7\xc7\x1b\x52\x0d\x92\xe1\x43\x2e\x17\xf9\x81\x85\x71\x64\x77\x1b\xf9\x00\x84\x35\x57\xd2\xc1\xc3\x25\x40\x4b\x66\x58\xce\x34\x7e\x43\xd2\xbf\x69\x65\x9e\xb5\x43\x20\xa0\x7a\x7f\x4f\xbd\xfd\xd5\x7a\xfb\x1c\x67\xe9\xd7\x75\xf6\xb8\x49\x9f\x3e\x6f\x56\x89\xa3\xe5\xac\x78\x41\x59\x0e\xac\x34\x59\x6d\x37\x71\xf6\x90\x6c\x1c\xaa\xd1\x18\x2e\xeb\xd1\x3d\x80\xe1\x48\xae\x6c\x77\x0c\x0a\x0e\xb9\x6c\xb3\x52\xb2\xe2\xb5\x25\x66\x3a\x87\x23\x08\x80\x92\xe5\x02\xcb\x08\x2a\x26\x34\x06\x40\xce\x25\xa3\xe3\x5a\xd5\xc9\x65\x06\xbf\x9e\x93\x37\xed\x72\x54\x19\xb2\x61\x5a\xc2\x83\xe5\x84\xa9\x16\x13\xa8\x9b\x62\xcc\xf5\x4b\xca\x5f\xf1\x21\x8f\xe0\xfe\xe3\x19\x34\xcc\x63\x17\x67\x69\x1a\x8f\xa0\x50\x45\x6f\x60\x47\x58\x21\xa1\x2c\x30\xb4\xf2\xaa\xa4\xdf\x81\xee\xd8\x4f\xe6\xd6\x02\xf9\xb7\xbc\xb2\x40\x73\x8f\xff\xeb\x26\x05\x29\x7d\xaa\x0b\xeb\x11\xc1\xbb\xf7\x84\xd5\x22\xa8\xdc\xff\x7e\x70\xbc\xe2\x3b\x23\x8d\x26\x02\x6b\xaa\x4f\xfb\x7c\xe9\xc3\x4a\x88\xe1\x31\x3c\x90\xd5\x28\x91\x98\xc8\x0a\x7e\xb3\x6d\xab\x91\xae\xb5\xdc\x61\x83\xc1\x3d\x1a\xd6\xb9\xf6\xcd\x96\xd8\xa0\x2c\xf5\x36\x78\xfc\xf9\x85\xff\xdb\x79\xfc\x7f\x8e\xb1\xb3\x37\x29\xd7\x30\xad\x7f\x2a\x2a\xbd\xdc\x5d\xff\x6a\xd0\x33\x65\x4d\x63\x8d\xfb\xdc\x0c\xf5\x12\xd9\x7e\x39\xea\x83\x78\x0c\xbf\x32\x2d\x13\xf6\xe6\x83\x4d\xd5\x71\xb8\x62\x4e\x7d\x69\x21\xa6\xba\x9d\x6b\xe3\x4c\x37\xe9\x6f\xaa\x7b\x76\x03\x3a\xd3\xfd\x31\xb9\x5f\x01\x00\x00\xff\xff\xfd\xdf\x22\x66\x60\x05\x00\x00") func cloudGoogleTemplatesMysqlTmplBytes() ([]byte, error) { return bindataRead( @@ -84,12 +84,12 @@ func cloudGoogleTemplatesMysqlTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/google/templates/mysql.tmpl", size: 1227, mode: os.FileMode(420), modTime: time.Unix(1500575743, 0)} + info := bindataFileInfo{name: "cloud/google/templates/mysql.tmpl", size: 1376, mode: os.FileMode(420), modTime: time.Unix(1500621425, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _cloudGoogleTemplatesPostgresTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x52\xc1\x6e\xea\x30\x10\xbc\xf3\x15\x7b\x78\x12\xaf\x07\x22\x55\xea\x29\xb7\x0a\x38\x20\x21\x4a\x05\xf4\x8a\x9c\x64\x89\xac\x06\x3b\x5d\xaf\x53\xb5\x28\xff\x5e\x39\x31\xc1\x4d\xd3\x48\xe5\xc2\x7a\x77\x66\x76\x3c\x31\xa1\xd1\x96\x52\x34\xf1\x04\x60\x06\xfc\x51\x62\x0c\xe6\xad\x10\xd9\x59\xaa\xa8\xba\x4f\x90\xc5\x43\x24\x95\x61\xa1\x52\x9c\x00\x00\x28\x71\xc6\x18\xa6\x97\x0b\x44\xae\x84\xba\x9e\x36\xfd\x92\x74\x89\xc4\xb2\xd5\x72\x3f\xc2\x5c\x6a\xe5\xb1\xed\xa1\x43\x03\x64\x82\x45\x22\x0c\xbe\x20\x99\x1b\x2c\x4b\x8e\x55\xdb\x08\xa0\xd7\xfd\xfb\xc6\xde\x7c\xfd\x74\x58\x1c\x77\xcf\xeb\xe3\x6a\xb3\xdb\x3f\x6e\xe6\x4b\x0f\x33\xc8\x2c\x55\xde\xed\x07\x60\x89\xe4\x85\x5d\x19\x48\x02\x24\x22\x7d\xb5\xe5\x5c\xab\x93\xcc\x2d\x09\x76\x1e\xba\x21\x00\x2a\x91\x14\x98\xc5\xc0\x64\xb1\xeb\x17\x3a\x6d\x90\x5b\xc2\x13\x12\xaa\x14\x43\xce\xa7\x56\x18\x83\xdb\xe6\x2a\xa8\xeb\xc9\x58\xaa\xd7\x00\x82\x54\x83\x50\x67\x4d\x1a\x1e\xe2\xa4\x86\x33\xbe\xf1\xfa\xd8\x5b\x6c\x31\xfc\xfb\x4f\x78\x8a\x02\xf5\xe6\xff\x6e\xd4\x9e\x35\x48\xbf\x58\xeb\x46\x63\x7e\x1c\xc8\x13\xfc\xac\x14\xc6\xbc\x6b\xca\xda\xf9\xf5\xf4\x27\xbf\xda\x72\x69\xd9\xbf\xd6\x76\xd7\x52\x55\x5b\x6d\x38\x27\x34\xab\xf0\x9d\x56\xa2\xb0\x23\x52\x83\x02\x8b\xf0\x93\x78\x81\x9f\xd9\x0e\x10\xb7\xfe\x32\x7d\xe2\xf7\x4b\x0e\x10\x0f\x3e\xa5\x3e\x31\x4c\xef\x2b\x00\x00\xff\xff\x19\xfa\xb8\x9c\xa5\x03\x00\x00") +var _cloudGoogleTemplatesPostgresTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x93\xcf\x6f\x82\x30\x14\xc7\xef\xfe\x15\xef\xb0\x84\xed\x20\xc9\x92\x9d\xb8\x2d\xea\xc1\xc4\xa8\x8b\xba\xab\x29\xf0\x24\x6c\xd8\xb2\xd7\x57\x96\xcd\xf0\xbf\x2f\x40\xc1\xaa\x8c\x64\xc9\x4e\xb4\xef\xc7\xf7\x7d\xfb\xa1\x25\xd4\xca\x50\x84\x3a\x18\x01\x8c\x81\xbf\x72\x0c\x40\x7f\x64\x22\x3e\xa6\xd2\x2f\x1e\x43\x64\xf1\xe4\xa7\x52\xb3\x90\x11\x8e\x00\x00\xa4\x38\x62\x00\xde\xe9\x04\x7e\xb5\x84\xb2\xf4\xea\x78\x4e\x2a\x47\xe2\xb4\xd1\xb2\x91\x37\x8c\xd8\x16\xdb\x5d\x57\x0f\x40\x98\xa4\x4a\xda\x74\xb3\x71\xb2\xb1\x60\x11\x0a\x8d\xaf\x48\xfa\x5c\x16\x87\xfb\xa2\x09\x38\xa5\xad\xbf\x6d\x6d\x7f\xb2\x58\xed\xa6\xfb\xcd\xcb\x62\x3f\x5f\x6e\xb6\xcf\xcb\xc9\xcc\x96\x69\x64\x4e\x65\xd2\xf9\x03\xe0\x14\xc9\x0a\x57\x4b\x47\x12\x20\x14\xd1\xbb\xc9\x27\x4a\x1e\xd2\xc4\x90\xe0\xca\x43\x97\x04\x40\x29\xc2\x0c\xe3\x00\x98\x0c\x76\xf1\x4c\x45\x75\xe5\x9a\xf0\x80\x84\x32\x42\xb7\xe7\x5b\xc9\x16\x5d\xb5\xac\xc7\x0d\x71\x6f\x11\x38\xdc\x1d\xec\xe3\x8b\xf4\xdf\xf1\x9f\x05\x5b\x21\x28\xcb\x2b\xa2\x01\xdc\xdd\x13\x1e\x7c\x67\x6c\xfd\x7d\x18\xf4\x6d\x34\xd2\x2f\x9e\xbb\xd4\x11\x59\x54\x73\x5b\xb7\x31\xe6\x28\x63\xbd\x72\x20\x8f\xdd\xce\xfe\xe8\xff\x30\xa8\x93\x95\xb3\x8b\x0b\x0d\x90\x0b\xad\x3f\x15\xc5\x6d\xbb\xdd\xf6\xdc\xbc\x01\x4e\xca\x70\x6e\xd8\x3e\xb0\x66\xde\x4c\x16\x6b\xa5\x39\x21\xd4\x73\xf7\x69\x15\x22\x33\x03\x52\xbd\x02\x53\x17\x80\x15\xf0\xae\x7e\xaa\xd7\xdf\xba\xb6\xe7\xb9\x69\xbd\x3a\x68\x4f\xeb\xce\xc2\xba\x69\xbd\xa0\xf8\x13\x00\x00\xff\xff\x23\x4a\xa0\xa9\x5e\x04\x00\x00") func cloudGoogleTemplatesPostgresTmplBytes() ([]byte, error) { return bindataRead( @@ -104,7 +104,7 @@ func cloudGoogleTemplatesPostgresTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cloud/google/templates/postgres.tmpl", size: 933, mode: os.FileMode(420), modTime: time.Unix(1500579287, 0)} + info := bindataFileInfo{name: "cloud/google/templates/postgres.tmpl", size: 1118, mode: os.FileMode(420), modTime: time.Unix(1500622105, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/cloud/google/templates/mysql.tmpl b/cloud/google/templates/mysql.tmpl index e2edcdfb..5d8ef2c7 100644 --- a/cloud/google/templates/mysql.tmpl +++ b/cloud/google/templates/mysql.tmpl @@ -2,6 +2,7 @@ resources: - type: sqladmin.v1beta4.instance name: '{{ .name }}' properties: + project: '{{ .project }}' region: '{{ .region }}' databaseVersion: '{{ .db_version }}' instanceType: CLOUD_SQL_INSTANCE @@ -16,31 +17,36 @@ resources: requireSsl: true dataDiskSizeGb: 10 dataDiskType: PD_SSD - activationPolicy: '{{ .activation_policy }}' locationPreference: - zone: {{ .zone }} + zone: '{{ .zone }}' - type: sqladmin.v1beta4.database - name: {{ .name }}-database + name: '{{ .name }}-database' properties: - name: {{ .database }} + project: '{{ .project }}' + name: '{{ .database }}' instance: $(ref.{{ .name }}.name) charset: utf8mb4 collation: utf8mb4_general_ci - type: sqladmin.v1beta4.user - name: {{ .name }}-user + name: '{{ .name }}-user' + metadata: + dependsOn: + - '{{ .name }}' + - '{{ .name }}-database' properties: - name: {{ .username }} - password: {{ .password }} + project: '{{ .project }}' + name: '{{ .username }}' + password: '{{ .password }}' instance: $(ref.{{ .name }}.name) outputs: - name: EnvMysqlInstance value: $(ref.{{ .name }}.name) - name: EnvMysqlDatabase - value: {{ .database }} + value: '{{ .database }}' - name: EnvMysqlPassword - value: {{ .password }} + value: '{{ .password }}' - name: EnvMysqlUsername - value: {{ .username }} + value: '{{ .username }}' diff --git a/cloud/google/templates/postgres.tmpl b/cloud/google/templates/postgres.tmpl index d63bf6a7..931a7faf 100644 --- a/cloud/google/templates/postgres.tmpl +++ b/cloud/google/templates/postgres.tmpl @@ -2,6 +2,7 @@ resources: - type: sqladmin.v1beta4.instance name: '{{ .name }}' properties: + project: '{{ .project }}' region: '{{ .region }}' databaseVersion: '{{ .db_version }}' instanceType: CLOUD_SQL_INSTANCE @@ -10,27 +11,33 @@ resources: backupConfiguration: enabled: true locationPreference: - zone: {{ .zone }} + zone: '{{ .zone }}' - type: sqladmin.v1beta4.database - name: {{ .name }}-{{ .database }} + name: {{ .name }}-database properties: + project: '{{ .project }}' name: {{ .database }} instance: $(ref.{{ .name }}.name) - type: sqladmin.v1beta4.user name: {{ .name }}-user + metadata: + dependsOn: + - {{ .name }} + - {{ .name }}-database properties: - name: {{ .username }} - password: {{ .password }} + project: '{{ .project }}' + name: '{{ .username }}' + password: '{{ .password }}' instance: $(ref.{{ .name }}.name) outputs: - name: EnvPostgresInstance value: $(ref.{{ .name }}.name) - name: EnvPostgresDatabase - value: {{ .database }} + value: '{{ .database }}' - name: EnvPostgresPassword - value: {{ .password }} + value: '{{ .password }}' - name: EnvPostgresUsername - value: {{ .username }} + value: '{{ .username }}' diff --git a/cmd/provider/aws/templates.go b/cmd/provider/aws/templates.go index 284d3b56..103d3f2d 100644 --- a/cmd/provider/aws/templates.go +++ b/cmd/provider/aws/templates.go @@ -83,7 +83,7 @@ func cmdProviderAwsTemplatesFormationYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cmd/provider/aws/templates/formation.yaml", size: 23324, mode: os.FileMode(420), modTime: time.Unix(1500494736, 0)} + info := bindataFileInfo{name: "cmd/provider/aws/templates/formation.yaml", size: 23324, mode: os.FileMode(420), modTime: time.Unix(1500616848, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/cmd/provider/gcp/gcp.go b/cmd/provider/gcp/gcp.go index d41bf4c9..e0734516 100644 --- a/cmd/provider/gcp/gcp.go +++ b/cmd/provider/gcp/gcp.go @@ -442,14 +442,6 @@ resources: - datacol metadata: items: - - key: DATACOL_API_KEY - value: {{ properties['api_key'] }} - - key: DATACOL_STACK - value: {{ properties['stack_name'] }} - - key: DATACOL_BUCKET - value: {{ properties['bucket'] }} - - key: DATACOL_CLUSTER - value: {{ properties['cluster_name'] }} - key: startup-script value: | #! /bin/bash @@ -464,15 +456,18 @@ resources: DATACOL_STACK={{ properties['stack_name'] }} GCP_DEFAULT_ZONE={{ properties['zone'] }} GCP_REGION={{ properties['region'] }} + GCP_PROJECT={{ env['project'] }} + GCP_PROJECT_NUMBER={{ env['project_number'] }} EOF + while read line; do export $line; done < <(cat /etc/environment) curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.6.3/bin/linux/amd64/kubectl > kubectl && chmod +x kubectl && \ mv kubectl /usr/local/bin + mkdir -p /opt/datacol && \ curl -Ls /tmp https://storage.googleapis.com/{{ properties['artifact_bucket'] }}/binaries/{{ properties['version'] }}/apictl.zip > /tmp/apictl.zip unzip /tmp/apictl.zip -d /opt/datacol && chmod +x /opt/datacol/apictl - while read line; do export $line; done < <(cat /etc/environment) cd /opt/datacol && nohup ./apictl -log-file log.txt & ` diff --git a/cmd/stack.go b/cmd/stack.go index 36dd652e..a13fbfc3 100644 --- a/cmd/stack.go +++ b/cmd/stack.go @@ -23,7 +23,7 @@ var ( credNotFound = errors.New("Invalid credentials") projectNotFound = errors.New("Invalid project id") - defaultGcpZone = "asia-southeast1-a" + defaultGcpZone = "asia-east1-a" //Taiwan defaultAWSZone = "ap-southeast-1a" defaultAWSInstanceType = "t2.medium" defaultGCPInstanceType = "n1-standard-1"