Skip to content
Browse files

display NodePorts while deploying with localkube

  • Loading branch information...
1 parent 3c6e813 commit 885e0140e622fc4f4458ab92293bd2b24e31d560 @ethernetdan ethernetdan committed
Showing with 16 additions and 6 deletions.
  1. +1 −0 cli/cluster.go
  2. +15 −6 pkg/deploy/cluster.go
View
1 cli/cluster.go
@@ -83,6 +83,7 @@ func (s SpreadCli) startLocalkube(c *cli.Context) {
s.fatalf("Failed to start container: %v", err)
}
s.startLocalkube(c)
+ return
}
s.fatalf("Failed to create localkube container: %v", err)
View
21 pkg/deploy/cluster.go
@@ -22,8 +22,9 @@ const DefaultContext = ""
// KubeCluster is able to deploy to Kubernetes clusters. This is a very simple implementation with no error recovery.
type KubeCluster struct {
- client *kubecli.Client
- context string
+ client *kubecli.Client
+ context string
+ localkube bool
}
// NewKubeClusterFromContext creates a KubeCluster using a Kubernetes client with the configuration of the given context.
@@ -60,8 +61,9 @@ func NewKubeClusterFromContext(name string) (*KubeCluster, error) {
}
return &KubeCluster{
- client: client,
- context: name,
+ client: client,
+ context: name,
+ localkube: name == "localkube",
}, nil
}
@@ -106,7 +108,7 @@ func (c *KubeCluster) Deploy(dep *Deployment, update, deleteModifiedPods bool) e
}
}
- printLoadBalancers(c.client, dep.services)
+ printLoadBalancers(c.client, dep.services, c.localkube)
// deployed successfully
return nil
@@ -332,7 +334,7 @@ func copyImmutables(src, dst KubeObject) {
}
}
-func printLoadBalancers(client *kubecli.Client, services []*kube.Service) {
+func printLoadBalancers(client *kubecli.Client, services []*kube.Service, localkube bool) {
if len(services) == 0 {
return
}
@@ -367,6 +369,13 @@ func printLoadBalancers(client *kubecli.Client, services []*kube.Service) {
fmt.Printf("Error getting service `%s`: %v\n", s.Name, err)
}
+ if localkube {
+ completed[s.Name] = true
+ for _, port := range clusterVers.Spec.Ports {
+ fmt.Printf("'%s/%s' - %s available on localkube host port:\t %d\n", s.Namespace, s.Name, port.Name, port.NodePort)
+ }
+ }
+
loadBalancers := clusterVers.Status.LoadBalancer.Ingress
if len(loadBalancers) == 1 {
completed[s.Name] = true

0 comments on commit 885e014

Please sign in to comment.
Something went wrong with that request. Please try again.