Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node init #4

Merged
merged 8 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions node/cloud.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package node

type CloudSpec struct {
arturrez marked this conversation as resolved.
Show resolved Hide resolved
CommonSpec
AWSSpec
GCPSpec
}

type CommonSpec 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
}

// AWS specific configuration
type AWSSpec 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 Elastic IP to use for the node
ElasticIP string
felipemadero marked this conversation as resolved.
Show resolved Hide resolved

// AWS security group to use for the node
SecurityGroup string
}

type GCPSpec struct {
// GCP project to use for the node
Project string

// GCP credentials to use for the node
Credentials string

// GCP static IP to use for the node
StaticIP string

// GCP network label to use for the node
Network string
}
10 changes: 10 additions & 0 deletions node/create.go
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(cloudSpec CloudSpec, wait bool) (Node, error) {
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
return Node{}, nil
}
9 changes: 9 additions & 0 deletions node/destroy.go
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

// Destoy destroys a node.
func Destoy(node Node) error {
arturrez marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
9 changes: 9 additions & 0 deletions node/exec.go
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
}
39 changes: 39 additions & 0 deletions node/node.go
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
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
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
}
9 changes: 9 additions & 0 deletions node/post.go
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

// Post sends a POST request to the node at the specified path with the provided body.
felipemadero marked this conversation as resolved.
Show resolved Hide resolved
func Post(node Node, path string, body string) error {
return nil
}
22 changes: 22 additions & 0 deletions node/supported.go
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 (
AWS SupportedCloud = iota
arturrez marked this conversation as resolved.
Show resolved Hide resolved
GCP
Docker // fake Cloud used for E2E tests
)

type SupportedRole int

const (
Validator SupportedRole = iota
arturrez marked this conversation as resolved.
Show resolved Hide resolved
API
AWMRelayer
)

// LoadTest and Monitor nodes are not supported yet
3 changes: 1 addition & 2 deletions subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

package subnet

type Subnet struct {
}
type Subnet struct{}