Skip to content

Commit 7931858

Browse files
author
dkeightley
committed
Merge branch 'master' of github.com:rancher/rke-tools into worker_processes
2 parents 86decdd + 8a2ab96 commit 7931858

File tree

810 files changed

+198640
-128137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

810 files changed

+198640
-128137
lines changed

.drone.yml

+36-181
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ platform:
77

88
steps:
99
- name: build
10-
image: rancher/dapper:v0.5.1
10+
image: rancher/dapper:v0.5.7
1111
volumes:
1212
- name: docker
1313
path: /var/run/docker.sock
1414
commands:
1515
- dapper ci
16+
when:
17+
refs:
18+
- refs/head/master
19+
- refs/tags/*
20+
event:
21+
- push
22+
- pull_request
23+
- tag
1624
- name: stage-binaries
17-
image: rancher/dapper:v0.5.1
25+
image: rancher/dapper:v0.5.7
1826
commands:
1927
- cp -r ./bin/* ./
2028
when:
21-
instance:
22-
- drone-publish.rancher.io
2329
refs:
2430
- refs/head/master
2531
- refs/tags/*
@@ -37,9 +43,8 @@ steps:
3743
- ARCH=amd64
3844
repo: rancher/rke-tools
3945
tag: "${DRONE_TAG}-linux-amd64"
46+
no_cache: true
4047
when:
41-
instance:
42-
- drone-publish.rancher.io
4348
refs:
4449
- refs/head/master
4550
- refs/tags/*
@@ -59,19 +64,25 @@ platform:
5964

6065
steps:
6166
- name: build
62-
image: rancher/dapper:v0.5.1
67+
image: rancher/dapper:v0.5.7
6368
volumes:
6469
- name: docker
6570
path: /var/run/docker.sock
6671
commands:
6772
- dapper ci
73+
when:
74+
refs:
75+
- refs/head/master
76+
- refs/tags/*
77+
event:
78+
- push
79+
- pull_request
80+
- tag
6881
- name: stage-binaries
69-
image: rancher/dapper:v0.5.1
82+
image: rancher/dapper:v0.5.7
7083
commands:
7184
- cp -r ./bin/* ./
7285
when:
73-
instance:
74-
- drone-publish.rancher.io
7586
refs:
7687
- refs/head/master
7788
- refs/tags/*
@@ -89,9 +100,8 @@ steps:
89100
- ARCH=arm64
90101
repo: rancher/rke-tools
91102
tag: "${DRONE_TAG}-linux-arm64"
103+
no_cache: true
92104
when:
93-
instance:
94-
- drone-publish.rancher.io
95105
refs:
96106
- refs/head/master
97107
- refs/tags/*
@@ -127,45 +137,6 @@ steps:
127137
- name: docker_pipe
128138
path: \\\\.\\pipe\\docker_engine
129139
when:
130-
instance:
131-
- drone-publish.rancher.io
132-
refs:
133-
- refs/head/master
134-
- refs/tags/*
135-
event:
136-
- tag
137-
volumes:
138-
- name: docker_pipe
139-
host:
140-
path: \\\\.\\pipe\\docker_engine
141-
---
142-
kind: pipeline
143-
name: windows-1903
144-
145-
platform:
146-
os: windows
147-
arch: amd64
148-
version: 1903
149-
150-
steps:
151-
- name: publish-rke-tools-windows-1903
152-
image: plugins/docker
153-
settings:
154-
username:
155-
from_secret: docker_username
156-
password:
157-
from_secret: docker_password
158-
dockerfile: package/Dockerfile.windows
159-
build_args:
160-
- SERVERCORE_VERSION=1903
161-
repo: rancher/rke-tools
162-
tag: "${DRONE_TAG}-windows-1903"
163-
volumes:
164-
- name: docker_pipe
165-
path: \\\\.\\pipe\\docker_engine
166-
when:
167-
instance:
168-
- drone-publish.rancher.io
169140
refs:
170141
- refs/head/master
171142
- refs/tags/*
@@ -178,130 +149,6 @@ volumes:
178149

179150
---
180151
kind: pipeline
181-
name: windows-1909
182-
183-
platform:
184-
os: windows
185-
arch: amd64
186-
version: 1909
187-
188-
steps:
189-
- name: publish-rke-tools-windows-1909
190-
image: plugins/docker
191-
settings:
192-
username:
193-
from_secret: docker_username
194-
password:
195-
from_secret: docker_password
196-
dockerfile: package/Dockerfile.windows
197-
build_args:
198-
- SERVERCORE_VERSION=1909
199-
repo: rancher/rke-tools
200-
tag: "${DRONE_TAG}-windows-1909"
201-
volumes:
202-
- name: docker_pipe
203-
path: \\\\.\\pipe\\docker_engine
204-
when:
205-
instance:
206-
- drone-publish.rancher.io
207-
refs:
208-
- refs/head/master
209-
- refs/tags/*
210-
event:
211-
- tag
212-
volumes:
213-
- name: docker_pipe
214-
host:
215-
path: \\\\.\\pipe\\docker_engine
216-
---
217-
kind: pipeline
218-
name: windows-2004
219-
220-
platform:
221-
os: windows
222-
arch: amd64
223-
version: 2004
224-
225-
# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
226-
clone:
227-
disable: true
228-
229-
steps:
230-
- name: clone
231-
image: luthermonson/drone-git:windows-2004-amd64
232-
- name: publish-rke-tools-windows-2004
233-
image: luthermonson/drone-docker:2004
234-
settings:
235-
username:
236-
from_secret: docker_username
237-
password:
238-
from_secret: docker_password
239-
dockerfile: package/Dockerfile.windows
240-
build_args:
241-
- SERVERCORE_VERSION=2004
242-
repo: rancher/rke-tools
243-
tag: "${DRONE_TAG}-windows-2004"
244-
volumes:
245-
- name: docker_pipe
246-
path: \\\\.\\pipe\\docker_engine
247-
when:
248-
instance:
249-
- drone-publish.rancher.io
250-
refs:
251-
- refs/head/master
252-
- refs/tags/*
253-
event:
254-
- tag
255-
volumes:
256-
- name: docker_pipe
257-
host:
258-
path: \\\\.\\pipe\\docker_engine
259-
260-
---
261-
kind: pipeline
262-
name: windows-20H2
263-
264-
platform:
265-
os: windows
266-
arch: amd64
267-
version: 20H2
268-
269-
# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
270-
clone:
271-
disable: true
272-
273-
steps:
274-
- name: clone
275-
image: luthermonson/drone-git:windows-20H2-amd64
276-
- name: publish-rke-tools-windows-20H2
277-
image: luthermonson/drone-docker:20H2
278-
settings:
279-
username:
280-
from_secret: docker_username
281-
password:
282-
from_secret: docker_password
283-
dockerfile: package/Dockerfile.windows.20H2
284-
build_args:
285-
- SERVERCORE_VERSION=20H2
286-
repo: rancher/rke-tools
287-
tag: "${DRONE_TAG}-windows-20H2"
288-
volumes:
289-
- name: docker_pipe
290-
path: \\\\.\\pipe\\docker_engine
291-
when:
292-
instance:
293-
- drone-publish.rancher.io
294-
refs:
295-
- refs/head/master
296-
- refs/tags/*
297-
event:
298-
- tag
299-
volumes:
300-
- name: docker_pipe
301-
host:
302-
path: \\\\.\\pipe\\docker_engine
303-
---
304-
kind: pipeline
305152
name: manifest
306153

307154
steps:
@@ -314,8 +161,6 @@ steps:
314161
from_secret: docker_password
315162
spec: manifest.tmpl
316163
when:
317-
instance:
318-
- drone-publish.rancher.io
319164
refs:
320165
- refs/head/master
321166
- refs/tags/*
@@ -325,7 +170,17 @@ depends_on:
325170
- linux-amd64
326171
- linux-arm64
327172
- windows-1809
328-
- windows-1903
329-
- windows-1909
330-
- windows-2004
331-
- windows-20H2
173+
---
174+
kind: pipeline
175+
name: fossa
176+
177+
steps:
178+
- name: fossa
179+
image: rancher/drone-fossa:latest
180+
failure: ignore
181+
settings:
182+
api_key:
183+
from_secret: FOSSA_API_KEY
184+
when:
185+
instance:
186+
- drone-publish.rancher.io

Dockerfile.dapper

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM ubuntu:16.04
2-
# FROM arm=armhf/ubuntu:16.04 arm64=aarch64/ubuntu:16.04
1+
FROM ubuntu:20.04
2+
# FROM arm=armhf/ubuntu:20.04 arm64=arm64v8/ubuntu:20.04
33

44
ARG DAPPER_HOST_ARCH
55
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
@@ -11,7 +11,7 @@ RUN apt-get update && \
1111
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
1212
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash
1313

14-
RUN wget -O - https://dl.google.com/go/go1.14.4.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
14+
RUN wget -O - https://dl.google.com/go/go1.16.4.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
1515
go get golang.org/x/lint/golint
1616

1717
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \

entrypoint.sh

+27-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ if echo ${@} | grep -q "cloud-provider=azure"; then
1212
fi
1313
fi
1414

15+
if [ "$1" = "kube-proxy" ]; then
16+
if echo ${@} | grep -v "hostname-override"; then
17+
hostname=$(curl "http://169.254.169.254/latest/meta-data/hostname")
18+
set ${@} --hostname-override=$hostname
19+
fi
20+
fi
21+
1522
if [ "$1" = "kubelet" ]; then
1623
DOCKER_ROOT=$(DOCKER_API_VERSION=1.24 /opt/rke-tools/bin/docker info 2>&1 | grep -i 'docker root dir' | cut -f2 -d:)
1724
DOCKER_DIRS=$(find -O1 $DOCKER_ROOT -maxdepth 1) # used to exclude mounts that are subdirectories of $DOCKER_ROOT to ensure we don't unmount mounted filesystems on sub directories
@@ -70,8 +77,26 @@ if [ "$1" = "kubelet" ]; then
7077

7178
CGROUPDRIVER=$(/opt/rke-tools/bin/docker info | grep -i 'cgroup driver' | awk '{print $3}')
7279

73-
# final step for kubelet
74-
exec "$@" --cgroup-driver=$CGROUPDRIVER $RESOLVCONF
80+
# separate flow for cri-dockerd to minimize change to the existing way we run kubelet
81+
if [ "${RKE_KUBELET_CRIDOCKERD}" == "true" ]; then
82+
83+
# Get the value of pause image to start cri-dockerd
84+
RKE_KUBELET_PAUSEIMAGE=$(echo "$@" | grep -Eo "\-\-pod-infra-container-image+.*" | awk '{print $1}')
85+
/opt/rke-tools/bin/cri-dockerd --network-plugin="cni" --cni-conf-dir="/etc/cni/net.d" --cni-bin-dir="/opt/cni/bin" ${RKE_KUBELET_PAUSEIMAGE} &
86+
87+
# wait for cri-dockerd to start as kubelet depends on it
88+
echo "Sleeping 10 waiting for cri-dockerd to start"
89+
sleep 10
90+
91+
# start kubelet
92+
exec "$@" --cgroup-driver=$CGROUPDRIVER $RESOLVCONF &
93+
94+
# waiting for either cri-dockerd or kubelet to crash and exit so it can be restarted
95+
wait -n
96+
else
97+
# start kubelet
98+
exec "$@" --cgroup-driver=$CGROUPDRIVER $RESOLVCONF
99+
fi
75100
fi
76101

77102
exec "$@"

go.mod

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
module rke-tools
22

3-
go 1.14
3+
go 1.16
44

55
require (
6-
github.com/minio/minio-go/v6 v6.0.57
7-
github.com/sirupsen/logrus v1.5.0
8-
github.com/smartystreets/goconvey v1.6.4 // indirect
6+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
7+
github.com/google/uuid v1.3.0 // indirect
8+
github.com/klauspost/compress v1.15.6 // indirect
9+
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
10+
github.com/minio/md5-simd v1.1.2 // indirect
11+
github.com/minio/minio-go/v7 v7.0.27
12+
github.com/minio/sha256-simd v1.0.0 // indirect
13+
github.com/rs/xid v1.4.0 // indirect
14+
github.com/sirupsen/logrus v1.8.1
915
github.com/stretchr/testify v1.6.1 // indirect
10-
github.com/urfave/cli v1.18.0
11-
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
16+
github.com/urfave/cli v1.22.9
17+
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
18+
golang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect
19+
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 // indirect
20+
gopkg.in/ini.v1 v1.66.6 // indirect
1221
)

0 commit comments

Comments
 (0)