-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Csi proxy image #203
Merged
Merged
Csi proxy image #203
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
adc13e5
Building container image for csi-proxy
marosset 23c55f5
Adding set -e to hostprocess/csi-proxy/build.sh
marosset 51f0c14
updating github action defintion to (only trigger release if VERSION …
marosset 24a890e
fixup
marosset 29fa6d6
Updating csi-proxy build scripts to not push for ci builds
marosset 886a88a
fixing workflow to not push for CI builds
marosset File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: csi-proxy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- hostprocess/csi-proxy/VERSION | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- hostprocess/csi-proxy/** | ||
branchs: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: login to GitHub container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: build image for ci | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
cd hostprocess/csi-proxy | ||
./build.sh --version ci | ||
- name: build image for release | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: | | ||
cd hostprocess/csi-proxy | ||
export version=$(cat ./hostprocess/csi-proxy/VERSION) | ||
./build.sh --version $version --push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG REGISTRY=mcr.microsoft.com/windows | ||
ARG WINDOWS_BASE_IMAGE=nanoserver | ||
ARG WINDOWS_VERSION=1809 | ||
|
||
FROM --platform=linux/amd64 golang:1.16 as builder | ||
ARG CSI_PROXY_VERSION=v1.0.2 | ||
RUN git clone https://github.com/kubernetes-csi/csi-proxy.git /go/csi-proxy &&\ | ||
cd /go/csi-proxy &&\ | ||
git checkout tags/${CSI_PROXY_VERSION} &&\ | ||
make build | ||
|
||
FROM ${REGISTRY}/${WINDOWS_BASE_IMAGE}:${WINDOWS_VERSION} | ||
COPY --from=builder /go/csi-proxy/bin/csi-proxy.exe /csi-proxy.exe | ||
ENV PATH="C:\Windows\system32;C:\Windows;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;" | ||
ENTRYPOINT ["csi-proxy.exe", "-v", "4"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# CSI-proxy | ||
|
||
Runs [csi-proxy](https://github.com/kubernetes-csi/csi-proxy) on Windows nodes as a hostprocess container. | ||
|
||
## Deploy | ||
|
||
``` bash | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/hostprocess/csi-proxy/csi-proxy.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v1.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
args=$(getopt -o v:p -l version:,push -- "$@") | ||
eval set -- "$args" | ||
|
||
while [ $# -ge 1 ]; do | ||
case "$1" in | ||
--) | ||
shift | ||
break | ||
;; | ||
-v|--version) | ||
version="$2" | ||
shift | ||
;; | ||
-p|--push) | ||
push="1" | ||
shift | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [[ -z "$version" ]]; then | ||
echo "--version is required" | ||
exit 1 | ||
fi | ||
echo "Using version ${version}" | ||
|
||
output="type=docker,dest=./export.tar" | ||
|
||
if [[ "$push" == "1" ]]; then | ||
output="type=registry" | ||
fi | ||
|
||
repository=${repository:-"ghcr.io/kubernetes-sigs/sig-windows"} | ||
|
||
set -x | ||
|
||
docker buildx create --name img-builder --use --platform windows/amd64 | ||
trap 'docker buildx rm img-builder' EXIT | ||
|
||
|
||
declare -a win_vers=("1809" "ltsc2022") | ||
|
||
manifest_entries="" | ||
|
||
# Build container images with buildx | ||
for win_ver in "${win_vers[@]}"; do | ||
docker buildx build --platform windows/amd64 --output=$output -f Dockerfile.windows --build-arg=WINDOWS_VERSION=$win_ver -t ${repository}/csi-proxy:${version}-$win_ver . | ||
|
||
manifest_entries="$manifest_entries ${repository}/csi-proxy:${version}-$win_ver" | ||
done | ||
|
||
if [[ $push != "1" ]]; then | ||
exit | ||
fi | ||
|
||
# Create manifest | ||
docker manifest create ${repository}/csi-proxy:${version} $manifest_entries | ||
|
||
# Annotate manifests | ||
for win_ver in "${win_vers[@]}"; do | ||
os_ver=$(docker manifest inspect mcr.microsoft.com/windows/nanoserver:${win_ver} | grep "os.version" | head -n 1 | awk -F\" '{print $4}') | ||
docker manifest annotate --os windows --arch amd64 --os-version $os_ver $repository/csi-proxy:$version $repository/csi-proxy:$version-$win_ver | ||
done | ||
|
||
docker manifest inspect $repository/csi-proxy:$version | ||
|
||
docker manifest push ${repository}/csi-proxy:${version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: csi-proxy | ||
namespace: kube-system | ||
spec: | ||
selector: | ||
matchLabels: | ||
name: csi-proxy | ||
template: | ||
metadata: | ||
labels: | ||
name: csi-proxy | ||
spec: | ||
nodeSelector: | ||
"kubernetes.io/os": windows | ||
securityContext: | ||
windowsOptions: | ||
hostProcess: true | ||
runAsUserName: "NT AUTHORITY\\SYSTEM" | ||
hostNetwork: true | ||
containers: | ||
- name: csi-proxy | ||
image: ghcr.io/kubernetes-sigs/sig-windows/csi-proxy:v1.0.2 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the env issue mentioned in https://github.com/kubernetes/kubernetes/blob/master/build/pause/Dockerfile_windows#L26-L28 has been fixed long ago, is this sill needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might not be.