Skip to content

Commit

Permalink
Merge branch 'v1.21'
Browse files Browse the repository at this point in the history
  • Loading branch information
brtkwr committed Apr 20, 2021
2 parents 65faf41 + d7ff3fd commit 61c60eb
Show file tree
Hide file tree
Showing 9 changed files with 664 additions and 0 deletions.
283 changes: 283 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
kind: pipeline
name: linux-amd64

platform:
os: linux
arch: amd64

steps:
- name: prepare-amd64-binaries
image: ubuntu:20.04
commands:
- apt-get -y update && apt-get -y install make curl tar
- make k8s-binaries
when:
instance:
- drone-publish.rancher.io
event:
- tag

- name: publish-hyperkube-linux-amd64
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
repo: rancher/hyperkube
tag: "${DRONE_TAG}-linux-amd64"
when:
instance:
- drone-publish.rancher.io
event:
- tag
---
kind: pipeline
name: linux-arm64

platform:
os: linux
arch: arm64

steps:
- name: prepare-arm64-binaries
image: ubuntu:20.04
commands:
- apt-get -y update && apt-get -y install make curl tar
- make ARCH=arm64 k8s-binaries
when:
instance:
- drone-publish.rancher.io
event:
- tag

- name: publish-hyperkube-linux-arm64
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile
repo: rancher/hyperkube
tag: "${DRONE_TAG}-linux-arm64"
when:
instance:
- drone-publish.rancher.io
event:
- tag
---
kind: pipeline
name: windows-1809

platform:
os: windows
arch: amd64
version: 1809

steps:
- name: publish-hyperkube-windows-1809
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-1809"
build_args:
- SERVERCORE_VERSION=1809
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
---
kind: pipeline
name: windows-1903

platform:
os: windows
arch: amd64
version: 1903

steps:
- name: publish-hyperkube-windows-1903
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-1903"
build_args:
- SERVERCORE_VERSION=1903
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
---
kind: pipeline
name: windows-1909

platform:
os: windows
arch: amd64
version: 1909

steps:
- name: publish-hyperkube-windows-1909
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-1909"
build_args:
- SERVERCORE_VERSION=1909
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
---
kind: pipeline
name: windows-2004

platform:
os: windows
arch: amd64
version: 2004

# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
clone:
disable: true

steps:
- name: clone
image: luthermonson/drone-git:windows-2004-amd64
- name: publish-hyperkube-windows-2004
image: luthermonson/drone-docker:2004
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-2004"
build_args:
- SERVERCORE_VERSION=2004
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine

---
kind: pipeline
name: windows-20H2

platform:
os: windows
arch: amd64
version: 20H2

# remove this and use upstream images when https://github.com/drone/drone-git/pull/25 is merged
clone:
disable: true

steps:
- name: clone
image: luthermonson/drone-git:windows-20H2-amd64
- name: publish-hyperkube-windows-20H2
image: luthermonson/drone-docker:20H2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: Dockerfile.windows.20H2
repo: rancher/hyperkube
tag: "${DRONE_TAG}-windows-20H2"
build_args:
- SERVERCORE_VERSION=20H2
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
instance:
- drone-publish.rancher.io
event:
- tag

volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
---
kind: pipeline
name: manifest

steps:
- name: push-manifest
image: plugins/manifest
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
spec: manifest.tmpl
when:
instance:
- drone-publish.rancher.io
event:
- tag
depends_on:
- linux-amd64
- linux-arm64
- windows-1809
- windows-1903
- windows-1909
- windows-2004
- windows-20H2
21 changes: 21 additions & 0 deletions .github/workflows/build-push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Unpack binaries
run: make k8s-binaries K8S_VERSION=${GITHUB_REF#refs/*/}
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
repository: stackhpc/hyperkube
tag_with_ref: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
k8s-tars/
k8s-binaries/
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/stackhpc/hyperkube-base:v0.1.0

COPY k8s-binaries/kube* /usr/local/bin/
67 changes: 67 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
ARG SERVERCORE_VERSION

FROM mcr.microsoft.com/windows/servercore:${SERVERCORE_VERSION} as builder
SHELL ["powershell", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) { \
Install-PackageProvider -Name NuGet -Force -Verbose; \
Install-Module -Name 7Zip4Powershell -Repository PSGallery -Force -Verbose; \
if(-not $?) { \
Write-Error "Failed to install package"; \
Exit 1; \
} \
}
ENV K8S_VERSION v1.20.5
RUN $URL = ('https://dl.k8s.io/{0}/kubernetes-node-windows-amd64.tar.gz' -f $env:K8S_VERSION); \
\
function Expand-GZip ($inFile, $outFile) { \
$input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); \
$output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None); \
$gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress); \
try { \
if (!$input -or !$output -or !$gzipStream) { \
Write-Error "Failed to Unzip the archive"; \
Exit 1; \
} \
$buffer = New-Object byte[](1024); \
while ($true) { \
$read = $gzipstream.Read($buffer, 0, 1024); \
if ($read -le 0 ) { \
break; \
} \
$output.Write($buffer, 0, $read); \
} \
} finally { \
$gzipStream.Close(); \
$output.Close(); \
$input.Close(); \
} \
}; \
\
Write-Host ('Downloading Kubernetes from {0} ...' -f $URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -UseBasicParsing -OutFile c:\kubernetes.tar.gz -Uri $URL; \
\
Write-Host 'Expanding ...'; \
Expand-GZip c:\kubernetes.tar.gz c:\kubernetes.tar; \
Expand-7Zip c:\kubernetes.tar c:\; \
\
Write-Host 'Complete.'

FROM mcr.microsoft.com/powershell:nanoserver-${SERVERCORE_VERSION}
USER ContainerAdministrator
SHELL ["pwsh.exe", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN $URL = 'https://github.com/rancher/azure-cli/releases/download/v0.0.2/dist.azure-cli.zip'; \
\
Write-Host ('Downloading azure-cli from {0} ...' -f $URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -UseBasicParsing -OutFile c:\azure-cli.zip -Uri $URL; \
\
Write-Host 'Expanding ...'; \
Expand-Archive -Force -Path c:\azure-cli.zip -DestinationPath c:\azure-cli; \
Remove-Item -Force -Path c:\azure-cli.zip; \
\
Write-Host 'Complete.'
COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/
COPY --from=builder /kubernetes/node/bin/kubectl.exe /Windows
COPY --from=builder /kubernetes/node/bin/kubelet.exe /kubernetes/node/bin/kube-proxy.exe /etc/kubernetes/bin/
COPY windows/entrypoint.ps1 /usr/bin/
Loading

0 comments on commit 61c60eb

Please sign in to comment.