Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[to be merged after #1791 - #1794] Gen5 instance types with enhanced networking #1790

Closed
wants to merge 12 commits into from
Closed
18 changes: 10 additions & 8 deletions api/rpc/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ func (s *Server) ClusterStatus(ctx context.Context, in *StatusRequest) (*StatusR
}
log.Infoln("[cluster] Success: status")
return &StatusReply{
Name: stackInfo["StackName"],
Provider: string(s.Provider),
Region: s.Region,
SwarmStatus: string(swarmStatus),
CoreServices: strconv.Itoa(coreServices),
UserServices: strconv.Itoa(userServices),
Endpoint: stackInfo["DNSTarget"],
NfsEndpoint: stackInfo["NFSEndpoint"],
Name: stackInfo["StackName"],
Provider: string(s.Provider),
Region: s.Region,
SwarmStatus: string(swarmStatus),
CoreServices: strconv.Itoa(coreServices),
UserServices: strconv.Itoa(userServices),
Endpoint: stackInfo["DNSTarget"],
NfsEndpoint: stackInfo["NFSEndpoint"],
InternalEndpoint: stackInfo["InternalDockerHost"],
InternalPki: stackInfo["InternalPKITarget"],
}, nil
}

Expand Down
156 changes: 91 additions & 65 deletions api/rpc/cluster/cluster.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/rpc/cluster/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ message StatusReply {
string user_services = 6;
string endpoint = 7;
string nfs_endpoint = 8;
string internal_endpoint = 9;
string internal_pki = 10;
string pki = 11;
}

message UpdateRequest {
Expand Down
9 changes: 9 additions & 0 deletions api/rpc/cluster/cluster.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@
},
"nfs_endpoint": {
"type": "string"
},
"internal_endpoint": {
"type": "string"
},
"internal_pki": {
"type": "string"
},
"pki": {
"type": "string"
}
}
},
Expand Down
22 changes: 14 additions & 8 deletions cli/command/cluster/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,25 @@ func status(c cli.Interface, cmd *cobra.Command) error {
if reply.Provider == "" {
return errors.New("empty reply from server, probably an API mismatch")
}
fmt.Printf("Provider: %s\n", reply.Provider)
fmt.Printf("Provider: %s\n", reply.Provider)
if reply.Provider != string(cloud.ProviderLocal) {
fmt.Printf("Cluster name: %s\n", reply.Name)
fmt.Printf("Region: %s\n", reply.Region)
fmt.Printf("Cluster name: %s\n", reply.Name)
fmt.Printf("Region: %s\n", reply.Region)
}
fmt.Printf("Swarm Status: %s\n", reply.SwarmStatus)
fmt.Printf("Core Services: %s\n", reply.CoreServices)
fmt.Printf("User Services: %s\n", reply.UserServices)
fmt.Printf("Swarm Status: %s\n", reply.SwarmStatus)
fmt.Printf("Core Services: %s\n", reply.CoreServices)
fmt.Printf("User Services: %s\n", reply.UserServices)
if reply.Endpoint != "" {
fmt.Printf("DNS Target: %s\n", reply.Endpoint)
fmt.Printf("DNS Target: %s\n", reply.Endpoint)
}
if reply.InternalEndpoint != "" {
fmt.Printf("Docker Host (internal): %s\n", reply.InternalEndpoint)
}
if reply.InternalPki != "" {
fmt.Printf("PKI Endpoint (internal): %s\n", reply.InternalPki)
}
if reply.NfsEndpoint != "disabled" {
fmt.Printf("NFS Endpoint: %s\n", reply.NfsEndpoint)
fmt.Printf("NFS Endpoint: %s\n", reply.NfsEndpoint)
}
return nil
}
2 changes: 1 addition & 1 deletion cluster/ampagent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM scratch
FROM appcelerator/alpine:3.7.0

COPY defaults /defaults
COPY stacks /stacks
Expand Down
18 changes: 8 additions & 10 deletions cluster/ampagent/cmd/checks.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package cmd

import (
"log"

"fmt"
"log"

"docker.io/go-docker"
"docker.io/go-docker/api"
"docker.io/go-docker/api/types"
"docker.io/go-docker/api/types/versions"
ampdocker "github.com/appcelerator/amp/pkg/docker"
Expand Down Expand Up @@ -42,6 +39,10 @@ func Checks(cmd *cobra.Command, args []string) error {
if !checksOpts.version && !checksOpts.labels && !checksOpts.scheduling {
checksOpts.all = true
}
Docker = ampdocker.NewEnvClient()
if err := Docker.Connect(); err != nil {
return err
}
if checksOpts.version || checksOpts.all {
if err := VerifyDockerVersion(); err != nil {
log.Println("Version test: FAIL")
Expand Down Expand Up @@ -71,11 +72,11 @@ func Checks(cmd *cobra.Command, args []string) error {
}

func VerifyDockerVersion() error {
c, err := docker.NewClient(ampdocker.DefaultURL, ampdocker.DefaultVersion, nil, nil)
c := Docker.GetClient()
version, err := c.ServerVersion(context.Background())
if err != nil {
return err
}
version, err := c.ServerVersion(context.Background())
apiVersion := version.APIVersion
if versions.LessThan(apiVersion, ampdocker.MinVersion) {
log.Printf("Docker engine version %s\n", version.Version)
Expand All @@ -90,10 +91,7 @@ func VerifyLabels() error {
expectedLabels := []string{"amp.type.api=true", "amp.type.route=true", "amp.type.core=true", "amp.type.metrics=true",
"amp.type.search=true", "amp.type.mq=true", "amp.type.kv=true", "amp.type.user=true"}
missingLabel := false
c, err := docker.NewClient(ampdocker.DefaultURL, api.DefaultVersion, nil, nil)
if err != nil {
return err
}
c := Docker.GetClient()
nodes, err := c.NodeList(context.Background(), types.NodeListOptions{})
if err != nil {
return err
Expand Down
Loading