Skip to content

Commit

Permalink
deployment: Change of terminology for create command (#356)
Browse files Browse the repository at this point in the history
The Name field in the elasticsearch topology element has changed to NodeType
This patch updates the documentation to take that change into account, as well as
changing the --topology-element flag to --es-node-topology as an UX improvement.
  • Loading branch information
karencfv committed Jul 27, 2020
1 parent 3ed0a08 commit b7bde30
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 22 deletions.
8 changes: 4 additions & 4 deletions cmd/deployment/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

var createCmd = &cobra.Command{
Use: "create {--file | --es-size <int> --es-zones <int> | --topology-element <obj>}",
Use: "create {--file | --es-size <int> --es-zones <int> | --es-node-topology <obj>}",
Short: "Creates a deployment",
PreRunE: cobra.NoArgs,
Long: createLong,
Expand All @@ -51,7 +51,7 @@ var createCmd = &cobra.Command{
var esZoneCount, _ = cmd.Flags().GetInt32("es-zones")
var esSize, _ = cmd.Flags().GetInt32("es-size")
var esRefID, _ = cmd.Flags().GetString("es-ref-id")
var te, _ = cmd.Flags().GetStringArray("topology-element")
var topologyElements, _ = cmd.Flags().GetStringArray("es-node-topology")
var plugin, _ = cmd.Flags().GetStringSlice("plugin")

var kibanaZoneCount, _ = cmd.Flags().GetInt32("kibana-zones")
Expand Down Expand Up @@ -101,7 +101,7 @@ var createCmd = &cobra.Command{
Region: region,
Writer: ecctl.Get().Config.ErrorDevice,
Plugins: plugin,
TopologyElements: te,
TopologyElements: topologyElements,
ApmEnable: apmEnable,
AppsearchEnable: appsearchEnable,
EnterpriseSearchEnable: enterpriseSearchEnable,
Expand Down Expand Up @@ -185,7 +185,7 @@ func initFlags() {
createCmd.Flags().String("es-ref-id", "main-elasticsearch", "Optional RefId for the Elasticsearch deployment")
createCmd.Flags().Int32("es-zones", 1, "Number of zones the Elasticsearch instances will span")
createCmd.Flags().Int32("es-size", 4096, "Memory (RAM) in MB that each of the Elasticsearch instances will have")
createCmd.Flags().StringArrayP("topology-element", "e", nil, "Optional Elasticsearch topology element definition. See help for more information")
createCmd.Flags().StringArrayP("es-node-topology", "e", nil, "Optional Elasticsearch node topology element definition. See help for more information")
createCmd.Flags().StringSlice("plugin", nil, "Additional plugins to add to the Elasticsearch deployment")

createCmd.Flags().String("kibana-ref-id", "main-kibana", "Optional RefId for the Kibana deployment")
Expand Down
8 changes: 4 additions & 4 deletions cmd/deployment/create_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ When version is not specified, the latest available stack version will automatic
These are the available options:
* Simplified flags to set size and zone count for each instance type (Elasticsearch, Kibana, APM, Enterprise Search and App Search).
* Advanced flag for different Elasticsearch node types: --topology-element <json obj> (shorthand: -e).
* Advanced flag for different Elasticsearch node types: --es-node-topology <json obj> (shorthand: -e).
Note that the flag can be specified multiple times for complex topologies.
The JSON object has the following format:
{
"name": "["data", "master", "ml"]" # type string
"node_type": "["data", "master", "ml"]" # type string
"size": 1024 # type int32
"zone_count": 1 # type int32
}
Expand All @@ -53,10 +53,10 @@ $ deployment create --name my-deployment --track
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
one 1GB Elasticsearch instance of the type "ml".
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
$ ecctl deployment create --name my-deployment --es-node-topology '{"size": 1024, "zone_count": 2, "node_type": "data"}' --es-node-topology '{"size": 1024, "zone_count": 1, "node_type": "ml"}'
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
You'll need to run the following command to view your deployment templates:
Expand Down
49 changes: 49 additions & 0 deletions cmd/deployment/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,55 @@ Deployment [%s] - [Apm][%s]: running step "waiting-for-some-step" (Plan duration
Stdout: string(defaultCreateResponseBytes),
},
},
{
name: "succeeds creating a deployment with ES topology element and without tracking (Normal GetCall)",
args: testutils.Args{
Cmd: createCmd,
Args: []string{
"create", "--request-id=some_request_id", "--version=7.8.0", "--es-node-topology",
`{"size": 1024, "zone_count": 2, "node_type": "data"}`, "--es-node-topology",
`{"size": 1024, "zone_count": 1, "node_type": "ml"}`, "--dt-as-list=false",
},
Cfg: testutils.MockCfg{Responses: []mock.Response{
{
Response: http.Response{
StatusCode: 200,
Body: mock.NewStructBody(defaultTemplateResponse),
},
Assert: &mock.RequestAssertion{
Method: "GET",
Header: api.DefaultReadMockHeaders,
Path: "/api/v1/deployments/templates/default",
Host: api.DefaultMockHost,
Query: url.Values{
"region": {"ece-region"},
"show_instance_configurations": {"true"},
},
},
},
{
Response: http.Response{
StatusCode: 201,
Body: mock.NewStructBody(defaultCreateResponse),
},
Assert: &mock.RequestAssertion{
Method: "POST",
Header: api.DefaultWriteMockHeaders,
Body: mock.NewStringBody(`{"resources":{"apm":null,"appsearch":null,"elasticsearch":[{"plan":{"cluster_topology":[{"instance_configuration_id":"default.data","node_type":{"data":true},"size":{"resource":"memory","value":1024},"zone_count":2},{"instance_configuration_id":"default.ml","node_type":{"ml":true},"size":{"resource":"memory","value":1024},"zone_count":1}],"deployment_template":{"id":"default"},"elasticsearch":{"version":"7.8.0"}},"ref_id":"main-elasticsearch","region":"ece-region"}],"enterprise_search":null,"kibana":[{"elasticsearch_cluster_ref_id":"main-elasticsearch","plan":{"cluster_topology":[{"size":{"resource":"memory","value":1024},"zone_count":1}],"kibana":{"version":"7.8.0"}},"ref_id":"main-kibana","region":"ece-region"}]}}` + "\n"),
Path: "/api/v1/deployments",
Host: api.DefaultMockHost,
Query: url.Values{
"request_id": {"some_request_id"},
"validate_only": {"false"},
},
},
},
}},
},
want: testutils.Assertion{
Stdout: string(defaultCreateResponseBytes),
},
},
{
name: "succeeds creating a deployment with overrides and without tracking",
args: testutils.Args{
Expand Down
10 changes: 5 additions & 5 deletions docs/ecctl_deployment_create.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ When version is not specified, the latest available stack version will automatic
These are the available options:

* Simplified flags to set size and zone count for each instance type (Elasticsearch, Kibana, APM, Enterprise Search and App Search).
* Advanced flag for different Elasticsearch node types: --topology-element +++<json obj="">+++(shorthand: -e). Note that the flag can be specified multiple times for complex topologies. The JSON object has the following format: { "name": "["data", "master", "ml"]" # type string "size": 1024 # type int32 "zone_count": 1 # type int32 }+++</json>+++
* Advanced flag for different Elasticsearch node types: --es-node-topology +++<json obj="">+++(shorthand: -e). Note that the flag can be specified multiple times for complex topologies. The JSON object has the following format: { "node_type": "["data", "master", "ml"]" # type string "size": 1024 # type int32 "zone_count": 1 # type int32 }+++</json>+++
* File definition: --file=+++<file path="">+++(shorthand: -f). You can create a definition by using the sample JSON seen here: https://elastic.co/guide/en/cloud/current/ec-api-deployment-crud.html#ec_create_a_deployment+++</file>+++

As an option "--generate-payload" can be used in order to obtain the generated payload that would be sent as a request.
Save it, update or extend the topology and create a deployment using the saved payload with the "--file" flag.

----
ecctl deployment create {--file | --es-size <int> --es-zones <int> | --topology-element <obj>} [flags]
ecctl deployment create {--file | --es-size <int> --es-zones <int> | --es-node-topology <obj>} [flags]
----

[float]
Expand All @@ -39,10 +39,10 @@ $ deployment create --name my-deployment --track
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
one 1GB Elasticsearch instance of the type "ml".
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
$ ecctl deployment create --name my-deployment --es-node-topology '{"size": 1024, "zone_count": 2, "node_type": "data"}' --es-node-topology '{"size": 1024, "zone_count": 1, "node_type": "ml"}'
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
You'll need to run the following command to view your deployment templates:
Expand Down Expand Up @@ -75,6 +75,7 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
--enterprise_search-ref-id string Optional RefId for the Enterprise Search deployment (default "main-enterprise_search")
--enterprise_search-size int32 Memory (RAM) in MB that each of the Enterprise Search instances will have (default 4096)
--enterprise_search-zones int32 Number of zones the Enterprise Search instances will span (default 1)
-e, --es-node-topology stringArray Optional Elasticsearch node topology element definition. See help for more information
--es-ref-id string Optional RefId for the Elasticsearch deployment (default "main-elasticsearch")
--es-size int32 Memory (RAM) in MB that each of the Elasticsearch instances will have (default 4096)
--es-zones int32 Number of zones the Elasticsearch instances will span (default 1)
Expand All @@ -87,7 +88,6 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
--name string Optional name for the deployment
--plugin strings Additional plugins to add to the Elasticsearch deployment
--request-id string Optional request ID - Can be found in the Stderr device when a previous deployment creation failed. For more information see the examples in the help command page
-e, --topology-element stringArray Optional Elasticsearch topology element definition. See help for more information
-t, --track Tracks the progress of the performed task
--version string Version to use, if not specified, the latest available stack version will be used
----
Expand Down
12 changes: 6 additions & 6 deletions docs/ecctl_deployment_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ When version is not specified, the latest available stack version will automatic
These are the available options:

* Simplified flags to set size and zone count for each instance type (Elasticsearch, Kibana, APM, Enterprise Search and App Search).
* Advanced flag for different Elasticsearch node types: --topology-element <json obj> (shorthand: -e).
* Advanced flag for different Elasticsearch node types: --es-node-topology <json obj> (shorthand: -e).
Note that the flag can be specified multiple times for complex topologies.
The JSON object has the following format:
{
"name": "["data", "master", "ml"]" # type string
"node_type": "["data", "master", "ml"]" # type string
"size": 1024 # type int32
"zone_count": 1 # type int32
}
Expand All @@ -25,7 +25,7 @@ As an option "--generate-payload" can be used in order to obtain the generated p
Save it, update or extend the topology and create a deployment using the saved payload with the "--file" flag.

```
ecctl deployment create {--file | --es-size <int> --es-zones <int> | --topology-element <obj>} [flags]
ecctl deployment create {--file | --es-size <int> --es-zones <int> | --es-node-topology <obj>} [flags]
```

### Examples
Expand All @@ -44,10 +44,10 @@ $ deployment create --name my-deployment --track
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
one 1GB Elasticsearch instance of the type "ml".
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
$ ecctl deployment create --name my-deployment --es-node-topology '{"size": 1024, "zone_count": 2, "node_type": "data"}' --es-node-topology '{"size": 1024, "zone_count": 1, "node_type": "ml"}'
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
You'll need to run the following command to view your deployment templates:
Expand Down Expand Up @@ -79,6 +79,7 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
--enterprise_search-ref-id string Optional RefId for the Enterprise Search deployment (default "main-enterprise_search")
--enterprise_search-size int32 Memory (RAM) in MB that each of the Enterprise Search instances will have (default 4096)
--enterprise_search-zones int32 Number of zones the Enterprise Search instances will span (default 1)
-e, --es-node-topology stringArray Optional Elasticsearch node topology element definition. See help for more information
--es-ref-id string Optional RefId for the Elasticsearch deployment (default "main-elasticsearch")
--es-size int32 Memory (RAM) in MB that each of the Elasticsearch instances will have (default 4096)
--es-zones int32 Number of zones the Elasticsearch instances will span (default 1)
Expand All @@ -91,7 +92,6 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
--name string Optional name for the deployment
--plugin strings Additional plugins to add to the Elasticsearch deployment
--request-id string Optional request ID - Can be found in the Stderr device when a previous deployment creation failed. For more information see the examples in the help command page
-e, --topology-element stringArray Optional Elasticsearch topology element definition. See help for more information
-t, --track Tracks the progress of the performed task
--version string Version to use, if not specified, the latest available stack version will be used
```
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.13

require (
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2
github.com/go-openapi/runtime v0.19.20
github.com/go-openapi/strfmt v0.19.5
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e h1:0/5K0jfesaU/uN+ddk5iIIah3s1mADEbVCOnPK/Aeb8=
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e/go.mod h1:Lh6StXmfcUQj5TGl53rAmSjryzYEiOW6IjyAvHcuBLk=
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2 h1:+l/xm/UrwRJ+Ke/ppJLmtJAxxn9LxiRQshaTcqy3tzc=
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2/go.mod h1:Lh6StXmfcUQj5TGl53rAmSjryzYEiOW6IjyAvHcuBLk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
Expand Down

0 comments on commit b7bde30

Please sign in to comment.