Skip to content

Commit b7bde30

Browse files
authored
deployment: Change of terminology for create command (#356)
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.
1 parent 3ed0a08 commit b7bde30

File tree

7 files changed

+71
-22
lines changed

7 files changed

+71
-22
lines changed

cmd/deployment/create.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
)
3535

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

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

191191
createCmd.Flags().String("kibana-ref-id", "main-kibana", "Optional RefId for the Kibana deployment")

cmd/deployment/create_help.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ When version is not specified, the latest available stack version will automatic
2525
These are the available options:
2626
2727
* Simplified flags to set size and zone count for each instance type (Elasticsearch, Kibana, APM, Enterprise Search and App Search).
28-
* Advanced flag for different Elasticsearch node types: --topology-element <json obj> (shorthand: -e).
28+
* Advanced flag for different Elasticsearch node types: --es-node-topology <json obj> (shorthand: -e).
2929
Note that the flag can be specified multiple times for complex topologies.
3030
The JSON object has the following format:
3131
{
32-
"name": "["data", "master", "ml"]" # type string
32+
"node_type": "["data", "master", "ml"]" # type string
3333
"size": 1024 # type int32
3434
"zone_count": 1 # type int32
3535
}
@@ -53,10 +53,10 @@ $ deployment create --name my-deployment --track
5353
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
5454
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
5555
56-
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
56+
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
5757
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
5858
one 1GB Elasticsearch instance of the type "ml".
59-
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
59+
$ 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"}'
6060
6161
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
6262
You'll need to run the following command to view your deployment templates:

cmd/deployment/create_test.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,55 @@ Deployment [%s] - [Apm][%s]: running step "waiting-for-some-step" (Plan duration
542542
Stdout: string(defaultCreateResponseBytes),
543543
},
544544
},
545+
{
546+
name: "succeeds creating a deployment with ES topology element and without tracking (Normal GetCall)",
547+
args: testutils.Args{
548+
Cmd: createCmd,
549+
Args: []string{
550+
"create", "--request-id=some_request_id", "--version=7.8.0", "--es-node-topology",
551+
`{"size": 1024, "zone_count": 2, "node_type": "data"}`, "--es-node-topology",
552+
`{"size": 1024, "zone_count": 1, "node_type": "ml"}`, "--dt-as-list=false",
553+
},
554+
Cfg: testutils.MockCfg{Responses: []mock.Response{
555+
{
556+
Response: http.Response{
557+
StatusCode: 200,
558+
Body: mock.NewStructBody(defaultTemplateResponse),
559+
},
560+
Assert: &mock.RequestAssertion{
561+
Method: "GET",
562+
Header: api.DefaultReadMockHeaders,
563+
Path: "/api/v1/deployments/templates/default",
564+
Host: api.DefaultMockHost,
565+
Query: url.Values{
566+
"region": {"ece-region"},
567+
"show_instance_configurations": {"true"},
568+
},
569+
},
570+
},
571+
{
572+
Response: http.Response{
573+
StatusCode: 201,
574+
Body: mock.NewStructBody(defaultCreateResponse),
575+
},
576+
Assert: &mock.RequestAssertion{
577+
Method: "POST",
578+
Header: api.DefaultWriteMockHeaders,
579+
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"),
580+
Path: "/api/v1/deployments",
581+
Host: api.DefaultMockHost,
582+
Query: url.Values{
583+
"request_id": {"some_request_id"},
584+
"validate_only": {"false"},
585+
},
586+
},
587+
},
588+
}},
589+
},
590+
want: testutils.Assertion{
591+
Stdout: string(defaultCreateResponseBytes),
592+
},
593+
},
545594
{
546595
name: "succeeds creating a deployment with overrides and without tracking",
547596
args: testutils.Args{

docs/ecctl_deployment_create.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ When version is not specified, the latest available stack version will automatic
1212
These are the available options:
1313

1414
* Simplified flags to set size and zone count for each instance type (Elasticsearch, Kibana, APM, Enterprise Search and App Search).
15-
* 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>+++
15+
* 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>+++
1616
* 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>+++
1717

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

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

2525
[float]
@@ -39,10 +39,10 @@ $ deployment create --name my-deployment --track
3939
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
4040
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
4141
42-
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
42+
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
4343
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
4444
one 1GB Elasticsearch instance of the type "ml".
45-
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
45+
$ 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"}'
4646
4747
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
4848
You'll need to run the following command to view your deployment templates:
@@ -75,6 +75,7 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
7575
--enterprise_search-ref-id string Optional RefId for the Enterprise Search deployment (default "main-enterprise_search")
7676
--enterprise_search-size int32 Memory (RAM) in MB that each of the Enterprise Search instances will have (default 4096)
7777
--enterprise_search-zones int32 Number of zones the Enterprise Search instances will span (default 1)
78+
-e, --es-node-topology stringArray Optional Elasticsearch node topology element definition. See help for more information
7879
--es-ref-id string Optional RefId for the Elasticsearch deployment (default "main-elasticsearch")
7980
--es-size int32 Memory (RAM) in MB that each of the Elasticsearch instances will have (default 4096)
8081
--es-zones int32 Number of zones the Elasticsearch instances will span (default 1)
@@ -87,7 +88,6 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
8788
--name string Optional name for the deployment
8889
--plugin strings Additional plugins to add to the Elasticsearch deployment
8990
--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
90-
-e, --topology-element stringArray Optional Elasticsearch topology element definition. See help for more information
9191
-t, --track Tracks the progress of the performed task
9292
--version string Version to use, if not specified, the latest available stack version will be used
9393
----

docs/ecctl_deployment_create.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ When version is not specified, the latest available stack version will automatic
1010
These are the available options:
1111

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

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

3131
### Examples
@@ -44,10 +44,10 @@ $ deployment create --name my-deployment --track
4444
Deployment [b6ecbea3d5c84124b7dca457f2892086] - [Elasticsearch][b6ecbea3d5c84124b7dca457f2892086]: finished running all the plan steps (Total plan duration: 5m11.s)
4545
Deployment [91c4d60acb804ba0a27651fac02780ec] - [Kibana][8a9d9916cd6e46a7bb0912211d76e2af]: finished running all the plan steps (Total plan duration: 4m29.58s)
4646
47-
## Additionally, a more advanced topology for Elasticsearch can be created through "--topology-element" or shorthand "-e".
47+
## Additionally, a more advanced topology for Elasticsearch can be created through "--es-node-topology" or shorthand "-e".
4848
The following command will create a deployment with two 1GB Elasticsearch instances of the type "data" and
4949
one 1GB Elasticsearch instance of the type "ml".
50-
$ ecctl deployment create --name my-deployment --topology-element '{"size": 1024, "zone_count": 2, "name": "data"}' --topology-element '{"size": 1024, "zone_count": 1, "name": "ml"}'
50+
$ 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"}'
5151
5252
## In order to use the "--deployment-template" flag, you'll need to know which deployment templates ara available to you.
5353
You'll need to run the following command to view your deployment templates:
@@ -79,6 +79,7 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
7979
--enterprise_search-ref-id string Optional RefId for the Enterprise Search deployment (default "main-enterprise_search")
8080
--enterprise_search-size int32 Memory (RAM) in MB that each of the Enterprise Search instances will have (default 4096)
8181
--enterprise_search-zones int32 Number of zones the Enterprise Search instances will span (default 1)
82+
-e, --es-node-topology stringArray Optional Elasticsearch node topology element definition. See help for more information
8283
--es-ref-id string Optional RefId for the Elasticsearch deployment (default "main-elasticsearch")
8384
--es-size int32 Memory (RAM) in MB that each of the Elasticsearch instances will have (default 4096)
8485
--es-zones int32 Number of zones the Elasticsearch instances will span (default 1)
@@ -91,7 +92,6 @@ $ ecctl deployment create --request-id=GMZPMRrcMYqHdmxjIQkHbdjnhPIeBElcwrHwzVlhG
9192
--name string Optional name for the deployment
9293
--plugin strings Additional plugins to add to the Elasticsearch deployment
9394
--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
94-
-e, --topology-element stringArray Optional Elasticsearch topology element definition. See help for more information
9595
-t, --track Tracks the progress of the performed task
9696
--version string Version to use, if not specified, the latest available stack version will be used
9797
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.13
44

55
require (
66
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
7-
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e
7+
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2
88
github.com/go-openapi/runtime v0.19.20
99
github.com/go-openapi/strfmt v0.19.5
1010
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
6161
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
6262
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
6363
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
64-
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e h1:0/5K0jfesaU/uN+ddk5iIIah3s1mADEbVCOnPK/Aeb8=
65-
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200722001835-e81a08e9ee6e/go.mod h1:Lh6StXmfcUQj5TGl53rAmSjryzYEiOW6IjyAvHcuBLk=
64+
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2 h1:+l/xm/UrwRJ+Ke/ppJLmtJAxxn9LxiRQshaTcqy3tzc=
65+
github.com/elastic/cloud-sdk-go v1.0.0-beta3.0.20200727044318-7ae1b542fda2/go.mod h1:Lh6StXmfcUQj5TGl53rAmSjryzYEiOW6IjyAvHcuBLk=
6666
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
6767
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
6868
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=

0 commit comments

Comments
 (0)