Closed wangxin311 closed 1 year ago
Cloud-init can use Hegel via the EC2 metadata support. See https://docs.tinkerbell.org/services/hegel
See https://cloudinit.readthedocs.io/en/latest/topics/datasources/ec2.html#configuration for how to configure custom metadata URLs.
As described in https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html#datasource-nocloud, these values can be provided in the Kernel command line arguments:
ds=ec2;metadata_urls=http://{insert_hegel_ip_and_port}/
You can use a workflow like https://artifacthub.io/packages/tbaction/tinkerbell-community/kexec to provide a custom kernel argument (CMD_LINE
).
Alternatively, with https://artifacthub.io/packages/tbaction/tinkerbell-community/writefile you can write a custom cloud.cfg file (https://cloudinit.readthedocs.io/en/latest/topics/faq.html#where-are-the-configuration-files) which defines the location of the metadata service, similar to https://github.com/tinkerbell/osie-og/blob/ebbe709e1f2b035fe2345e99a8d3aed77f2c22a4/docker/scripts/osie.sh#L298-L307.
You would want to replace metadata.packet.net with the Hegel address via templated workflows and variables (https://docs.tinkerbell.org/templates/ and https://docs.tinkerbell.org/workflows/working-with-workflows/#creating-a-workflow)).
I think we can improve the documentation at https://docs.tinkerbell.org/services/hegel to more easily demonstrate how to do this.
Is that what you were looking for @wangxin311?
@nshalman has some experience with this
sounds like we could definitely use some help documenting how to integrate with cloud-init. Anyone out there that has done this or is interested in this?? We could most definitely use help creating this document.
There's an on-going documentation overhaul effort. I've added this as something for consideration. For more information please track https://github.com/tinkerbell/roadmap/issues/5.
For service provisioning, customer need pass cloud-init info to create user/get package, etc. tink should handle cloud-init via metadata, but it's not clear on how to pass cloud-init data to metadata server and retrieve it during boot up.