Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Before and after reboot documentation and examples#124

Merged
sdemos merged 2 commits into
coreos:masterfrom
sdemos:before-after-reboot-docs
Aug 8, 2017
Merged

Before and after reboot documentation and examples#124
sdemos merged 2 commits into
coreos:masterfrom
sdemos:before-after-reboot-docs

Conversation

@sdemos

@sdemos sdemos commented Aug 7, 2017

Copy link
Copy Markdown
Contributor

Added documentation and examples for before- and after-reboot checks.

@sdemos sdemos requested a review from dghubble August 7, 2017 21:27

@dghubble dghubble left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a tad verbose. We might be able to do more showing and less telling.

Comment thread doc/before-after-reboot-checks.md Outdated
@@ -0,0 +1,48 @@
# Before and After Reboot Checks

CLUO provides optional functionality for running arbitrary actions before and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLUO can require custom node annotations before a node is allowed to reboot or after a node has rebooted to allow it to become scheduable.

Comment thread doc/before-after-reboot-checks.md Outdated
it's respective label, the check performs whatever function it needs to, and
then should set one of the annotations provided to the `update-operator` to
true.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to the examples directly

Comment thread doc/before-after-reboot-checks.md Outdated

## Making a check

A check that needs to run before reboot should look for the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we could be more concise:

Pods that should run before a reboot should node select on the label blah and set the required before-reboot annotation to allow the reboot to occur. Pods that should run after a reboot should node select on the label blah and annotate the node with the required after-reboot annotation to allow the node to become schedulable again. A DaemonSet with a node selector is the recommended way to achieve this.

  • before-reboot-daemonset.yaml
  • after-reboot-daemonset.yaml

Comment thread doc/before-after-reboot-checks.md Outdated
update-operator --before-reboot-annotations anno1,anno2 --after-reboot-annotations anno3,anno4
```

## Making a check

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom Check Pods

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid referring to them as pods here, since they really don't have to be. It could be a cronjob on someones machine checking the labels every minute and then running kubectl annotate. Not that that's the recommended way to do things (hence the examples being pods) but I think there is value in keeping it flexible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern was that the vagueness doesn't help the user trying to figure it out. For most purposes, I'd expect people to be writing pods and the description of how its "just a label" and "just an annotation" makes it clear other things could be used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess we can be opinionated on how it should be used in the docs even if the implementation itself is flexible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some suggestions about the contents of this section. Maybe that will inform our title. I won't be hurt if we have the title stay as is

Comment thread doc/before-after-reboot-checks.md Outdated
`before-reboot` and `after-reboot` label, and then annotate the node with a
configured annotation.

## `update-operator` behavior

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this section above custom check pods and call it "Before and After Reboot Labels"

Comment thread doc/before-after-reboot-checks.md Outdated

## `update-operator` behavior

When a node requests a reboot, the `update-operator` will label the node with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before and After Reboot Labels

update-operator labels nodes that are about to reboot container-linux-update.v1.coreos.com/before-reboot=true and labels nodes that have just completed rebooting (but not yet scheduable) with container-linux-update.v1.coreos.com/after-reboot=true. If you've required before or after reboot annotations, update-operator will wait until all annotations are applied before proceeding.

effect: NoSchedule
containers:
- name: example-after-reboot-check
image: quay.io/stephen_demos/kube-annotate:latest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much effort is it to use the hyperkube image (which contains kubectl) and service account or host kubeconfig and just run ``kubectl annotation node blah`?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not too much effort. I can check it out. These were just the same pods I used to test the feature.

@sdemos sdemos force-pushed the before-after-reboot-docs branch 3 times, most recently from b187403 to be8b772 Compare August 8, 2017 01:39
Comment thread doc/before-after-reboot-checks.md Outdated
the binary -

```bash
update-operator --before-reboot-annotations anno1,anno2 --after-reboot-annotations anno3,anno4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comment here was lost.

Users will be running the update-operator image on Kubernetes, likely with our example deployment, let's show the flags in a manifest context:

        ...
        command:
        - "/bin/update-operator"
        - "--before-reboot-annotations=custom-before-reboot"
        - "--after-reboot-annotations=custom-after-reboot,"
        env:
        ...

Comment thread doc/before-after-reboot-checks.md Outdated
CLUO can require custom node annotations before a node is allowed to reboot or
before a node is allowed to become schedulable after a reboot.

## Configuring the `update-operator`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop "the"

Comment thread doc/before-after-reboot-checks.md Outdated

## Configuring the `update-operator`

When depolying the `update-operator`, you can provide a comma-separated list of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:

Configure update-operator with comma-separated lists of --before-reboot-annotations and --after-reboot-annotations that should be required.

Comment thread doc/before-after-reboot-checks.md Outdated

## Making a Custom Check

A check that needs to run before reboot should look for the

@dghubble dghubble Aug 8, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, starting with a verb here might hint the user needs to go write some code or pick something. what about:

Write your logic to perform custom before-reboot behavior and after-reboot behavior. When successful, ensure your code sets the annotations you've passed to update-operator. If your code finds a serious issue, leaving the annotations unset will ensure cluster upgrades halt at the problematic node, for an admin to intervene.

It is recommended that custom checks be implemented by a container image and deployed using a Daemonset with a node selector on the before-reboot or after-reboot labels.

    spec:
      nodeSelector:
        container-linux-update.v1.coreos.com/before-reboot: "true"

Be sure your custom check can handle being rescheduled to a node on which it has previously run as the update-operator does not remove the before-reboot and after-reboot labels instantaneously.

@sdemos sdemos force-pushed the before-after-reboot-docs branch from be8b772 to 08a66a2 Compare August 8, 2017 17:54
@sdemos sdemos force-pushed the before-after-reboot-docs branch from 08a66a2 to 3533e41 Compare August 8, 2017 19:03
@sdemos sdemos merged commit 70677e1 into coreos:master Aug 8, 2017
@sdemos sdemos deleted the before-after-reboot-docs branch August 8, 2017 19:55
@dghubble dghubble mentioned this pull request Aug 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants