Skip to content

Commit 61c60eb

Browse files
committed
Merge branch 'v1.21'
2 parents 65faf41 + d7ff3fd commit 61c60eb

9 files changed

+664
-0
lines changed

.drone.yml

+283
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
kind: pipeline
2+
name: linux-amd64
3+
4+
platform:
5+
os: linux
6+
arch: amd64
7+
8+
steps:
9+
- name: prepare-amd64-binaries
10+
image: ubuntu:20.04
11+
commands:
12+
- apt-get -y update && apt-get -y install make curl tar
13+
- make k8s-binaries
14+
when:
15+
instance:
16+
- drone-publish.rancher.io
17+
event:
18+
- tag
19+
20+
- name: publish-hyperkube-linux-amd64
21+
image: plugins/docker
22+
settings:
23+
username:
24+
from_secret: docker_username
25+
password:
26+
from_secret: docker_password
27+
dockerfile: Dockerfile
28+
repo: rancher/hyperkube
29+
tag: "${DRONE_TAG}-linux-amd64"
30+
when:
31+
instance:
32+
- drone-publish.rancher.io
33+
event:
34+
- tag
35+
---
36+
kind: pipeline
37+
name: linux-arm64
38+
39+
platform:
40+
os: linux
41+
arch: arm64
42+
43+
steps:
44+
- name: prepare-arm64-binaries
45+
image: ubuntu:20.04
46+
commands:
47+
- apt-get -y update && apt-get -y install make curl tar
48+
- make ARCH=arm64 k8s-binaries
49+
when:
50+
instance:
51+
- drone-publish.rancher.io
52+
event:
53+
- tag
54+
55+
- name: publish-hyperkube-linux-arm64
56+
image: plugins/docker
57+
settings:
58+
username:
59+
from_secret: docker_username
60+
password:
61+
from_secret: docker_password
62+
dockerfile: Dockerfile
63+
repo: rancher/hyperkube
64+
tag: "${DRONE_TAG}-linux-arm64"
65+
when:
66+
instance:
67+
- drone-publish.rancher.io
68+
event:
69+
- tag
70+
---
71+
kind: pipeline
72+
name: windows-1809
73+
74+
platform:
75+
os: windows
76+
arch: amd64
77+
version: 1809
78+
79+
steps:
80+
- name: publish-hyperkube-windows-1809
81+
image: plugins/docker
82+
settings:
83+
username:
84+
from_secret: docker_username
85+
password:
86+
from_secret: docker_password
87+
dockerfile: Dockerfile.windows
88+
repo: rancher/hyperkube
89+
tag: "${DRONE_TAG}-windows-1809"
90+
build_args:
91+
- SERVERCORE_VERSION=1809
92+
volumes:
93+
- name: docker_pipe
94+
path: \\\\.\\pipe\\docker_engine
95+
when:
96+
instance:
97+
- drone-publish.rancher.io
98+
event:
99+
- tag
100+
101+
volumes:
102+
- name: docker_pipe
103+
host:
104+
path: \\\\.\\pipe\\docker_engine
105+
---
106+
kind: pipeline
107+
name: windows-1903
108+
109+
platform:
110+
os: windows
111+
arch: amd64
112+
version: 1903
113+
114+
steps:
115+
- name: publish-hyperkube-windows-1903
116+
image: plugins/docker
117+
settings:
118+
username:
119+
from_secret: docker_username
120+
password:
121+
from_secret: docker_password
122+
dockerfile: Dockerfile.windows
123+
repo: rancher/hyperkube
124+
tag: "${DRONE_TAG}-windows-1903"
125+
build_args:
126+
- SERVERCORE_VERSION=1903
127+
volumes:
128+
- name: docker_pipe
129+
path: \\\\.\\pipe\\docker_engine
130+
when:
131+
instance:
132+
- drone-publish.rancher.io
133+
event:
134+
- tag
135+
136+
volumes:
137+
- name: docker_pipe
138+
host:
139+
path: \\\\.\\pipe\\docker_engine
140+
---
141+
kind: pipeline
142+
name: windows-1909
143+
144+
platform:
145+
os: windows
146+
arch: amd64
147+
version: 1909
148+
149+
steps:
150+
- name: publish-hyperkube-windows-1909
151+
image: plugins/docker
152+
settings:
153+
username:
154+
from_secret: docker_username
155+
password:
156+
from_secret: docker_password
157+
dockerfile: Dockerfile.windows
158+
repo: rancher/hyperkube
159+
tag: "${DRONE_TAG}-windows-1909"
160+
build_args:
161+
- SERVERCORE_VERSION=1909
162+
volumes:
163+
- name: docker_pipe
164+
path: \\\\.\\pipe\\docker_engine
165+
when:
166+
instance:
167+
- drone-publish.rancher.io
168+
event:
169+
- tag
170+
171+
volumes:
172+
- name: docker_pipe
173+
host:
174+
path: \\\\.\\pipe\\docker_engine
175+
---
176+
kind: pipeline
177+
name: windows-2004
178+
179+
platform:
180+
os: windows
181+
arch: amd64
182+
version: 2004
183+
184+
# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
185+
clone:
186+
disable: true
187+
188+
steps:
189+
- name: clone
190+
image: luthermonson/drone-git:windows-2004-amd64
191+
- name: publish-hyperkube-windows-2004
192+
image: luthermonson/drone-docker:2004
193+
settings:
194+
username:
195+
from_secret: docker_username
196+
password:
197+
from_secret: docker_password
198+
dockerfile: Dockerfile.windows
199+
repo: rancher/hyperkube
200+
tag: "${DRONE_TAG}-windows-2004"
201+
build_args:
202+
- SERVERCORE_VERSION=2004
203+
volumes:
204+
- name: docker_pipe
205+
path: \\\\.\\pipe\\docker_engine
206+
when:
207+
instance:
208+
- drone-publish.rancher.io
209+
event:
210+
- tag
211+
212+
volumes:
213+
- name: docker_pipe
214+
host:
215+
path: \\\\.\\pipe\\docker_engine
216+
217+
---
218+
kind: pipeline
219+
name: windows-20H2
220+
221+
platform:
222+
os: windows
223+
arch: amd64
224+
version: 20H2
225+
226+
# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
227+
clone:
228+
disable: true
229+
230+
steps:
231+
- name: clone
232+
image: luthermonson/drone-git:windows-20H2-amd64
233+
- name: publish-hyperkube-windows-20H2
234+
image: luthermonson/drone-docker:20H2
235+
settings:
236+
username:
237+
from_secret: docker_username
238+
password:
239+
from_secret: docker_password
240+
dockerfile: Dockerfile.windows.20H2
241+
repo: rancher/hyperkube
242+
tag: "${DRONE_TAG}-windows-20H2"
243+
build_args:
244+
- SERVERCORE_VERSION=20H2
245+
volumes:
246+
- name: docker_pipe
247+
path: \\\\.\\pipe\\docker_engine
248+
when:
249+
instance:
250+
- drone-publish.rancher.io
251+
event:
252+
- tag
253+
254+
volumes:
255+
- name: docker_pipe
256+
host:
257+
path: \\\\.\\pipe\\docker_engine
258+
---
259+
kind: pipeline
260+
name: manifest
261+
262+
steps:
263+
- name: push-manifest
264+
image: plugins/manifest
265+
settings:
266+
username:
267+
from_secret: docker_username
268+
password:
269+
from_secret: docker_password
270+
spec: manifest.tmpl
271+
when:
272+
instance:
273+
- drone-publish.rancher.io
274+
event:
275+
- tag
276+
depends_on:
277+
- linux-amd64
278+
- linux-arm64
279+
- windows-1809
280+
- windows-1903
281+
- windows-1909
282+
- windows-2004
283+
- windows-20H2
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Docker image
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
push_to_registry:
7+
name: Push Docker image to GitHub Packages
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out the repo
11+
uses: actions/checkout@v2
12+
- name: Unpack binaries
13+
run: make k8s-binaries K8S_VERSION=${GITHUB_REF#refs/*/}
14+
- name: Push to GitHub Packages
15+
uses: docker/build-push-action@v1
16+
with:
17+
username: ${{ github.actor }}
18+
password: ${{ secrets.GITHUB_TOKEN }}
19+
registry: ghcr.io
20+
repository: stackhpc/hyperkube
21+
tag_with_ref: true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
k8s-tars/
2+
k8s-binaries/

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/stackhpc/hyperkube-base:v0.1.0
2+
3+
COPY k8s-binaries/kube* /usr/local/bin/

Dockerfile.windows

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
ARG SERVERCORE_VERSION
2+
3+
FROM mcr.microsoft.com/windows/servercore:${SERVERCORE_VERSION} as builder
4+
SHELL ["powershell", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
RUN if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) { \
6+
Install-PackageProvider -Name NuGet -Force -Verbose; \
7+
Install-Module -Name 7Zip4Powershell -Repository PSGallery -Force -Verbose; \
8+
if(-not $?) { \
9+
Write-Error "Failed to install package"; \
10+
Exit 1; \
11+
} \
12+
}
13+
ENV K8S_VERSION v1.20.5
14+
RUN $URL = ('https://dl.k8s.io/{0}/kubernetes-node-windows-amd64.tar.gz' -f $env:K8S_VERSION); \
15+
\
16+
function Expand-GZip ($inFile, $outFile) { \
17+
$input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); \
18+
$output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None); \
19+
$gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress); \
20+
try { \
21+
if (!$input -or !$output -or !$gzipStream) { \
22+
Write-Error "Failed to Unzip the archive"; \
23+
Exit 1; \
24+
} \
25+
$buffer = New-Object byte[](1024); \
26+
while ($true) { \
27+
$read = $gzipstream.Read($buffer, 0, 1024); \
28+
if ($read -le 0 ) { \
29+
break; \
30+
} \
31+
$output.Write($buffer, 0, $read); \
32+
} \
33+
} finally { \
34+
$gzipStream.Close(); \
35+
$output.Close(); \
36+
$input.Close(); \
37+
} \
38+
}; \
39+
\
40+
Write-Host ('Downloading Kubernetes from {0} ...' -f $URL); \
41+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
42+
Invoke-WebRequest -UseBasicParsing -OutFile c:\kubernetes.tar.gz -Uri $URL; \
43+
\
44+
Write-Host 'Expanding ...'; \
45+
Expand-GZip c:\kubernetes.tar.gz c:\kubernetes.tar; \
46+
Expand-7Zip c:\kubernetes.tar c:\; \
47+
\
48+
Write-Host 'Complete.'
49+
50+
FROM mcr.microsoft.com/powershell:nanoserver-${SERVERCORE_VERSION}
51+
USER ContainerAdministrator
52+
SHELL ["pwsh.exe", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
53+
RUN $URL = 'https://github.com/rancher/azure-cli/releases/download/v0.0.2/dist.azure-cli.zip'; \
54+
\
55+
Write-Host ('Downloading azure-cli from {0} ...' -f $URL); \
56+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
57+
Invoke-WebRequest -UseBasicParsing -OutFile c:\azure-cli.zip -Uri $URL; \
58+
\
59+
Write-Host 'Expanding ...'; \
60+
Expand-Archive -Force -Path c:\azure-cli.zip -DestinationPath c:\azure-cli; \
61+
Remove-Item -Force -Path c:\azure-cli.zip; \
62+
\
63+
Write-Host 'Complete.'
64+
COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/
65+
COPY --from=builder /kubernetes/node/bin/kubectl.exe /Windows
66+
COPY --from=builder /kubernetes/node/bin/kubelet.exe /kubernetes/node/bin/kube-proxy.exe /etc/kubernetes/bin/
67+
COPY windows/entrypoint.ps1 /usr/bin/

0 commit comments

Comments
 (0)