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

[CLI] Cannot run make localnet_client_debug: Cannot initialise the keybase with the validator keys: Unable to find YAML file #517

Merged
merged 8 commits into from
Feb 16, 2023

Conversation

deblasis
Copy link
Contributor

Description

This PR introduces the ability to fetch private keys when running in Kubernetes

Issue

Fixes #516

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Added the ability to detect if running inside a Kubernetes Pod
  • Introduced logical switch to handle parsing of the debug private keys from a local file OR from Kubernetes
  • Introduced the Kubernetes manifests necessary to grant permissions to the debug client (least privilege)

Testing

  • make develop_test
  • LocalNet w/ all of the steps outlined in the README

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have tested my changes using the available tooling
  • 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 diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@deblasis deblasis added bug Something isn't working - expected behaviour is incorrect infra Core infrastructure - not protocol related client work needed to interface with the node (rpc, cli, etc..) labels Feb 15, 2023
@deblasis deblasis self-assigned this Feb 15, 2023
@deblasis deblasis marked this pull request as ready for review February 15, 2023 20:32
@deblasis deblasis requested a review from Olshansk February 15, 2023 20:34
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nites. Let's tend to it and merge it in.

Also, while looking into this, I realized that chatGPT can be great for helping write k8s manifest templates

shared/k8s/debug.go Outdated Show resolved Hide resolved
shared/k8s/debug.go Outdated Show resolved Hide resolved
shared/k8s/debug.go Outdated Show resolved Hide resolved
}

for id, privHexString := range private_keys_secret.Data {
validatorKeysMap[id] = string(privHexString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the hex string stored as utf8 encoded bytes in Data? If so, just add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation says it's base64 encoded but it's not. simply casting to string returns the actual encoded private key.

image

An experiment I just did:

image

pk represents the base64 decoded value from what is not base64 encoded

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're encoding it to base64, but then casting it to a byte slice which is just "a weird thing to do" unless you want to get the byte count of the string or something.

Sound correct? Can you add a TODO/BUG next to the Data attribute so we don't lose this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that's K8S documentation, they return a []byte and say that it's base64 encoded but it's not.

app/client/keybase/debug/keystore.go Outdated Show resolved Hide resolved
@deblasis deblasis requested a review from Olshansk February 16, 2023 01:11
@deblasis
Copy link
Contributor Author

Just a few nites. Let's tend to it and merge it in.

@Olshansk it should be good to go

Also, while looking into this, I realized that chatGPT can be great for helping write k8s manifest templates

I have snippets in VSCode from my Hashicorp days for templates, the tooling improved A LOT over the years.

Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deblasis deblasis merged commit 3407bff into main Feb 16, 2023
@Olshansk Olshansk deleted the issue/keybase_debug_k8s_localnet_fix branch February 16, 2023 01:47
bryanchriswhite added a commit that referenced this pull request Feb 20, 2023
* pokt/main:
  [Infra] KISS 3 - Cluster Manager [Merge me after #521] - (Issues: #490) (#522)
  Refactor/fix state sync logs (#515)
  [P2P] KISS 2 - Peer discovery [Merge me after #520] - (Issues: #416, #429) (#521)
  [Core] KISS 1 - Finite State Machine [Merge me first] - (Issue: #499) (#520)
  [CLI] Stake command bugfix (#518)
  [CLI] Cannot run make localnet_client_debug: Cannot initialise the keybase with the validator keys: Unable to find YAML file (#517)
  Fix the link shown by `make go_doc`
  Fixed duplicate GITHUB_WIKI tag
  [Documentation] Update Devlog Formatting (#512)
  [Docs & Bugs] Minor fixes post keybase changes (#513)
  [Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2) (#503)
  [Tooling] Integrate Keybase w/ CLI (Issue #484 ) (#501)
  update devlog2.md
  update devlog2.md
  Update devlog1.md
bryanchriswhite added a commit that referenced this pull request Feb 20, 2023
* pokt/main:
  [Infra] KISS 3 - Cluster Manager [Merge me after #521] - (Issues: #490) (#522)
  Refactor/fix state sync logs (#515)
  [P2P] KISS 2 - Peer discovery [Merge me after #520] - (Issues: #416, #429) (#521)
  [Core] KISS 1 - Finite State Machine [Merge me first] - (Issue: #499) (#520)
  [CLI] Stake command bugfix (#518)
  [CLI] Cannot run make localnet_client_debug: Cannot initialise the keybase with the validator keys: Unable to find YAML file (#517)
  Fix the link shown by `make go_doc`
  Fixed duplicate GITHUB_WIKI tag
  [Documentation] Update Devlog Formatting (#512)
  [Docs & Bugs] Minor fixes post keybase changes (#513)
  [Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2) (#503)
  [Tooling] Integrate Keybase w/ CLI (Issue #484 ) (#501)
  update devlog2.md
  update devlog2.md
  Update devlog1.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working - expected behaviour is incorrect client work needed to interface with the node (rpc, cli, etc..) infra Core infrastructure - not protocol related
Projects
Status: Done
2 participants