bottlerocket-os / bottlerocket-update-operator

A Kubernetes operator for automated updates to Bottlerocket
Other
179 stars 41 forks source link

Provide a mechanism to prevent updates in certain time window #67

Closed srgothi92 closed 2 years ago

srgothi92 commented 3 years ago

Description

Customers could have workload that cannot be interrupted during some periods of the day. Therefore, a mechanism to prevent Bottlerocket nodes update by the bottlerocket-update-operator in some time window is useful.

Workarounds

  1. Since, the Bottlerocket update operator expects Kubernetes label updater-interface-version on nodes for it to start agent DaemonSet. Customer can have an external mechanism to control nodes label updater-interface-version.
  2. Lock the version of all Bottlerocket hosts to desired version by setting settings.updates.version-lock (details) and have a mechanism that changes the settings on nodes to latest whenever you would like to update your cluster.

Issue or Feature Request: Feature Request

srgothi92 commented 3 years ago

Details about Workaround option 2:

Lock the version of all Bottlerocket hosts to desired version by setting settings.updates.version-lock (details) and have a mechanism that changes the settings on nodes to latest whenever you would like to update your cluster. Detailed steps below:

  1. Set updates.version-lock=v0.0.0 ; v0.0.0 is a dummy version number that would never occur and prevent update operator from detecting updates. By setting dummy version we don’t have to worry about getting current OS version and locking on that. (An issue #1500 is open, which requests adding a new label “current”, so dummy version will not be required).
    # Change --targets according to the cluster
    aws ssm send-command \
    --document-name "AWS-RunShellScript" \
    --comment "Locking bottlerocket version to v0.0.0" \
    --targets Key=tag:<tag-name>,Values=<tag-value> \
    --parameters commands="apiclient set updates.version-lock=v0.0.0"
  2. During the maintenance period and when you know new Bottlerocket version is released you can change updates.version-lock=latest
    # Change --targets according to the cluster
    aws ssm send-command \
    --document-name "AWS-RunShellScript" \
    --comment "Locking bottlerocket version to latest" \
    --targets Key=tag:<tag-name>,Values=<tag-value> \
    --parameters commands="apiclient set updates.version-lock=latest"

    Note: There are multiple influencing factors contributing to the amount of time to update the cluster, so it may not finish in your targeted maintenance window.

  1. Once all the nodes are updated, set updates.version-lock=v0.0.0 back to avoid any future updates.