Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

User-configured cloud-config datasource is not used #2204

Closed
janeczku opened this issue Jan 3, 2018 · 3 comments
Closed

User-configured cloud-config datasource is not used #2204

janeczku opened this issue Jan 3, 2018 · 3 comments

Comments

@janeczku
Copy link
Contributor

janeczku commented Jan 3, 2018

RancherOS Version: (ros os version)
v1.1.2
Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.)
Openstack, Virtualbox

Steps to reproduce

  1. Install RancherOS v1.1.2
  2. Configure cloud-init datasource: sudo ros config set rancher.cloud_init.datasources [ec2]"
  3. Reboot
  4. Check cloud-init-save.log

Expected

cloud-config is fetched from ec2 metadata source. This was working at least up to v1.0.3.

Actual

ec2 datasource is not evaluated by cloud-init-save. It instead tries to use the default configdrive source.

init.log

time="2018-01-02T14:32:26Z" level=debug msg="[8/21] Done mount and bootstrap"
time="2018-01-02T14:32:26Z" level=info msg="[9/21] Starting cloud-init"
time="2018-01-02T14:32:26Z" level=info msg="ros init: Detected Hypervisor: xenhvm"
time="2018-01-02T14:32:26Z" level=info msg="init, runCloudInitServices([ec2])"

cloud-init-save.log

time="2018-01-02T14:32:33Z" level=info msg="Apply Network Config SyncHostname"
time="2018-01-02T14:32:33Z" level=info msg="datasources that will be consided: []string{"configdrive:/media/config-2"}"
time="2018-01-02T14:32:33Z" level=info msg="cloud-init: Checking availability of "cloud-drive""
time="2018-01-02T14:32:34Z" level=error msg="no such file or directory"
time="2018-01-02T14:32:34Z" level=info msg="cloud-init: Datasource unavailable, skipping: cloud-drive: /media/config-2 (lastError: no such file or directory)"
time="2018-01-02T14:32:34Z" level=info msg="Cloud-init datasource that was used: %!s(<nil>)"
@janeczku
Copy link
Contributor Author

janeczku commented Jan 3, 2018

/cc @r0b2g1t

@niusmallnan
Copy link
Contributor

niusmallnan commented Jan 4, 2018

Yeah, it's a bug.

We use config-drive datasource as default, but the user has set ec2 and config-drive should be overwritten.

When system-docker starts, it performs a series of tasks, something like:

preparefs
load modules
....
cloud-init
....
write cfg and log files
.....

Current, cloud-init performed prior to write cfg and log files. This causes cloud-init to execute while still unable to read the user's settings(like rancher.cloud_init.datasources).

We need to consider adjusting the startup sequence.

@kingsd041
Copy link
Contributor

Tested with RancherOS v1.2.0-rc2.
After configuring the [ec2] datasource, I can get the following log in cloud-init-save.log, I think rancheros is using ec2 data sources.

time="2018-02-01T12:29:21Z" level=info msg="Apply Network Config SyncHostname"
time="2018-02-01T12:29:21Z" level=info msg="datasources that will be consided: []string{"ec2"}"
time="2018-02-01T12:29:21Z" level=info msg="cloud-init: Checking availability of "ec2-metadata-service""
time="2018-02-01T12:29:21Z" level=error msg="IsAvailable: http://169.254.169.254/:latest/user-data (lastError: Unable to fetch data: Get http://169.254
time="2018-02-01T12:29:21Z" level=info msg="cloud-init: Datasource unavailable, skipping: metadata: http://169.254.169.254/latest/user-data (lastError:
time="2018-02-01T12:29:21Z" level=info msg="Cloud-init datasource that was used: %!s(<nil>)"
time="2018-02-01T12:29:21Z" level=debug msg="init: SaveCloudConfig(post ApplyNetworkConfig): netconf.NetworkConfig{PreCmds:[]string(nil), DNS:netconf.D
time="2018-02-01T12:29:21Z" level=info msg="Apply Network Config"

Close it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants