Skip to content

Commit

Permalink
Merge pull request #60 from ethanwinograd/node_port_rebased
Browse files Browse the repository at this point in the history
added optional nodeport variable
  • Loading branch information
stevesloka authored Jun 29, 2017
2 parents 3492374 + 71bf428 commit 342d0a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions example/example-es-cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"type": "gp2",
"storage-class-provisioner": "kubernetes.io/aws-ebs"
},
"nodePort": 30303,
"resources": {
"requests": {
"memory": "512Mi",
Expand Down
7 changes: 5 additions & 2 deletions pkg/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (k *K8sutil) CreateDataService(clusterName string) error {
}

// CreateClientService creates the client service
func (k *K8sutil) CreateClientService(clusterName string) error {
func (k *K8sutil) CreateClientService(clusterName string, nodePort int32) error {

fullClientServiceName := clientServiceName + "-" + clusterName
component := "elasticsearch" + "-" + clusterName
Expand Down Expand Up @@ -434,7 +434,10 @@ func (k *K8sutil) CreateClientService(clusterName string) error {
},
},
}

if nodePort > 0 {
clientSvc.Spec.Type = v1.ServiceTypeNodePort
clientSvc.Spec.Ports[0].NodePort = nodePort
}
_, err := k.Kclient.Services(namespace).Create(clientSvc)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (p *Processor) processElasticSearchCluster(c *myspec.ElasticsearchCluster)
// Create Services
p.k8sclient.CreateDiscoveryService(c.Metadata.Name)
p.k8sclient.CreateDataService(c.Metadata.Name)
p.k8sclient.CreateClientService(c.Metadata.Name)
p.k8sclient.CreateClientService(c.Metadata.Name, c.Spec.NodePort)

p.k8sclient.CreateClientMasterDeployment("client", baseImage, &c.Spec.ClientNodeReplicas, c.Spec.JavaOptions, c.Spec.Resources, c.Spec.ImagePullSecrets, c.Metadata.Name, c.Spec.Instrumentation.StatsdHost)
p.k8sclient.CreateClientMasterDeployment("master", baseImage, &c.Spec.MasterNodeReplicas, c.Spec.JavaOptions, c.Spec.Resources, c.Spec.ImagePullSecrets, c.Metadata.Name, c.Spec.Instrumentation.StatsdHost)
Expand Down
6 changes: 5 additions & 1 deletion pkg/spec/cluster.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
Copyright (c) 2017, UPMC Enterprises
All rights reserved.
Expand Down Expand Up @@ -88,7 +89,10 @@ type ClusterSpec struct {

// Instrumentation defines metrics for the cluster
Instrumentation Instrumentation `json:"instrumentation"`


//NodePort
NodePort int32 `json:"nodePort"`

Scheduler *snapshot.Scheduler
}

Expand Down

0 comments on commit 342d0a3

Please sign in to comment.