Skip to content

Commit cf6f1dd

Browse files
committed
flatcar-postinst: Remove old Tectonic workaround
The Docker 1.12 version required by old Tectonic clusters is long gone on Flatcar and the workaround to switch the node to the old Docker won't work anymore. Remove the Tectonic workaround.
1 parent e688113 commit cf6f1dd

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

flatcar-postinst

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -153,101 +153,13 @@ PrivateTmp=true
153153
EOF
154154
fi
155155

156-
# Tectonic backed itself into a corner by depending on the docker version
157-
# shipped in Container Linux but not actively ensuring that they kept clusters
158-
# up-to-date. As a result, the OS has continued to ship an old docker to work
159-
# around the issue. Now that Tectonic is able to specify the version of docker,
160-
# the default version of docker can be updated. Unfortunately, this can't be
161-
# done until all clusters have fallen out of support or have updated. In order
162-
# to expedite this process, the /etc/coreos/docker-1.12 flag file has been
163-
# added, which can signal that the installed version of docker should remain at
164-
# 1.12.6. This next chunk of black magic attempts to determine if the machine
165-
# is a part of a Tectonic cluster and, if so, write the flag file so that old
166-
# clusters aren't caught up in the docker-version bump.
167-
#
168-
# This code works by looking at the kubelet.service and a particular sysctl
169-
# entry that have always been written by the Tectonic installer. After
170-
# stripping out known variables and commonly-added user modifications, the
171-
# contents are hashed and compared against a known, good list. This list was
172-
# derived from every kubelet.service we have ever shipped in Tectonic. This was
173-
# not a particularly fun exercise.
174-
good_kubelet() {
175-
KUBELET_PATH="/etc/systemd/system/kubelet.service"
176-
declare -A GOOD_KUBELET_SUMS=(
177-
[9aa254d55054fab5de48ca4e97ac3f0f]=1
178-
[838ca6c80119a7daf9fdc3881698d058]=1
179-
[35dd901dd87291df1ad8b6bf9b60a174]=1
180-
[43af37f891e555c5e4cf7c18478fce54]=1
181-
[c27121efdd210cc05a28c122f8f4a145]=1
182-
[f4cab5080e349a999197daace5ca971c]=1
183-
[71f8b465420d9373a536424eb81987ad]=1
184-
[997f455cd2a02ce885e5ec7db4755fa5]=1
185-
[69d890f526fe59da3117f56583bc9929]=1
186-
[46a19863e5497f903fb3fdc0fbda9137]=1
187-
[42357b95fc5ae52b476b8eb5c58ebb42]=1
188-
[ee5ef7bb3443f872fe470f4eab586b3c]=1
189-
[5b08a40b4f8312c4710b1676b761a9b0]=1
190-
[879210fde7b8a3c8c02b8646dd06a35e]=1
191-
[b0cf744da1a9b5df933baabdcfb5bf7f]=1
192-
[b3c382658e55ada45a819c3274d25cb2]=1
193-
[852dd9b686429b84144b36e101305968]=1
194-
)
195-
196-
[ -f $KUBELET_PATH ] || return 1
197-
198-
# Remove all whitespace (including newlines), backslashes, known variables
199-
# (the first six expressions), and commonly-added user options (the next
200-
# two expressions) before determining the md5 sum.
201-
sum=$(sed \
202-
--regexp-extended \
203-
--expression '/--cloud-provider=/d' \
204-
--expression '/--hostname-override=/d' \
205-
--expression '/--cluster-dns=/d' \
206-
--expression '/--cluster_dns=/d' \
207-
--expression '/--node-labels=/d' \
208-
--expression '/--cni-bin-dir=/d' \
209-
--expression '/--register-with-taints=/d' \
210-
--expression '/\/opt\/s3-puller.sh/d' \
211-
--expression '/-v=/d' \
212-
--expression '/-vmodule=/d' \
213-
--expression 's/\s//g' \
214-
--expression 's/\\//g' \
215-
$KUBELET_PATH | tr --delete '\n' | md5sum | gawk '{print $1}')
216-
217-
[[ -n "${GOOD_KUBELET_SUMS[${sum}]}" ]] && return 0
218-
}
219-
220-
good_sysctl() {
221-
SYSCTL_PATH="/etc/sysctl.d/max-user-watches.conf"
222-
declare -A GOOD_SYSCTL_SUMS=(
223-
[6de69b29eccf652d476f68c1abf3d0db]=1
224-
[52ddc3d78f9ce25f068c6da1c1f7f2f3]=1
225-
)
226-
227-
[ -f $SYSCTL_PATH ] || return 1
228-
229-
sum=$(md5sum $SYSCTL_PATH | gawk '{print $1}')
230-
231-
[[ -n "${GOOD_SYSCTL_SUMS[${sum}]}" ]] && return 0
232-
}
233-
234156
# Gather metadata about upcoming OS image.
235157
# shellcheck source=/dev/null
236158
source "${INSTALL_MNT}/lib/os-release"
237159
NEXT_VERSION_ID=${VERSION_ID}
238160

239-
# Check to make sure that the current version is less than 1576 (this is the
240-
# first release to include this Tectonic work-around). This ensures that we
241-
# only apply this work-around one time.
242161
# shellcheck source=/dev/null
243162
source /usr/lib/os-release
244-
DOCKER_FLAG_PATH="/etc/flatcar/docker-1.12"
245-
if [ ! -e "${DOCKER_FLAG_PATH}" ] && [ "${VERSION_ID%%.*}" -lt 1576 ] &&
246-
good_kubelet && good_sysctl
247-
then
248-
echo "Detected a Tectonic cluster. Writing docker override..."
249-
cat > "${DOCKER_FLAG_PATH}" <<< yes
250-
fi
251163

252164
tee_journal() {
253165
tee >(systemd-cat -t coreos-postinst)

0 commit comments

Comments
 (0)