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 all 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
56 changes: 56 additions & 0 deletions node/cloud.go
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
}
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(CloudParams CloudParams, waitForSSH bool) (Node, error) {
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

// Destroy destroys a node.
func Destroy(node Node) error {
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
}
16 changes: 16 additions & 0 deletions node/net.go
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
}
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
}
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 (
AWSCloud SupportedCloud = iota
GCPCloud
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
Loading