Skip to content
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

Add basic cloud-init userdata primitives to one-context #129

Open
sk4zuzu opened this issue Oct 22, 2024 · 0 comments · May be fixed by #130
Open

Add basic cloud-init userdata primitives to one-context #129

sk4zuzu opened this issue Oct 22, 2024 · 0 comments · May be fixed by #130
Assignees
Labels
category: context linux Linux OS contextualization packages type: feature A new feature planned for implementation

Comments

@sk4zuzu
Copy link
Contributor

sk4zuzu commented Oct 22, 2024

Because of the cluster-api implementation for OpenNebula we found ourselves in a need to parse cloud-init compatible user-data structure in one-context (linux).

For now the requirement is to support basic yaml structure like the following:

#cloud-config
write_files:
-   path: /run/cluster-api/placeholder
    owner: root:root
    permissions: '0640'
    content: "This placeholder file is used to create the /run/cluster-api sub directory in a way that is compatible with both Linux and Windows (mkdir -p /run/cluster-api does not work with Windows)"
runcmd:
  - 'kubeadm init --config /run/kubeadm/kubeadm.yaml  && echo success > /run/cluster-api/bootstrap-success.complete'
  - "set -e; if test -d /etc/kubernetes/super-admin.conf; then\n\n   mv /etc/kubernetes/manifests/kube-vip.yaml /var/tmp/;\n   sleep 1;\n   rmdir /etc/kubernetes/super-admin.conf/ || true;\n   kubeadm init phase kubeconfig super-admin || true;\n   mv /var/tmp/kube-vip.yaml /etc/kubernetes/manifests/; fi"
  1. Fully implemented write_files: and runcmd: is something we need to progress with cluster API, one-context (linux) has to decode and parse the userdata, then create files and run commands.
  2. This solution https://github.com/canonical/cloud-init/blob/197409efda9e7f6feec1d6a85f7a6b2ad7ad1ec5/cloudinit/sources/DataSourceOpenNebula.py#L465-L480 for passing the yaml userdata in the VM context seems reasonable.
  3. An example config in a running VM in OpenNebula would look like:
    CONTEXT = [
      USER_DATA = "<some base64 string here>",
      USER_DATA_ENCODING = "base64"
    ]
    
  4. For parsing the yaml itself ruby can be used as it's assumed to be available.
@sk4zuzu sk4zuzu added type: feature A new feature planned for implementation category: context linux Linux OS contextualization packages labels Oct 22, 2024
@rsmontero rsmontero assigned rsmontero, aleixrm and jaimecb and unassigned rsmontero Nov 4, 2024
@rsmontero rsmontero added this to the Release 6.10.1 milestone Nov 4, 2024
@aleixrm aleixrm linked a pull request Nov 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: context linux Linux OS contextualization packages type: feature A new feature planned for implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants