Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
Update REST for exposeui flag as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
tmckayus committed Sep 26, 2017
1 parent 740978f commit 418b999
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions rest/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ definitions:
exposeWebUI:
description: |-
If true (which is the default), cluster create will also expose the Spark Web UI
type: boolean
default: true
type: string
metrics:
description: |-
Enable spark metrics, true or false (default is false)
Expand Down
2 changes: 1 addition & 1 deletion rest/client/oshinko_rest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewHTTPClient(formats strfmt.Registry) *OshinkoRest {
if formats == nil {
formats = strfmt.Default
}
transport := httptransport.New("localhost", "/", []string{"https", "http"})
transport := httptransport.New("localhost", "/", []string{"http", "https"})
return New(transport, formats)
}

Expand Down
4 changes: 2 additions & 2 deletions rest/handlers/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func singleClusterResponse(sc coreclusters.SparkCluster) *models.SingleCluster {
MasterCount: int64ptr(sc.Config.MasterCount),
WorkerCount: int64ptr(sc.Config.WorkerCount),
Name: sc.Config.Name,
ExposeWebUI: boolptr(sc.Config.ExposeWebUI),
ExposeWebUI: sc.Config.ExposeWebUI,
Metrics: sc.Config.Metrics,
}
return cluster
Expand Down Expand Up @@ -120,7 +120,7 @@ func assignConfig(config *models.NewClusterConfig) *coreclusters.ClusterConfig {
SparkMasterConfig: config.SparkMasterConfig,
SparkWorkerConfig: config.SparkWorkerConfig,
SparkImage: config.SparkImage,
ExposeWebUI: getBoolVal(config.ExposeWebUI),
ExposeWebUI: config.ExposeWebUI,
Metrics: config.Metrics,
}
return result
Expand Down
2 changes: 1 addition & 1 deletion rest/models/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type NewClusterConfig struct {

/* If true (which is the default), cluster create will also expose the Spark Web UI
*/
ExposeWebUI *bool `json:"exposeWebUI,omitempty"`
ExposeWebUI string `json:"exposeWebUI,omitempty"`

/* The count of master nodes requested in the cluster (must be > 0)
*/
Expand Down
2 changes: 1 addition & 1 deletion rest/restapi/embedded_spec.go

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions rest/tests/unit/clusterconfigs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var nonIntMaster clusters.ClusterConfig = clusters.ClusterConfig{Name: "cow"}
var nonIntWorker clusters.ClusterConfig = clusters.ClusterConfig{Name: "pig"}
var userDefault = clusters.ClusterConfig{MasterCount: 3, WorkerCount: 3,
SparkMasterConfig: "master-default", SparkWorkerConfig: "worker-default", Name: "default-oshinko-cluster-config",
ExposeWebUI: true, Metrics: "true" }
ExposeWebUI: "false", Metrics: "true" }

func makeConfigMap(cfg clusters.ClusterConfig) *api.ConfigMap {
var res api.ConfigMap = api.ConfigMap{Data: map[string]string{}}
Expand All @@ -50,11 +50,12 @@ func makeConfigMap(cfg clusters.ClusterConfig) *api.ConfigMap {
if cfg.WorkerCount != 0 {
res.Data["workercount"] = strconv.Itoa(cfg.WorkerCount)
}
// Needs clusterconfigs to respect exposeui from configmap before this works
// res.Data["exposeui"] = strconv.FormatBool(cfg.ExposeWebUI)
if cfg.Metrics != "" {
res.Data["metrics"] = cfg.Metrics
}
if cfg.ExposeWebUI != "" {
res.Data["exposeui"] = cfg.ExposeWebUI
}
res.Name = cfg.Name
return &res
}
Expand Down

0 comments on commit 418b999

Please sign in to comment.