Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 018007e

Browse files
authored
checkpointer: ignore Affinity within podspec (#1009)
* checkpointer: ignore Affinity within podspec Kubernetes 1.12.x introduced new logic for Affinity [1]. In addition to new logic, the Pod contains a default affinity. The new default affinity gets serialized into the checkpoint file, and the 1.12.x kubelet does not restore the pod due to the affinity. This PR removes the affinity from the spec and documents that affinity's are not supported. ``` "affinity": { "nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { "nodeSelectorTerms": [ { "matchExpressions": null } ] } } }, ``` [1] kubernetes/kubernetes#68173 [2] https://github.com/kubernetes/kubernetes/blob/e39b510726113581c6f6a9c2db1753d794aa9cce/pkg/controller/daemon/util/daemonset_util.go#L183-L196 * gofmt * golang: bump to 1.11.1 * fixes checkpointer run * checkpointer test will have a modified asset file
1 parent bf8c232 commit 018007e

File tree

8 files changed

+9
-7
lines changed

8 files changed

+9
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ before_script:
44
- unzip terraform_0.11.3_linux_amd64.zip
55
- export PATH=$PWD:$PATH
66
go:
7-
- 1.10.x
7+
- 1.11.x
88
script:
99
- make release

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ endif
3939

4040
gofmt:
4141
gofmt -s -w $(GOFILES)
42-
git diff --exit-code
4342

4443
install:
4544
go install -ldflags "$(LDFLAGS)" ./cmd/bootkube

build/build-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ BOOTKUBE_ROOT=$(git rev-parse --show-toplevel)
55
sudo rkt run \
66
--volume bk,kind=host,source=${BOOTKUBE_ROOT} \
77
--mount volume=bk,target=/go/src/github.com/kubernetes-incubator/bootkube \
8-
--insecure-options=image docker://golang:1.9.4 --exec /bin/bash -- -c \
8+
--insecure-options=image docker://golang:1.11.1 --exec /bin/bash -- -c \
99
"cd /go/src/github.com/kubernetes-incubator/bootkube && make release"

cmd/checkpoint/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is accomplished by managing checkpoints as static pod manifests:
1717
## Use
1818

1919
Any pod which contains the `checkpointer.alpha.coreos.com/checkpoint=true` annotation will be considered a viable "parent pod" which should be checkpointed.
20-
The parent pod cannot itself be a static pod, and is not a checkpoint itself.
20+
The parent pod cannot itself be a static pod, and is not a checkpoint itself. Affinity is not supported for a pod, and any pod labelled with the checkpoint annotation will be checkpointed.
2121

2222
Checkpoints are denoted by the `checkpointer.alpha.coreos.com/checkpoint-of` annotation. This annotation will point to the parent of this checkpoint by pod name.
2323

hack/tests/conformance-gce.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ else
114114

115115
#TODO(pb): See if there is a way to make the --inherit-env option replace
116116
#passing all the variables manually.
117-
sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.9.4 --exec /bin/bash -- -c \
117+
sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.11.1 --exec /bin/bash -- -c \
118118
"IN_CONTAINER=true COREOS_CHANNEL=${COREOS_CHANNEL} GCE_PREFIX=${GCE_PREFIX} GCE_SERVICE_ACCOUNT=${GCE_SERVICE_ACCOUNT} GCE_PROJECT=${GCE_PROJECT} /build/bootkube/hack/tests/$(basename $0)"
119119
fi

hack/tests/conformance-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ CONFORMANCE="\
4444
KUBECONFIG=/kubeconfig KUBERNETES_CONFORMANCE_TEST=Y go run hack/e2e.go \
4545
-- -v --test --check-version-skew=false --provider=skeleton --test_args='--ginkgo.focus=\[Conformance\]'"
4646

47-
CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.9.4 --exec /bin/bash -- -c \"${INIT} && ${BUILD} && ${CONFORMANCE}\""
47+
CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.11.1 --exec /bin/bash -- -c \"${INIT} && ${BUILD} && ${CONFORMANCE}\""
4848
ssh -q -o UserKnownHostsFile=/dev/null -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"

pkg/checkpoint/pod.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func sanitizeCheckpointPod(cp *v1.Pod) *v1.Pod {
6363
cp.Spec.ServiceAccountName = ""
6464
cp.Spec.DeprecatedServiceAccount = ""
6565

66+
// Remove affinity
67+
cp.Spec.Affinity = nil
68+
6669
// Sanitize the volumes
6770
for i := range cp.Spec.Volumes {
6871
v := &cp.Spec.Volumes[i]

pkg/tlsutil/tlsutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func NewSelfSignedCACertificate(cfg CertConfig, key *rsa.PrivateKey) (*x509.Cert
7878
NotAfter: now.Add(Duration365d * 10).UTC(),
7979
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
8080
BasicConstraintsValid: true,
81-
IsCA: true,
81+
IsCA: true,
8282
}
8383

8484
certDERBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, key.Public(), key)

0 commit comments

Comments
 (0)