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

✨ state api sdk #262

Merged
merged 13 commits into from
Oct 23, 2022
Merged

✨ state api sdk #262

merged 13 commits into from
Oct 23, 2022

Conversation

mudler
Copy link
Member

@mudler mudler commented Oct 22, 2022

What this PR does / why we need it:

This PR introduce an SDK API to retrieve system runtime status. Besides, exposes it via CLI enabling programmatically use inside cloud-configs, system services, etc. It also adds the capability to read cloud configs in the state partition.

How it works:

The agent now has a state subcommand, which can be used to print the system state, and retrieve informations for it by querying it.

# Discover in which environment we are running (active, passive, recovery, livecd)
$ kairos-agent state get .boot
active_boot
# Discover if /oem is mounted
$ kairos-agent state get .oem.mounted
false
# Print all the state
$ kairos-agent state

Besides, starts to lay down first blocks to an sdk to apply system-wide changes during runtime.

Relates to #34

@netlify
Copy link

netlify bot commented Oct 22, 2022

Deploy Preview for kairos-io canceled.

Name Link
🔨 Latest commit b2e7c60
🔍 Latest deploy log https://app.netlify.com/sites/kairos-io/deploys/63557067d4de4f0008f8c188

@mudler mudler changed the title Stateapi ✨ state api sdk Oct 22, 2022
This is related to #34.

Starts to unify the API to retrieve the state in the sdk to have a common place to query system status information.
@mudler mudler force-pushed the stateapi branch 2 times, most recently from 0f281a7 to 662a250 Compare October 23, 2022 16:43
@mudler mudler marked this pull request as ready for review October 23, 2022 18:12
@mudler mudler merged commit 4666c17 into master Oct 23, 2022
@mudler mudler deleted the stateapi branch October 23, 2022 18:22
santhoshdaivajna pushed a commit to santhoshdaivajna/kairos that referenced this pull request Oct 24, 2022
* ✨ Add state api

This is related to kairos-io#34.

Starts to unify the API to retrieve the state in the sdk to have a common place to query system status information.

* 🤖 Add test

* Update go.mod

* ⚙️ Fine-tune detection of partitions

* 🤖 Add more fine-grained tests

* 🎨 Add /dev/ to partition name

* 🤖 Fixup tests

* ⚙️ Remount accessors

* ✨ Add state partition to cloud-init paths

* 📝 Upper case Kairos in motd

* 🎨 Add mounts sdk

* 🎨 Set grub options via SDK

* 🎨 Make it more idiomatic
@mudler mudler mentioned this pull request Oct 26, 2022
31 tasks
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