Skip to content

Elemental Operator extended APIs

Francesco Giudici edited this page Feb 7, 2023 · 2 revisions

Elemental Operator extended APIs

The Elemental Operator exposes a set of APIs on the https://{Rancher Address}/elemental/ path. There are currently two APIs exposed:

  • register
  • build-image

register API

...


build-image API

The API provides two endpoints

URL verb
/build-image POST triggers image build
/build-image/{token} GET get image build status

Evaluating a third endpoint to download the image (otherwise the url to download will be passed in the build-image GET endpoint)

URL verb
/download/{token} GET download the image

API format

/build-image POST

json content, expects two body parameters:

  • token: string   the registrationToken from the associated MachineRegistration
  • url: string    the URL of the base image to use to produce the image

on success, returns the url and token received in json format.

example:

$> curl -kiX POST https://rancher.mydomain/elemental/build-image -d '{
  "token" : "gqpr66rm5rdxh8q96pqw2fnr2lplmf4qj7j5jl9g2hpqcttj62xx8k",
  "url" : "https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Dev:/Teal53/media/iso/elemental-teal.x86_64.iso"
}'

{"url":"https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Dev:/Teal53/media/iso/elemental-teal.x86_64.iso","token":"gqpr66rm5rdxh8q96pqw2fnr2lplmf4qj7j5jl9g2hpqcttj62xx8k"}

/build-image/{token} GET

json content, expects one path parameter:

  • tokenthe registrationToken from the associated MachineRegistration

returns the status and url parameters. The status parameter may have one of the following values:

"Not Started" image building has never been started for this registration
"Started" image building is currently running
"Completed" image is ready to be downloaded
"Failed" image build process failed

The url parameter stores the download url for the built image only when the status is Completed, is empty otherwise.

example:

$> curl -k https://rancher.mydomain/elemental/build-image/gqpr66rm5rdxh8q96pqw2fnr2lplmf4qj7j5jl9g2hpqcttj62xx8k
{"status":"Started","url":""}

Internal design

...