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

Cloud-Init Rewrite #37

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

alexlovelltroy
Copy link
Member

After using our cloud-init server on a few installations, we understand better what we need and have rewritten the daemon to function better with groups. In addition to many improvements to allow for standalone testing of cloud-init without a functioning SMD, the cloud-init server now separates the urls that should be accessible to the nodes from administrative interfaces by url and subrouter.

The routes that should be accessible as a node/client are:

// Add cloud-init endpoints to router
router.Get("/user-data", UserDataHandler)
router.Get("/meta-data", MetaDataHandler(handler.sm, handler.store))
router.Get("/vendor-data", VendorDataHandler(handler.sm, handler.store))
router.Get("/{group}.yaml", GroupUserDataHandler(handler.sm, handler.store))

Each of these examine the request to identify which node is requesting information and tailor the response accordingly. Some of the meta-data can be inferred based on information from SMD. Other information is stored locally in the cloud-init server. At the moment, the cloud-init server has no durable backend so it is only stored in memory and lost upon restart.

Administrative actions are available to both set data within the cloud-init server and to impersonate a node when testing.

// Cluster Defaults
r.Get("/cluster-defaults", GetClusterDataHandler(handler.store))
r.Post("/cluster-defaults", SetClusterDataHandler(handler.store))
// r.Put("/cluster-defaults", SetClusterDataHandler(handler.store)) // Should we support PUT and POST or just one of them?
r.Put("/instance-info/{id}", InstanceInfoHandler(handler.sm, handler.store))
// groups API endpoints
r.Get("/groups", handler.GetGroups)
r.Post("/groups", handler.AddGroupHandler)
r.Get("/groups/{id}", handler.GetGroupHandler)
r.Put("/groups/{name}", handler.UpdateGroupHandler)
r.Delete("/groups/{id}", handler.RemoveGroupHandler)
if impersonationEnabled {
// impersonation API endpoints
r.Get("/impersonation/{id}/user-data", UserDataHandler)
r.Get("/impersonation/{id}/meta-data", MetaDataHandler(handler.sm, handler.store))
r.Get("/impersonation/{id}/vendor-data", VendorDataHandler(handler.sm, handler.store))
r.Get("/impersonation/{id}/{group}.yaml", GroupUserDataHandler(handler.sm, handler.store))
}

More information is available in Demo.md

alexlovelltroy and others added 17 commits December 14, 2024 09:44
…, update dependencies, and remove obsolete tests
…rove vendor data response

* refactor code to put less in citypes and more in local handlers
…r ciStore interface, update group handling, add cluster defaults endpoints and support to override the hostnames as needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant