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

Add simple example of before/after reboot annotations #168

Open
invidian opened this issue Jun 7, 2022 · 0 comments
Open

Add simple example of before/after reboot annotations #168

invidian opened this issue Jun 7, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@invidian
Copy link
Member

invidian commented Jun 7, 2022

We have e.g. https://github.com/flatcar-linux/flatcar-linux-update-operator/blob/53f08043e320c853940ed7b4c126c7b72af1af00/examples/reboot-annotations/after-reboot-daemonset.yaml right now, but it only annotates the node right away, which is not very useful, as it does not allow implementing any logic.

We should change those to:

  • Use an agent Service Account so hook has appropriate permissions to update the Node object.
  • Use shell + kubectl to be able to write some simple logic for annotating nodes. Something like this should be possible:
    while true; do kubectl annotate node $NODENAME --overwrite=true has-attached-volumes=$(if [ $(kubectl get volumeattachment | grep $NODENAME | wc -l) -gt 0 ]; then echo true; else echo false; fi); sleep 30; done (to workaround Ensure update-agent waits for all volumes to be detached before rebooting #30).
@invidian invidian added the documentation Improvements or additions to documentation label Jun 7, 2022
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
Projects
None yet
Development

No branches or pull requests

1 participant