From 01dd395b2c594a38ad7a4b7877e813ec700b2380 Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 13:20:02 +0700 Subject: [PATCH 1/8] change() migrate to buster --- Dockerfile | 2 +- Makefile | 2 +- requirements.txt | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18ca1a2..66d20ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-slim-stretch +FROM python:3-slim ARG VERSION=undefined ENV VERSION ${VERSION} diff --git a/Makefile b/Makefile index ea019e4..d74cd2d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined") -IMG ?= quay.io/pusher/k8s-spot-termination-handler +IMG ?= quay.io/cogentwebworks/k8s-spot-termination-handler RED := \033[31m GREEN := \033[32m diff --git a/requirements.txt b/requirements.txt index 6f910cb..6fd9285 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -flake8==3.6.0 -pylint==2.3.1 -requests==2.21.0 -urllib3<1.25,>=1.21.1 +flake8==3.8.3 +pylint==2.5.3 +requests==2.24.0 +urllib3==1.25.10 From a1a9e1784df99ba92ab4e817cb74f0b3b0e1d0cc Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 13:39:11 +0700 Subject: [PATCH 2/8] change() back to alpine --- Dockerfile | 8 ++------ deploy/daemonset.yaml | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 66d20ab..b64dec0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,10 @@ -FROM python:3-slim +FROM python:3-alpine ARG VERSION=undefined ENV VERSION ${VERSION} # Install curl and certificates -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl \ - openssl \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache curl openssl ca-certificates # Install kubectl RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \ diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index 61e6c63..ca7f259 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -13,10 +13,10 @@ spec: app: k8s-spot-termination-handler spec: # Uncomment the following line if using RBAC - # serviceAccountName: k8s-spot-termination-handler + serviceAccountName: k8s-spot-termination-handler containers: - name: k8s-spot-termination-handler - image: quay.io/pusher/k8s-spot-termination-handler:v0.1.0 + image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.0 imagePullPolicy: IfNotPresent env: - name: NODE_NAME From eef1c9bc634de3ac041123f50b2735c5efc51da1 Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 13:42:55 +0700 Subject: [PATCH 3/8] change() new images version --- deploy/daemonset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index ca7f259..39d5683 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -16,7 +16,7 @@ spec: serviceAccountName: k8s-spot-termination-handler containers: - name: k8s-spot-termination-handler - image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.0 + image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.1 imagePullPolicy: IfNotPresent env: - name: NODE_NAME From 11f651d3c3fbdf2770a7e023c330dad707d5491f Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 13:50:45 +0700 Subject: [PATCH 4/8] v0.3.1 release --- deploy/daemonset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index 39d5683..d52f417 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -13,7 +13,7 @@ spec: app: k8s-spot-termination-handler spec: # Uncomment the following line if using RBAC - serviceAccountName: k8s-spot-termination-handler + #serviceAccountName: k8s-spot-termination-handler containers: - name: k8s-spot-termination-handler image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.1 From b838056e8966b049ccecf210d3e7dadca32cd735 Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 13:59:01 +0700 Subject: [PATCH 5/8] patch() combo patch 15fb6da,419a836 --- deploy/clusterrole.yaml | 1 + docker_entrypoint.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/clusterrole.yaml b/deploy/clusterrole.yaml index 7620694..2f63e6c 100644 --- a/deploy/clusterrole.yaml +++ b/deploy/clusterrole.yaml @@ -12,6 +12,7 @@ rules: verbs: - get - update + - patch - apiGroups: - "" resources: diff --git a/docker_entrypoint.py b/docker_entrypoint.py index 395df21..ebd02f4 100644 --- a/docker_entrypoint.py +++ b/docker_entrypoint.py @@ -32,7 +32,8 @@ def main(): if result == 0: print('Node Drain successful') break - + # Sleep so we do not restart before drain evicts this pod. + sleep(120) else: if counter == 60: counter = 0 From 4f8226d13fd763678a7b74d54d596f2f7beb231b Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 14:00:28 +0700 Subject: [PATCH 6/8] patch() enable RBAC by defaul --- deploy/daemonset.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index d52f417..54a1aa4 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -12,8 +12,8 @@ spec: labels: app: k8s-spot-termination-handler spec: - # Uncomment the following line if using RBAC - #serviceAccountName: k8s-spot-termination-handler + # comment the following line if not using RBAC + serviceAccountName: k8s-spot-termination-handler containers: - name: k8s-spot-termination-handler image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.1 From 124a75734f75afad1e5a6d5ccbdc7a2b5e96f8ae Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 14:01:31 +0700 Subject: [PATCH 7/8] pump to v0.0.4 --- deploy/daemonset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index 54a1aa4..05a0468 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -16,7 +16,7 @@ spec: serviceAccountName: k8s-spot-termination-handler containers: - name: k8s-spot-termination-handler - image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.3.1 + image: quay.io/cogentwebworks/k8s-spot-termination-handler:v0.4 imagePullPolicy: IfNotPresent env: - name: NODE_NAME From 3eba80f612d99718f70301412fcba355e1bbb541 Mon Sep 17 00:00:00 2001 From: Pichate Ins Date: Thu, 6 Aug 2020 14:20:59 +0700 Subject: [PATCH 8/8] fix() daemonset in kubernetes > 1.7 --- deploy/daemonset.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/daemonset.yaml b/deploy/daemonset.yaml index 05a0468..3acc3e7 100644 --- a/deploy/daemonset.yaml +++ b/deploy/daemonset.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: DaemonSet metadata: name: k8s-spot-termination-handler @@ -6,6 +6,9 @@ metadata: labels: app: k8s-spot-termination-handler spec: + selector: + matchLabels: + app: k8s-spot-termination-handler template: metadata: name: k8s-spot-termination-handler