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

[vtadmin] full dynamic cluster config #10071

Merged

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Apr 11, 2022

Description

This PR changes the unmarshalling technique used for dynamic cluster configs, to support a fully-configured dynamic cluster with parity to what you can do on the CLI.

The most notable changes for end users are:

  • you must specify an id key rather than a name key. you should also specify a name key, but it's not strictly required.
  • you must specify your discovery implementation name. this means you can use dynamic clusters with other discovery implementations (like consul!) "for free"
  • when using dynamic discovery with a dynamic cluster (boy that's a lotta "dynamic"), you are technically going through a double layer (mmmm, burritosssss) of json unmarshalling, which means your discovery-dynamic-discovery option must be properly quoted and escaped (see the tests).

Below are some screenshots where I uploaded first the original dynamic cluster, and then a dynamic cluster with some configuration options. Here are the configs used:

minimal dynamic cluster

{
    "id": "dynamic",
    "name": "my-dynamic-cluster",
    "discovery": "dynamic",
    "discovery-dynamic-discovery": "{\"vtctlds\": [ { \"host\": { \"fqdn\": \"localhost:15000\", \"hostname\": \"localhost:15999\" } } ], \"vtgates\": [ { \"host\": {\"hostname\": \"localhost:15991\" } } ] }"
}

configured

{
    "id": "dynamic2",
    "name": "my-configured-dynamic-cluster",
    "discovery": "dynamic",
    "discovery-dynamic-discovery": "{\"vtctlds\": [ { \"host\": { \"fqdn\": \"localhost:15000\", \"hostname\": \"localhost:15999\" } } ], \"vtgates\": [ { \"host\": {\"hostname\": \"localhost:15991\" } } ] }",
    "vtsql-discovery-timeout": "1h"
}

Pulling up the debug page for the configured cluster, we can see that the vtsql discovery timeout did indeed get set to 1h, rather than the default 100ms:

 curl -s localhost:14200/debug/cluster/dynamic2 | jq '.' | grep timeout      
      "discovery-timeout": "1h"
      "discovery_timeout": 100000000,
      "discovery_timeout": 3600000000000,

Screen Shot 2022-04-11 at 1 54 26 PM

Screen Shot 2022-04-11 at 1 56 46 PM

Related Issue(s)

Checklist

  • Should this PR be backported? no
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Andrew Mason added 2 commits April 11, 2022 14:17
…ions

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Copy link
Contributor

@notfelineit notfelineit left a comment

Choose a reason for hiding this comment

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

🎉

@ajm188 ajm188 merged commit 70f944d into vitessio:main Apr 12, 2022
@ajm188 ajm188 deleted the andrew/vtadmin/full-dynamic-cluster-config branch April 12, 2022 16:19
notfelineit pushed a commit to planetscale/vitess that referenced this pull request May 3, 2022
* [vtadmin] Remove deprecated dynamic cluster flag (vitessio#10067)

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* [vtadmin] full dynamic cluster config (vitessio#10071)

* [vtadmin] full unmarshal of dynamic cluster config to support all options

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* [vtadmin] update tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change Component: VTAdmin VTadmin interface Type: Enhancement Logical improvement (somewhere between a bug and feature) Type: Feature Request Type: Internal Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants