Skip to content

Commit 1c1fc1f

Browse files
authored
Merge pull request #18 from dweomer/prep-for-v0.2.0
pre v0.2.0 twiddles
2 parents b486577 + 519f4f8 commit 1c1fc1f

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

README.md

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,67 @@ Below is example Plan in development for [k3OS](https://github.com/rancher/k3os)
3838
---
3939
apiVersion: upgrade.cattle.io/v1
4040
kind: Plan
41+
4142
metadata:
43+
# This `name` should be short but descriptive.
4244
name: k3os-latest
45+
46+
# The same `namespace` as is used for the system-upgrade-controller Deployment.
4347
namespace: k3os-system
48+
4449
spec:
50+
# The maximum number of concurrent nodes to apply this update on.
4551
concurrency: 1
52+
53+
# The value for `channel` is assumed to be a URL that returns HTTP 302 with the last path element of the value
54+
# returned in the Location header assumed to be an image tag.
55+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/upgrade/plan/plan.go#L177
4656
channel: https://github.com/rancher/k3os/releases/latest
47-
version: v0.9.0-dev
57+
58+
# Providing a value for `version` will prevent polling/resolution of the `channel` if specified.
59+
# version: v0.9.0-dev
60+
61+
# Select which nodes this plan can be applied to.
4862
nodeSelector:
4963
matchExpressions:
64+
# This limits application of this upgrade only to nodes that have opted in by applying this label.
65+
# Additionally, a value of `disabled` for this label on a node will cause the controller to skip over the node.
66+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/upgrade/plan/plan.go#L216
67+
# NOTICE THAT THE NAME PORTION OF THIS LABEL MATCHES THE PLAN NAME. This is related to the fact that the
68+
# system-upgrade-controller will tag the node with this very label having the value of the applied version.
69+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/upgrade/plan/plan.go#L112-L115
5070
- {key: plan.upgrade.cattle.io/k3os-latest, operator: Exists}
71+
# This label is set by k3OS, therefore a node without it should not apply this upgrade.
72+
- {key: k3os.io/mode, operator: Exists}
73+
# Additionally, do not attempt to upgrade nodes booted from "live" CDROM.
5174
- {key: k3os.io/mode, operator: NotIn, values: ["live"]}
75+
76+
# The service account for the pod to use. As with normal pods, if not specified the `default` service account from the namespace will be assigned.
77+
# See https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
78+
serviceAccountName: k3os-upgrade
79+
80+
# The prepare init container is run before cordon/drain which is run before the upgrade container.
81+
# Shares the same format as the `upgrade` container
82+
# prepare:
83+
# image: alpine:3.11
84+
# command: [sh, -c]
85+
# args: [" echo '### ENV ###'; env | sort; echo '### RUN ###'; find /run/system-upgrade | sort"]
86+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/apis/upgrade.cattle.io/v1/types.go#L58
87+
88+
# See https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/#use-kubectl-drain-to-remove-a-node-from-service
5289
drain:
90+
# deleteLocalData: true
91+
# ignoreDaemonSets: true
5392
force: true
93+
94+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/apis/upgrade.cattle.io/v1/types.go#L51
5495
upgrade:
96+
# The tag portion of the image will be overridden with the value from `.status.latestVersion` a.k.a. the resolved version.
97+
# SEE https://github.com/rancher/system-upgrade-controller/blob/v0.1.0/pkg/apis/upgrade.cattle.io/v1/types.go#L47
5598
image: rancher/k3os
5699
command: [k3os, --debug]
100+
# It is safe to specify `--kernel` on overlay installations as the destination path will not exist and so the
101+
# upgrade of the kernel component will be skipped (with a warning in the log).
57102
args:
58103
- upgrade
59104
- --kernel
@@ -66,22 +111,6 @@ spec:
66111
- --destination=/host/k3os/system
67112
```
68113

69-
This plan specifies via `concurrency` that only one node at a time in the cluster can be applying this plan.
70-
It specifies a `channel` URL that should adhere to the simple contract exhibited by Github latest release browser URLs
71-
which is to simply return an HTTP 302 with Location header pointing to the latest release tag. The controller will attempt to
72-
resolve `channel` URL redirects every 15 minutes by default. If, as in this example, the `version` is specified then
73-
`channel` resolution is skipped and only the specified `version` is honored.
74-
To specify which nodes in the cluster are eligible for application of this Plan a `nodeSelector` entry must be provided.
75-
The format of `nodeSelector` is the same as `nodeSelectorTerms` in the `nodeAffinity` section of the `affinity` spec for
76-
Pods.
77-
Not shown in this example is a `cordon` boolean, default `false`, that would indicate that `kubectl cordon` should be
78-
run against the node prior to invoking the upgrade.
79-
Instead we have a non-nil `drain` (which will set the same unscheduleable taint as `cordon`) with parameters
80-
corresponding to those used for `kubectl drain` minus the selectors. Additionally, the `deleteLocalData` and
81-
`ignoreDaemonSets` parameters both default to `true` if, as in this example, `drain` is specified.
82-
Both the `drain` and `cordon` `kubectl` invocations are run in init containers for the Pod.
83-
Finally, to specify the `upgrade`, we have a very truncated container template: `image`, `command`, and `args`.
84-
85114
## Building
86115
`make`
87116

kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ resources:
44
- manifests/system-upgrade-controller.yaml
55
images:
66
- name: rancher/system-upgrade-controller
7-
newTag: v0.1.0
7+
newTag: v0.2.0
88
- name: rancher/kubectl
99
newTag: v1.17.0

0 commit comments

Comments
 (0)