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

docs: Provide Dockerfile example for validating Cloud-Init user data #63

Open
akutz opened this issue Feb 23, 2023 · 3 comments
Open

docs: Provide Dockerfile example for validating Cloud-Init user data #63

akutz opened this issue Feb 23, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@akutz
Copy link
Collaborator

akutz commented Feb 23, 2023

Getting cloud-init user data correct may prove difficult for users. The following Dockerfile can be used to validate the user data:

FROM ubuntu:latest

RUN apt-get update -y && \
    apt-get install -y cloud-init

ENTRYPOINT [ "cloud-init", "schema", "--config-file", "/cloud-config.yaml" ]

Let's imagine we build the following image from the above Dockerfile:

docker build -t civ .

Now, imagine the following cloud config file exists as "my-config.yaml":

#cloud-config
ssh_pwauth: true
users:
    - default
    - name: vmware
      sudo: ALL=(ALL) NOPASSWD:ALL
      lock_passwd: false
      passwd: '$1$salt$SOC44fVbA/ZxeIwD5yw1u1'
      shell: /bin/bash
write_files:
    - content: |
      "VMSVC Says Hello World"
      path: /helloworld

Let's run the validator on the above file:

$ docker run -it --rm -v $(pwd)/my-config.yaml:/cloud-config.yaml:ro civ
Error:
Cloud config schema errors: format-l13.c7: File /cloud-config.yaml is not valid yaml. while scanning a simple key
  in "<byte string>", line 13, column 7:
          "VMSVC Says Hello World"
          ^
could not find expected ':'
  in "<byte string>", line 14, column 7:
          path: /helloworld
          ^

We should add documentation to this repo's doc area with the above example.

@akutz akutz added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed labels Feb 23, 2023
@ChrisSmith2
Copy link

Hey!
I'm a computer science student at the University of Texas at Austin taking a Virtualization course and one of our assignments is to contribute to an open source project. Would I be able to work on resolving this issue?

@akutz
Copy link
Collaborator Author

akutz commented Mar 28, 2023

Hi @ChrisSmith2,

How is the ol' 40 acres? I'm the tech lead on the VM Service feature at VMware, of which the VM Operator is a part, and I roamed the halls of the old CS building back when Edsger Dijkstra was still teaching. Are Drs. Novak and Downing still there? If so, be sure to take a LISP course from Professor Novak, you'll seldom have as much fun!

You would be more than welcome to have a go at this; thank you for being interested! If you need any help, please feel free to reach out here and ask!

@MatthewDulworth
Copy link

Hey @akutz I am @ChrisSmith2's partner. Novak is indeed still here, I took a LISP class from him two semesters ago!

Is there any info you want use to add to the docs, or just put your example under the Cloud Init section in the Deploying a VM tutorial?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants
@akutz @ChrisSmith2 @MatthewDulworth and others