-
Notifications
You must be signed in to change notification settings - Fork 4
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
YDBOPS-10613 Dynconfigs #62
Open
elabpro
wants to merge
13
commits into
ydb-platform:main
Choose a base branch
from
elabpro:YDBOPS-10613
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ddf842f
module, variable, initial steps
40ac992
Merge branch 'ydb-platform:main' into YDBOPS-10613
elabpro 49a3e08
+custom dynconfig
6c94806
Fixes
19d5474
Dyn config support
216f617
Get current dynconfig version
41b0151
Fix problem with PDisks
568a24f
Create dynamic config + common config like template
a31e4c4
Update plugins/modules/init_storage.py
elabpro 4962326
Merge branch 'main' into YDBOPS-10613
744b9c2
Remove dupes
101028a
+documentation
e1c98e0
remove variable
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from ansible.module_utils.basic import AnsibleModule | ||
from ansible_collections.ydb_platform.ydb.plugins.module_utils import cli | ||
|
||
|
||
def main(): | ||
argument_spec=dict( | ||
config=dict(type='str', default=""), | ||
) | ||
cli.YDB.add_arguments(argument_spec) | ||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False) | ||
configFilename = module.params.get('config') | ||
result = {'changed': False} | ||
try: | ||
ydb_cli = cli.YDB.from_module(module) | ||
rc, stdout, stderr = ydb_cli(['admin', 'config', 'replace','-f',configFilename]) | ||
if rc != 0: | ||
result['msg'] = f'command: "ydb admin config replace" failed' | ||
result['stderr'] = stderr | ||
module.fail_json(**result) | ||
|
||
result['msg'] = 'command: "ydb admin config replace" succeeded' | ||
module.exit_json(**result) | ||
|
||
except Exception as e: | ||
result['msg'] = f'unexpected exception: {e}' | ||
module.fail_json(**result) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import re | ||
|
||
# | ||
# This module returns current version of dynamic config | ||
# The result is stored in 'version' variable of returning dict | ||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ansible_collections.ydb_platform.ydb.plugins.module_utils import cli | ||
|
||
def main(): | ||
argument_spec=dict( | ||
timeout=dict(type='int', default=180), | ||
) | ||
cli.YDB.add_arguments(argument_spec) | ||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False) | ||
result = {'changed': False, 'version': 0} | ||
try: | ||
ydb_cmd = ['admin', 'config', 'fetch'] | ||
ydb_cli = cli.YDB.from_module(module) | ||
rc, stdout, stderr = ydb_cli(ydb_cmd) | ||
if rc != 0: | ||
# We get 1 exit code if no YAML config in cluster | ||
result['msg'] = f'command: "ydb admin config fetch" failed' | ||
else: | ||
match = re.search(r'version:\s*(\d+)', stdout) | ||
if match: | ||
version = int(match.group(1)) | ||
result['version'] = version | ||
result['msg'] = '' | ||
module.exit_json(**result) | ||
|
||
except Exception as e: | ||
result['msg'] = f'unexpected exception: {e}' | ||
module.fail_json(**result) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
ydb_database_groups: 1 | ||
ydb_request_client_certificate: false | ||
# ydb_use_dynamic_config - define how to configure dynamic nodes - static or dynamic configs | ||
# Default value: false | ||
ydb_use_dynamic_config: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
ydb_allow_format_drives: false | ||
ydb_skip_data_loss_confirmation_prompt: false | ||
ydb_enforce_user_token_requirement: true | ||
# ydb_use_dynamic_config - define how to configure dynamic nodes - static or dynamic configs | ||
# Default value: false | ||
ydb_use_dynamic_config: false | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
metadata: | ||
cluster: "" | ||
version: {{ ydb_dynconfig_info['version'] }} | ||
config: | ||
# This parameter must be set in 'true' | ||
yaml_config_enabled: true | ||
actor_system_config: | ||
# Auto configure node by using number of CPU cores | ||
use_auto_config: true | ||
# Type of the node (HYBRID, COMPUTE, STORAGE) | ||
node_type: COMPUTE | ||
# Number of CPU cores | ||
cpu_count: {{ ydb_cores_dynamic }} | ||
{{ lookup('ansible.builtin.template', '{{ ydb_config }}') | indent( width=2, first=True) }} | ||
allowed_labels: {} | ||
selector_config: [] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's time to introduce the concept of playbook feature flags. I don't think we'd want to keep this setting around long-term: it's more like to test this new approach, make it default at some point and then deprecate the current approach. So it could be like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good idea for single roles, but we might have problems in our structure
playbook1 (feature_flag: feature1, feature3) -> role1 (feature_flag: feature1)
playbook1 (feature_flag: feature1, feature3) -> role2 (feature_flag: feature1, feature2)
in this case role2 will lost feature2 default value