Skip to content

Commit

Permalink
[Infra] KISS 3 - Cluster Manager [Merge me after #521] - (Issues: #490)…
Browse files Browse the repository at this point in the history
… (#522)

## Description

This PR has been extracted from #491 and is, hopefully, more digestible
from a code-review and scope point of view.

## Issue

Fixes #490 

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- When nodes are added/removed from the Kubernetes Localnet, we
stake/unstake them automatically
- We achieve the above by dogfooding our own CLI inside Kubernetes

## Testing

- [x] `make develop_test`
- [x]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`


## Required Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have tested my changes using the available tooling
- [x] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)

---------

Signed-off-by: Alessandro De Blasis <[email protected]>
Co-authored-by: Dmitry Knyazev <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Dmitry K <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
  • Loading branch information
5 people authored Feb 17, 2023
1 parent e4267c4 commit 6da420c
Show file tree
Hide file tree
Showing 55 changed files with 12,330 additions and 48 deletions.
9 changes: 6 additions & 3 deletions app/client/cli/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ If no changes are desired for the parameter, just enter the current param value
return err
}

pwd = readPassphrase(pwd)
if !nonInteractive {
pwd = readPassphrase(pwd)
}

pk, err := kb.GetPrivKey(fromAddrHex, pwd)
if err != nil {
Expand Down Expand Up @@ -248,8 +250,9 @@ func newUnstakeCmd(cmdDef actorCmdDef) *cobra.Command {
return err
}

pwd = readPassphrase(pwd)

if !nonInteractive {
pwd = readPassphrase(pwd)
}
pk, err := kb.GetPrivKey(fromAddrHex, pwd)
if err != nil {
return err
Expand Down
6 changes: 4 additions & 2 deletions app/client/cli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ const (
)

var (
remoteCLIURL string
dataDir string
remoteCLIURL string
dataDir string
nonInteractive bool
)

func init() {
Expand All @@ -27,6 +28,7 @@ func init() {
log.Fatalf("[ERROR] Cannot find user home directory: %s", err.Error())
}
rootCmd.PersistentFlags().StringVar(&remoteCLIURL, "remote_cli_url", defaults.DefaultRemoteCLIURL, "takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port)")
rootCmd.PersistentFlags().BoolVar(&nonInteractive, "non_interactive", false, "if true skips the interactive prompts wherever possible (useful for scripting & automation)")
rootCmd.PersistentFlags().StringVar(&dataDir, "data_dir", homeDir+"/.pocket", "Path to store pocket related data (keybase etc.)")
}

Expand Down
1 change: 1 addition & 0 deletions app/client/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.0.0.15] - 2023-02-17

- Added `non_interactive` flag to allow for non-interactive `Stake` and `Unstake` transactions (dogfooding in `cluster-manager`)
- Updated CLI to use to source the address book and the current height from the RPC server leveraging the `rpcAddressBookProvider` and `rpcCurrentHeightProvider` respectively and the `bus` for dependency injection

## [0.0.0.14] - 2023-02-15
Expand Down
3 changes: 2 additions & 1 deletion app/client/doc/commands/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The CLI is meant to be an user but also a machine friendly way for interacting w
```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
-h, --help help for client
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -26,4 +27,4 @@ The CLI is meant to be an user but also a machine friendly way for interacting w
* [client Validator](client_Validator.md) - Validator actor specific commands
* [client debug](client_debug.md) - Debug utility for rapid development

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Account specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -20,4 +21,4 @@ Account specific commands
* [client](client.md) - Pocket Network Command Line Interface (CLI)
* [client Account Send](client_Account_Send.md) - Send <fromAddr> <to> <amount>

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Account_Send.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Account Send <fromAddr> <to> <amount> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Account](client_Account.md) - Account specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Application.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Application actor specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -23,4 +24,4 @@ Application actor specific commands
* [client Application Unpause](client_Application_Unpause.md) - Unpause <fromAddr>
* [client Application Unstake](client_Application_Unstake.md) - Unstake <fromAddr>

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Application_EditStake.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Application EditStake <fromAddr> <amount> <relayChainIDs> <serviceURI> [f

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Application](client_Application.md) - Application actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Application_Stake.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ client Application Stake <fromAddr> <amount> <relayChainIDs> <serviceURI> [flags

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Application](client_Application.md) - Application actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Application_Unpause.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Application Unpause <fromAddr> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Application](client_Application.md) - Application actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Application_Unstake.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Application Unstake <fromAddr> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Application](client_Application.md) - Application actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Consensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Consensus specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -23,4 +24,4 @@ Consensus specific commands
* [client Consensus State](client_Consensus_State.md) - Returns "Height/Round/Step"
* [client Consensus Step](client_Consensus_Step.md) - Returns the Step

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Consensus_Height.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ client Consensus Height [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Consensus](client_Consensus.md) - Consensus specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Consensus_Round.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ client Consensus Round [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Consensus](client_Consensus.md) - Consensus specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Consensus_State.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ client Consensus State [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Consensus](client_Consensus.md) - Consensus specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Consensus_Step.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ client Consensus Step [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Consensus](client_Consensus.md) - Consensus specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Fisherman.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Fisherman actor specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -23,4 +24,4 @@ Fisherman actor specific commands
* [client Fisherman Unpause](client_Fisherman_Unpause.md) - Unpause <fromAddr>
* [client Fisherman Unstake](client_Fisherman_Unstake.md) - Unstake <fromAddr>

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Fisherman_EditStake.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Fisherman EditStake <fromAddr> <amount> <relayChainIDs> <serviceURI> [fla

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Fisherman](client_Fisherman.md) - Fisherman actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Fisherman_Stake.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ client Fisherman Stake <fromAddr> <amount> <relayChainIDs> <serviceURI> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Fisherman](client_Fisherman.md) - Fisherman actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Fisherman_Unpause.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Fisherman Unpause <fromAddr> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Fisherman](client_Fisherman.md) - Fisherman actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Fisherman_Unstake.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Fisherman Unstake <fromAddr> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Fisherman](client_Fisherman.md) - Fisherman actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Governance specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -20,4 +21,4 @@ Governance specific commands
* [client](client.md) - Pocket Network Command Line Interface (CLI)
* [client Governance ChangeParameter](client_Governance_ChangeParameter.md) - ChangeParameter <owner> <key> <value>

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Governance_ChangeParameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Governance ChangeParameter <owner> <key> <value> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Governance](client_Governance.md) - Governance specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Node actor specific commands

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

Expand All @@ -23,4 +24,4 @@ Node actor specific commands
* [client Node Unpause](client_Node_Unpause.md) - Unpause <fromAddr>
* [client Node Unstake](client_Node_Unstake.md) - Unstake <fromAddr>

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Node_EditStake.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Node EditStake <fromAddr> <amount> <relayChainIDs> <serviceURI> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Node](client_Node.md) - Node actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Node_Stake.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ client Node Stake <fromAddr> <amount> <relayChainIDs> <serviceURI> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Node](client_Node.md) - Node actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
3 changes: 2 additions & 1 deletion app/client/doc/commands/client_Node_Unpause.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ client Node Unpause <fromAddr> [flags]

```
--data_dir string Path to store pocket related data (keybase etc.) (default "/Users/olshansky/.pocket")
--non_interactive if true skips the interactive prompts wherever possible (useful for scripting & automation)
--remote_cli_url string takes a remote endpoint in the form of <protocol>://<host> (uses RPC Port) (default "http://localhost:50832")
```

### SEE ALSO

* [client Node](client_Node.md) - Node actor specific commands

###### Auto generated by spf13/cobra on 14-Feb-2023
###### Auto generated by spf13/cobra on 17-Feb-2023
Loading

0 comments on commit 6da420c

Please sign in to comment.