{"id":25649786,"url":"https://github.com/openchami/cloud-init","last_synced_at":"2025-10-24T05:11:23.752Z","repository":{"id":216841029,"uuid":"739163524","full_name":"OpenCHAMI/cloud-init","owner":"OpenCHAMI","description":"Micro-service for serving cloud-init payloads","archived":false,"fork":false,"pushed_at":"2025-10-06T21:54:13.000Z","size":10538,"stargazers_count":2,"open_issues_count":9,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-06T23:32:10.687Z","etag":null,"topics":["cloud-init","golang","openchami"],"latest_commit_sha":null,"homepage":"https://openchami.dev/docs/software/cloud-init-standard-node-personalization-for-the-cloud/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenCHAMI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-04T23:19:27.000Z","updated_at":"2025-10-06T21:42:49.000Z","dependencies_parsed_at":"2024-01-13T07:02:14.400Z","dependency_job_id":"5621928c-d3de-43c2-9288-12cbcc105c7e","html_url":"https://github.com/OpenCHAMI/cloud-init","commit_stats":null,"previous_names":["openchami/cloud-init"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/OpenCHAMI/cloud-init","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fcloud-init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fcloud-init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fcloud-init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fcloud-init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenCHAMI","download_url":"https://codeload.github.com/OpenCHAMI/cloud-init/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fcloud-init/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280742528,"owners_count":26382926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-init","golang","openchami"],"created_at":"2025-02-23T14:33:53.291Z","updated_at":"2025-10-24T05:11:23.727Z","avatar_url":"https://github.com/OpenCHAMI.png","language":"Go","readme":"# OpenCHAMI Cloud-Init Server\n\n## Summary of Repo\nThe **OpenCHAMI cloud-init service** retrieves detailed inventory information from SMD and uses it to create cloud-init payloads customized for each node in an OpenCHAMI cluster.\n\n## Table of Contents\n1. [About / Introduction](#about--introduction)\n2. [Build / Install](#build--install)\n   - [Environment Variables](#environment-variables)\n   - [Building Locally with GoReleaser](#building-locally-with-goreleaser)\n3. [Running the Service](#running-the-service)\n   - [Cluster Name](#cluster-name)\n   - [Fake SMD Mode](#fake-smd-mode)\n   - [Impersonation](#impersonation)\n   - [Nocloud-net Datasource](#nocloud-net-datasource)\n4. [Testing the Service](#testing-the-service)\n   - [Basic Endpoint Testing](#basic-endpoint-testing)\n   - [Meta-data](#meta-data)\n   - [User-data](#user-data)\n   - [Vendor-data](#vendor-data)\n5. [Group Handling and Overrides](#group-handling-and-overrides)\n   - [Updating Group Data with a Simple Jinja Example](#updating-group-data-with-a-simple-jinja-example)\n   - [Complex Base64 Example](#complex-base64-example)\n   - [Cluster Defaults and Instance Overrides](#cluster-defaults-and-instance-overrides)\n     - [Set Cluster Defaults](#set-cluster-defaults)\n     - [Override Instance Data](#override-instance-data)\n6. [More Reading](#more-reading)\n\n---\n\n## About / Introduction\nThe **OpenCHAMI Cloud-Init Service** is designed to generate cloud-init configuration for nodes in an OpenCHAMI cluster. The new design pushes the complexity of merging configurations into the cloud-init client rather than the server. This README provides instructions based on the [Demo.md](https://github.com/OpenCHAMI/cloud-init/blob/main/demo/Demo.md) file for running and testing the service.\n\nThis service provides configuration data to cloud-init clients via the standard nocloud-net datasource. The service merges configuration from several sources:\n- **SMD data** (or simulated data in development mode)\n- **User-supplied JSON** (for custom configurations)\n- **Cluster defaults and group overrides**\n\nCloud-init on nodes retrieves data in a fixed order:\n1. `/meta-data` – YAML document with system configuration.\n2. `/user-data` - a document which can be any of the [user data formats](https://cloudinit.readthedocs.io/en/latest/explanation/format.html#cloud-config-data)\n3. `/vendor-data` – Vendor-supplied configuration via include-file mechanisms.\n4. `/network-config` – An optional document in one of two [network configuration formats](https://cloudinit.readthedocs.io/en/latest/reference/network-config.html#network-config).  This is only requested if configured to do so with a kernel parameter or through cloud-init configuration in the image. __NB__: __OpenCHAMI doesn't support delivering `network-config` via the cloud-init server today__\n\n\n---\n\n## Build / Install\n\nThis project uses **[GoReleaser](https://goreleaser.com/)** for building and releasing, embedding additional metadata such as commit info, build time, and version. Below is a brief overview for local builds.\n\n### Environment Variables\nTo include detailed metadata in your builds, set the following:\n\n- **GIT_STATE**: `clean` if your repo is clean, `dirty` if uncommitted changes exist  \n- **BUILD_HOST**: Hostname of the build machine  \n- **GO_VERSION**: Version of Go used (for consistent versioning info)  \n- **BUILD_USER**: Username of the person/system performing the build  \n\n```bash\nexport GIT_STATE=$(if git diff-index --quiet HEAD --; then echo 'clean'; else echo 'dirty'; fi)\nexport BUILD_HOST=$(hostname)\nexport GO_VERSION=$(go version | awk '{print $3}')\nexport BUILD_USER=$(whoami)\n```\n\n### Building Locally with GoReleaser\n1. [Install GoReleaser](https://goreleaser.com/install/) following their documentation.  \n2. Run in snapshot mode to build locally without releasing:\n\n   ```bash\n   goreleaser release --snapshot --clean\n   ```\n3. Check the `dist/` directory for compiled binaries, which will include the injected metadata.\n\n\u003e [!NOTE]\n\u003e If you encounter errors, ensure your GoReleaser version matches the one used in the [Release Action](.github/workflows/Release.yml).\n\n---\n\n## Running the Service\n\n### Cluster Name\n\nEach instance of cloud-init is linked to a single SMD and operates for a single cluster. Until the cluster name is automatically available via your inventory system, you must specify it on the command line using the `-cluster-name` flag.\n\n_Example:_\n```bash\n-cluster-name venado\n```\n\n### Fake SMD Mode\n\nFor development purposes, you can run the cloud-init server without connecting to a real SMD instance. By setting the environment variable `CLOUD_INIT_SMD_SIMULATOR` to `true`, the service will generate a set of simulated nodes.\n\n**Example command:**\n```bash\nCLOUD_INIT_SMD_SIMULATOR=true dist/cloud-init_darwin_arm64_v8.0/cloud-init-server -cluster-name venado -insecure -impersonation=true\n```\n\n### Impersonation\n\nBy default, the service determines what configuration to return based on the IP address of the requesting node. For testing, impersonation routes can be enabled with the `-impersonation=true` flag.\n\n**Sample commands:**\n```bash\ncurl http://localhost:27777/cloud-init/admin/impersonation/x3000c1b1n1/meta-data\n```\n\n### Nocloud-net Datasource\n\n```bash\ncloud-init=enabled ds=nocloud-net;s=http://192.0.0.1/cloud-init\n```\n\n---\n## Testing the Service\n\nThe following testing steps (adapted from Demo.md) help you verify that the service is functioning correctly.\n\n### Basic Endpoint Testing\n\n#### Start the Service in Fake SMD Mode (if desired):\n\n**Example:**\n\n```bash\nCLOUD_INIT_SMD_SIMULATOR=true dist/cloud-init_darwin_arm64_v8.0/cloud-init-server -cluster-name venado -insecure -impersonation=true\n```\n\n#### Query the Standard Endpoints:\n\n#### Meta-data:\n\n```bash\ncurl http://localhost:27777/cloud-init/meta-data\n```\n\nYou should see a YAML document with instance information (e.g., instance-id, cluster-name, etc.).\n\n#### User-data:\n\n```bash\ncurl http://localhost:27777/cloud-init/user-data\n```\n\nFor now, this returns a blank cloud-config document:\n\n```yaml\n#cloud-config\n```\n\n#### Vendor-data:\n\n```bash\ncurl http://localhost:27777/cloud-init/vendor-data\n```\n\nVendor-data typically includes include-file directives pointing to group-specific YAML files:\n\n```yaml\n#include\nhttp://192.168.13.3:8080/all.yaml\nhttp://192.168.13.3:8080/login.yaml\nhttp://192.168.13.3:8080/compute.yaml\n```\n\n## Group Handling and Overrides\n\nThe service supports advanced configuration through group handling and instance overrides.\n\n### Updating Group Data with a Simple Jinja Example\n\nThis example sets a syslog aggregator via jinja templating. The group data is stored under the group name and then used in the vendor-data file.\n\n```bash\ncurl -X POST http://localhost:27777/cloud-init/admin/groups/ \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\n        \"name\": \"x3001\",\n        \"description\": \"Cabinet x3001\",\n        \"data\": {\n            \"syslog_aggregator\": \"192.168.0.1\"\n        },\n        \"file\": {\n            \"content\": \"#template: jinja\\n#cloud-config\\nrsyslog:\\n  remotes: {x3001: {{ vendor_data.groups[\\\"x3001\\\"].syslog_aggregator }}}\\n  service_reload_command: auto\\n\",\n            \"encoding\": \"plain\"\n        }\n    }'\n```\n\n### Complex Base64 Example\n\nTo add more sophisticated vendor-data (for example, installing the slurm client), you can encode a complete cloud-config in base64. (See the script in Demo.md for a complete example.)\n\n### Cluster Defaults and Instance Overrides\n\n#### Set Cluster Defaults:\n\n```bash\ncurl -X POST http://localhost:27777/cloud-init/admin/cluster-defaults/ \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\n        \"cloud-provider\": \"openchami\",\n        \"region\": \"us-west-2\",\n        \"availability-zone\": \"us-west-2a\",\n        \"cluster-name\": \"venado\",\n        \"public-keys\": [\n            \"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArV2...\",\n            \"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArV3...\"\n        ]\n    }'\n```\n\n#### Override Instance Data:\n\n```bash\ncurl -X PUT http://localhost:27777/cloud-init/admin/instance-info/x3000c1b1n1 \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\n        \"local-hostname\": \"compute-1\",\n        \"instance-type\": \"t2.micro\"\n    }'\n```\n---\n\n## More Reading\n\n- [Official cloud-init documentation](https://cloud-init.io/)  \n- [OpenCHAMI TPM-manager service](https://github.com/OpenCHAMI/TPM-manager)  \n- [GoReleaser Documentation](https://goreleaser.com/)  \n- [SMD Documentation](https://github.com/OpenCHAMI/smd)  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenchami%2Fcloud-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenchami%2Fcloud-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenchami%2Fcloud-init/lists"}