-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ava-labs/node-init
node init
- Loading branch information
Showing
7 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
type CloudParams struct { | ||
CommonParams | ||
AWSParams | ||
GCPParams | ||
} | ||
|
||
type CommonParams struct { | ||
// Region to use for the node | ||
Region string | ||
|
||
// Image to use for the node | ||
Image string | ||
|
||
// Instance type to use for the node | ||
InstanceType string | ||
|
||
// Static IP to use for the node | ||
StaticIP string | ||
} | ||
|
||
// AWS Paramsific configuration | ||
type AWSParams struct { | ||
// AWS profile to use for the node | ||
Profile string | ||
|
||
// AWS volume size in GB | ||
VolumeSize int | ||
|
||
// AWS volume type | ||
VolumeType string | ||
|
||
// AWS volume IOPS | ||
VolumeIOPS int | ||
|
||
// AWS volume throughput | ||
VolumeThroughput int | ||
|
||
// AWS security group to use for the node | ||
SecurityGroup string | ||
} | ||
|
||
type GCPParams struct { | ||
// GCP project to use for the node | ||
Project string | ||
|
||
// GCP credentials to use for the node | ||
Credentials string | ||
|
||
// GCP network label to use for the node | ||
Network string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
// Create creates a new node. | ||
// If wait is true, this function will block until the node is ready. | ||
func Create(CloudParams CloudParams, waitForSSH bool) (Node, error) { | ||
return Node{}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
// Destroy destroys a node. | ||
func Destroy(node Node) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
// Exec executes a command on a node. | ||
func Exec(node Node, cmd string) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
import "net" | ||
|
||
// Connect returns the connection to the node. | ||
func Connect(node Node) (*net.Conn, error) { | ||
return nil, nil | ||
} | ||
|
||
// Post sends a POST request to the node at the specified path with the provided body. | ||
func Post(node Node, path string, body string) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
// SSHConfig contains the configuration for connecting to a node over SSH | ||
type SSHConfig struct { | ||
// Username to use when connecting to the node | ||
user string | ||
|
||
// Path to the private key to use when connecting to the node | ||
// If this is empty, the SSH agent will be used | ||
KeyPath string | ||
|
||
// Parameters to pass to the ssh command. | ||
// See man ssh_config(5) for more information | ||
// By defalult it's StrictHostKeyChecking=no | ||
Params map[string]string // additional parameters to pass to the ssh command | ||
} | ||
|
||
type Node struct { | ||
// ID of the node | ||
ID string | ||
|
||
// IP address of the node | ||
IP string | ||
|
||
// SSH configuration for the node | ||
SSHConfig SSHConfig | ||
|
||
// Cloud configuration for the node | ||
Cloud SupportedCloud | ||
|
||
// CloudConfig is the cloud specific configuration for the node | ||
CloudConfig interface{} | ||
|
||
// Roles of the node | ||
Roles []SupportedRole | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package node | ||
|
||
type SupportedCloud int | ||
|
||
const ( | ||
AWSCloud SupportedCloud = iota | ||
GCPCloud | ||
Docker // fake Cloud used for E2E tests | ||
) | ||
|
||
type SupportedRole int | ||
|
||
const ( | ||
Validator SupportedRole = iota | ||
API | ||
AWMRelayer | ||
) | ||
|
||
// LoadTest and Monitor nodes are not supported yet |