-
Notifications
You must be signed in to change notification settings - Fork 897
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
fix: Always use single datasource if specified #5098
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Oops, something went wrong.
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.
Walking through this, the only way we can get
$# -eq 1
is if one of the following was configs was present:(ds|ci.ds|ci.datasource)=<some_ds_name>
cc:datasource_list: [ <some_ds_name> ] end_cc
# MAAS does this/etc/cloud/ds-identify.cfg
withdatasource: <some_ds_name>
# we should probably deprecate this as I am unsure where that's used anymore/etc/cloud/cloud.cfg.d/*
containingdatasource_list: [ <some_ds_name> ]
In those cases, the environment configuration is intentionally limiting the datasource list selection to a single datasource.
If ds-identify avoids appending fallback
None
todatasource_list
in/run/cloud-init/cloud.cfg
ds-identify, the system will no longer fallback to DataSourceNone behavior if the primary single datsource is undiscoverable. This will leave us with a slew of WARNINGs which show up in
cloud-init status --format=yaml and /var/log/cloud-init-output.log`This ultimately leaves us with a system that hasn't run any config modules at all which could make the system error conditions even less discoverable because cloud-init will not have generated SSH host keys or imported SSH pub keys to the instance. I'm not sure we want to go down this specific path, though it could be argued that a filesystem config or kernel command line that wishes to have a sensible fallback option should either provide
cc:datasource_list: [ DS_NAME, None ]
or provide that fallback in/etc/cloud/cloud.cfg.d/*.cfg
asdatasource_list: [ DS_NAME, None ]
.[update]
In either case, the fallback to DataSourceNone is undesired anyway and won't contain cloud-specific
configuration to make the instance accessible w/ user-data/network-config/vendor-data etc. The only benefit I could see from DataSourceNone over just dying with "no datasource found", is that enough config could be put into /etc/cloud/cloud.cfg.d in the DataSourceNone case to trigger correct network config, user creation and SSH key setup to allow that modified image to be more easily accessible for triage.
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.
I'm actually not sure I really believe this statement I made as the DataSourceNone on something like an Azure/Oracle/GCe/Ec2 cloud provides "more" visibility for triage. DataSourceNone won't be reading any cloud platform specific instance metadata configuration anyway which would have provided sensible config for which project/user SSH keys to import anyway. Also, most likely it wouldn't have been provided enough network configuration information to bring up the network anyway unless there was already functional static config in the image (which is possible). So, getting into that broken instance would still be problematic anyway and probably require virtual serial console to access the instance for triage.
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.
I know you've walked back most of your objection, but I just wanna make sure we're on the same page about what's changing.
Because of #2060 , I don't think this has been true since 23.2. In that PR we skipped datasource detection on the python side if we saw a single datasource or
[datasource, None]
, so DataSourceNone would never actually get used. Am I understanding this correctly? My goal with this commit is to take us back to what things were post 23.2 if a single datasource is specified.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.
You are right, I think it was 23.1 that we introduced the
override_ds_detect
. Ok, so this behavior observing the single configured datasource has really been active for a while. TheNone
fallback has been ignored as a fallback option in any such case where the single datasource went undiscoverable due tods_detect
returning False. It just hadn't hit any significant cases until this OpenStack on Oracle config issue #5091.Also, I think this current #5091 issue could also be resolved without any changes to cloud-init or ds-identify given a simple config file change if they have reasons to retain OpenStack datasource on Oracle platform.
From the looks of the DataSourceOpenStack.ds_detect. If their platform needs to use OpenStack datasource over Oracle DataSource. It looks like the following config could be provided in
/etc/cloud/cloud.cfg.d/99-delphix-datasource.cfg
This will tell the unique DataSourceOpenStack.ds_detect logic to allow OpenStack datasource detection on any system which exposes chassis asset tag=
OracleCloud.com
.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.
That said, I think your suggestion James is the correct long-term solution. If ds-identify only sees one datasource defined in datasource_list, then it really should only persist that single datasource to
/run/cloud-init/cloud.cfg
. It would honor the config provided.