Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add POC datasource for Ec2 / Kubernetes
How it works ------------ This datasource uses the default EC2 datasource to get the bootscript that is provided by cluster-api-provider-aws[1]. This bootscript retrieves retrieves user-data from AWS SSM Parameter Store using the aws cli and writes user-data to the file /etc/secret-userdata.txt[2]. Cloud-init manually processes the bootscript and then it loads the contents of the file /etc/secret-userdata.txt and passes that off to cloud-init as the user-data, which is then processed in later stages. How to use it ------------- This datasource may be used as a drop-in datasource. To use it on Ubuntu, for example, this file must be placed in the datasource directory[3]. Then the following configuration must be set: ``` echo "datasource_list: [ Ec2Kubernetes ]" > /etc/cloud/cloud.cfg.d/90_dpkg.cfg ``` This configuration tells cloud-init to use the new drop-in datasource on first boot. After making these changes, create a new image from a snapshot. First boot of the image should use the custom datasource. [1] https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/v2.4.2/pkg/cloud/services/ssm/secret_fetch_script.go [2] As written, the bootscript also tries to restart cloud-init's network stage, however this datasource uses a custom boothook part handler to manually disable the restart command (which will be broken on Oracular++). [3] /usr/lib/python3/dist-packages/cloudinit/sources/DataSourceEc2Kubernetes.py
- Loading branch information