Skip to content

Commit

Permalink
templates: Add node.openshift.io/rhelmajor label, drop os_version one
Browse files Browse the repository at this point in the history
This removes the functionality added in
openshift#514
which I don't think really worked for what people needed; a node
selector can't parse the value.

All we care about is currently 7 or 8; this signals things like
`iptables` vs `nftables`.

And the presence of this label also signals "RHEL" too;
though we keep the `os_id` label in case e.g. a daemonset should only
run on RHCOS (or traditional RHEL).

Closes: openshift#582
  • Loading branch information
cgwalters committed Apr 23, 2019
1 parent eb329b8 commit d2cce0e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "kubelet-rhelmajor.service"
enabled: true
contents: |
[Unit]
Description=Generate rhelmajor version for kubelet
Before=kubelet.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/os-release
# Really we should fix VERSION_ID in rhcos but that requires rpm-ostree changes
ExecStart=/bin/sh -c '(echo -n RHELMAJOR= && if [ "${ID}" = rhcos ]; then echo ${VERSION} | cut -d . -f 2; else echo ${VERSION_ID} | cut -d . -f 1; fi) > /run/kubelet-rhelmajor'
[Install]
WantedBy=multi-user.target
3 changes: 2 additions & 1 deletion templates/master/01-master-kubelet/_base/units/kubelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ contents: |
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
ExecStartPre=/bin/rm -f /var/lib/kubelet/cpu_manager_state
EnvironmentFile=/etc/os-release
EnvironmentFile=/run/kubelet-rhelmajor
EnvironmentFile=-/etc/kubernetes/kubelet-workaround
EnvironmentFile=-/etc/kubernetes/kubelet-env
Expand All @@ -22,7 +23,7 @@ contents: |
--container-runtime=remote \
--container-runtime-endpoint=/var/run/crio/crio.sock \
--allow-privileged \
--node-labels=node-role.kubernetes.io/master,node.openshift.io/os_version=${VERSION_ID},node.openshift.io/os_id=${ID} \
--node-labels=node-role.kubernetes.io/master,node.openshift.io/rhelmajor=${RHELMAJOR},node.openshift.io/os_id=${ID} \
--minimum-container-ttl-duration=6m0s \
--client-ca-file=/etc/kubernetes/ca.crt \
--cloud-provider={{cloudProvider .}} \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "kubelet-rhelmajor.service"
enabled: true
contents: |
[Unit]
Description=Generate rhelmajor version for kubelet
Before=kubelet.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/os-release
# Really we should fix VERSION_ID in rhcos but that requires rpm-ostree changes
ExecStart=/bin/sh -c '(echo -n RHELMAJOR= && if [ "${ID}" = rhcos ]; then echo ${VERSION} | cut -d . -f 2; else echo ${VERSION_ID} | cut -d . -f 1; fi) > /run/kubelet-rhelmajor'
[Install]
WantedBy=multi-user.target
3 changes: 2 additions & 1 deletion templates/worker/01-worker-kubelet/_base/units/kubelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ contents: |
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
ExecStartPre=/bin/rm -f /var/lib/kubelet/cpu_manager_state
EnvironmentFile=/etc/os-release
EnvironmentFile=/run/kubelet-rhelmajor
EnvironmentFile=-/etc/kubernetes/kubelet-workaround
EnvironmentFile=-/etc/kubernetes/kubelet-env
Expand All @@ -21,7 +22,7 @@ contents: |
--container-runtime=remote \
--container-runtime-endpoint=/var/run/crio/crio.sock \
--allow-privileged \
--node-labels=node-role.kubernetes.io/worker,node.openshift.io/os_version=${VERSION_ID},node.openshift.io/os_id=${ID} \
--node-labels=node-role.kubernetes.io/worker,node.openshift.io/rhelmajor=${RHELMAJOR},node.openshift.io/os_id=${ID} \
--minimum-container-ttl-duration=6m0s \
--volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \
--client-ca-file=/etc/kubernetes/ca.crt \
Expand Down

0 comments on commit d2cce0e

Please sign in to comment.