Skip to content

Commit

Permalink
[CLOUD-41] return cluster nodes private ips
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautier Berthou authored Oct 12, 2022
1 parent 166490a commit 1c5b393
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ NOTES:
BREAKING CHANGES:

ENHANCEMENTS:
* return nodes private ips

BUG FIXES:

Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ Read-Only:
- `ha_enabled` (Boolean)
- `instance_type` (String)
- `node_id` (String)
- `private_ip` (String)


<a id="nestedatt--open_ports"></a>
Expand Down Expand Up @@ -260,6 +261,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--configuration"></a>
Expand Down Expand Up @@ -303,6 +305,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--management_nodes"></a>
Expand All @@ -313,6 +316,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--mysql_nodes"></a>
Expand All @@ -323,6 +327,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--single_node"></a>
Expand All @@ -332,6 +337,7 @@ Read-Only:

- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)



Expand All @@ -352,6 +358,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)
- `spot_config` (List of Object) (see [below for nested schema](#nestedobjatt--workers--spot_config))

<a id="nestedobjatt--workers--spot_config"></a>
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ Read-Only:
- `ha_enabled` (Boolean)
- `instance_type` (String)
- `node_id` (String)
- `private_ip` (String)


<a id="nestedobjatt--clusters--open_ports"></a>
Expand Down Expand Up @@ -284,6 +285,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--clusters--rondb--configuration"></a>
Expand Down Expand Up @@ -327,6 +329,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--clusters--rondb--management_nodes"></a>
Expand All @@ -337,6 +340,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--clusters--rondb--mysql_nodes"></a>
Expand All @@ -347,6 +351,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--clusters--rondb--single_node"></a>
Expand All @@ -356,6 +361,7 @@ Read-Only:

- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)



Expand All @@ -376,6 +382,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)
- `spot_config` (List of Object) (see [below for nested schema](#nestedobjatt--clusters--workers--spot_config))

<a id="nestedobjatt--clusters--workers--spot_config"></a>
Expand Down
25 changes: 25 additions & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Optional:
Read-Only:

- `node_id` (String) The corresponding aws/azure instance id of the head node.
- `private_ip` (String) Private IP of the head node.


<a id="nestedblock--rondb"></a>
Expand All @@ -178,6 +179,10 @@ Optional:
- `count` (Number) The number of API nodes. Defaults to `0`.
- `disk_size` (Number) The disk size of API nodes in units of GB Defaults to `30`.

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes


<a id="nestedblock--rondb--configuration"></a>
### Nested Schema for `rondb.configuration`
Expand Down Expand Up @@ -224,6 +229,10 @@ Optional:
- `count` (Number) The number of data nodes. Notice that the number of RonDB data nodes have to be multiples of the replication_factor. Defaults to `2`.
- `disk_size` (Number) The disk size of data nodes in units of GB Defaults to `512`.

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes


<a id="nestedblock--rondb--management_nodes"></a>
### Nested Schema for `rondb.management_nodes`
Expand All @@ -237,6 +246,10 @@ Optional:
- `count` (Number) The number of management nodes. Defaults to `1`.
- `disk_size` (Number) The disk size of management nodes in units of GB Defaults to `30`.

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes


<a id="nestedblock--rondb--mysql_nodes"></a>
### Nested Schema for `rondb.mysql_nodes`
Expand All @@ -250,6 +263,10 @@ Optional:
- `count` (Number) The number of MySQL nodes. Defaults to `1`.
- `disk_size` (Number) The disk size of MySQL nodes in units of GB Defaults to `128`.

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes


<a id="nestedblock--rondb--single_node"></a>
### Nested Schema for `rondb.single_node`
Expand All @@ -262,6 +279,10 @@ Optional:

- `disk_size` (Number) The disk size of data nodes in units of GB Defaults to `512`.

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes



<a id="nestedblock--autoscale"></a>
Expand Down Expand Up @@ -486,6 +507,10 @@ Optional:
- `disk_size` (Number) The disk size of worker nodes in units of GB Defaults to `512`.
- `spot_config` (Block List, Max: 1) The configuration to use spot instances (see [below for nested schema](#nestedblock--workers--spot_config))

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes

<a id="nestedblock--workers--spot_config"></a>
### Nested Schema for `workers.spot_config`

Expand Down
12 changes: 11 additions & 1 deletion docs/resources/cluster_from_backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use this resource to create a cluster from an existing backup.

```terraform
resource "hopsworksai_cluster_from_backup" "cluster" {
backup_id = "<BACKUP ID>"
source_backup_id = "<BACKUP ID>"
}
```

Expand Down Expand Up @@ -279,6 +279,10 @@ Optional:
- `disk_size` (Number) The disk size of worker nodes in units of GB Defaults to `512`.
- `spot_config` (Block List, Max: 1) The configuration to use spot instances (see [below for nested schema](#nestedblock--workers--spot_config))

Read-Only:

- `private_ips` (List of String) Array containing the private IPs of the nodes

<a id="nestedblock--workers--spot_config"></a>
### Nested Schema for `workers.spot_config`

Expand All @@ -298,6 +302,7 @@ Read-Only:
- `ha_enabled` (Boolean)
- `instance_type` (String)
- `node_id` (String)
- `private_ip` (String)


<a id="nestedatt--rondb"></a>
Expand All @@ -320,6 +325,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--configuration"></a>
Expand Down Expand Up @@ -363,6 +369,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--management_nodes"></a>
Expand All @@ -373,6 +380,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--mysql_nodes"></a>
Expand All @@ -383,6 +391,7 @@ Read-Only:
- `count` (Number)
- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)


<a id="nestedobjatt--rondb--single_node"></a>
Expand All @@ -392,6 +401,7 @@ Read-Only:

- `disk_size` (Number)
- `instance_type` (String)
- `private_ips` (List of String)



Expand Down
16 changes: 12 additions & 4 deletions hopsworksai/data_source_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ func TestClusterDataSourceRead_AWS(t *testing.T) {
"head": {
"instanceType": "node-type-1",
"diskSize": 512,
"nodeId": "head-node-id-1"
"nodeId": "head-node-id-1",
"privateIp": "headIp"
},
"workers": [
{
"instanceType": "node-type-2",
"diskSize": 256,
"count": 2
"count": 2,
"privateIps": ["ip1", "ip2"]
}
]
},
Expand Down Expand Up @@ -164,6 +166,7 @@ func TestClusterDataSourceRead_AWS(t *testing.T) {
"disk_size": 512,
"node_id": "head-node-id-1",
"ha_enabled": false,
"private_ip": "headIp",
},
},
"workers": schema.NewSet(helpers.WorkerSetHash, []interface{}{
Expand All @@ -172,6 +175,7 @@ func TestClusterDataSourceRead_AWS(t *testing.T) {
"disk_size": 256,
"count": 2,
"spot_config": []interface{}{},
"private_ips": []interface{}{"ip1", "ip2"},
},
}),
"attach_public_ip": true,
Expand Down Expand Up @@ -240,13 +244,15 @@ func TestClusterDataSourceRead_AZURE(t *testing.T) {
"head": {
"instanceType": "node-type-1",
"diskSize": 512,
"nodeId": "head-node-id-1"
"nodeId": "head-node-id-1",
"privateIp": "headIp"
},
"workers": [
{
"instanceType": "node-type-2",
"diskSize": 256,
"count": 2
"count": 2,
"privateIps": ["ip1", "ip2"]
}
]
},
Expand Down Expand Up @@ -295,6 +301,7 @@ func TestClusterDataSourceRead_AZURE(t *testing.T) {
"disk_size": 512,
"node_id": "head-node-id-1",
"ha_enabled": false,
"private_ip": "headIp",
},
},
"workers": schema.NewSet(helpers.WorkerSetHash, []interface{}{
Expand All @@ -303,6 +310,7 @@ func TestClusterDataSourceRead_AZURE(t *testing.T) {
"disk_size": 256,
"count": 2,
"spot_config": []interface{}{},
"private_ips": []interface{}{"ip1", "ip2"},
},
}),
"attach_public_ip": true,
Expand Down
3 changes: 3 additions & 0 deletions hopsworksai/data_source_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func TestClustersDataSourceRead(t *testing.T) {
"disk_size": 0,
"node_id": "",
"ha_enabled": false,
"private_ip": "",
},
},
"workers": schema.NewSet(helpers.WorkerSetHash, []interface{}{}),
Expand Down Expand Up @@ -240,6 +241,7 @@ func TestClustersDataSourceRead(t *testing.T) {
"disk_size": 0,
"node_id": "",
"ha_enabled": false,
"private_ip": "",
},
},
"workers": schema.NewSet(helpers.WorkerSetHash, []interface{}{}),
Expand Down Expand Up @@ -298,6 +300,7 @@ func TestClustersDataSourceRead(t *testing.T) {
"disk_size": 0,
"node_id": "",
"ha_enabled": false,
"private_ip": "",
},
},
"workers": schema.NewSet(helpers.WorkerSetHash, []interface{}{}),
Expand Down
11 changes: 7 additions & 4 deletions hopsworksai/internal/api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ type RonDBBaseConfiguration struct {

type RonDBNodeConfiguration struct {
NodeConfiguration
Count int `json:"count"`
Count int `json:"count"`
PrivateIps []string `json:"privateIps,omitempty"`
}

type RonDBConfiguration struct {
Expand Down Expand Up @@ -270,8 +271,9 @@ type HeadConfiguration struct {

type WorkerConfiguration struct {
NodeConfiguration
Count int `json:"count"`
SpotInfo *SpotConfiguration `json:"spotInfo,omitempty"`
Count int `json:"count"`
SpotInfo *SpotConfiguration `json:"spotInfo,omitempty"`
PrivateIps []string `json:"privateIps,omitempty"`
}

type ClusterConfiguration struct {
Expand All @@ -281,7 +283,8 @@ type ClusterConfiguration struct {

type HeadConfigurationStatus struct {
HeadConfiguration
NodeId string `json:"nodeId"`
NodeId string `json:"nodeId"`
PrivateIp string `json:"privateIp,omitempty"`
}

type ClusterConfigurationStatus struct {
Expand Down
Loading

0 comments on commit 1c5b393

Please sign in to comment.