Skip to content
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

WIP: build/deploy csi-proxy in host-process container #179

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .cloudbuild.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#! /bin/bash

. release-tools/prow.sh

# Extract tag-n-hash value from GIT_TAG (form vYYYYMMDD-tag-n-hash) for REV value.
REV=v$(echo "$GIT_TAG" | cut -f3- -d 'v')
: ${CSI_PROW_BUILD_PLATFORMS:="windows amd64 .exe nanoserver:1809; windows amd64 .exe nanoserver:ltsc2022"}
: ${REGISTRY_NAME:="gcr.io/k8s-staging-sig-storage"}
Copy link
Member

@mauriciopoppe mauriciopoppe Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marosset so sorry for the late response. I checked what other CSI projects do and none of them push the presubmit artifacts to a remote! They instead just build the linux image locally and run a kind cluster on the location where the prow job runs for the integration tests.

I recently added a multidistro build to kubernetes-sigs/local-volume-provisioner in https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/pull/279/files, every prow job inherits the project through the env var $PROJECT which can be used for the presubmit image location.

One thing that I saw that might cause problems is that the tag is always canary for master, I think it should have some info about the git tag to avoid stepping on the changes of another contributor but we can fix that later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might make the presubmit job pass but I think I might be forgetting about the post submit image push to gcr.io/k8s-staging-sig-storage, I'll check that too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: ${REGISTRY_NAME:="gcr.io/k8s-staging-sig-storage"}

shouldn't be set in this file, this is the file that runs on postsubmit


# This creates the CSI_PROW_WORK directory that is needed by run_with_go.
ensure_paths
. release-tools/prow.sh

run_with_go "${CSI_PROW_GO_VERSION_BUILD}" make build REV="${REV}"
gcr_cloud_build
6 changes: 5 additions & 1 deletion .prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

# # Only these tests make sense for csi-proxy
: ${CSI_PROW_TESTS:="unit"}
: ${CSI_PROW_BUILD_PLATFORMS:="windows amd64 .exe"}
: ${CSI_PROW_BUILD_PLATFORMS:="windows amd64 .exe nanoserver:1809"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSI_PROW_BUILD_PLATFORMS should already have a default, I think we should remove this line and use that default instead

: ${REGISTRY_NAME:="gcr.io/k8s-staging-sig-storage"}
Copy link
Member

@mauriciopoppe mauriciopoppe Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be:

: ${REGISTRY_NAME:="gcr.io/$PROJECT"}


. release-tools/prow.sh

Expand All @@ -14,3 +15,6 @@ ensure_paths
# main
run_with_go "${CSI_PROW_GO_VERSION_BUILD}" make all "GOFLAGS_VENDOR=${GOFLAGS_VENDOR}" "BUILD_PLATFORMS=${CSI_PROW_BUILD_PLATFORMS}"
run_with_go "${CSI_PROW_GO_VERSION_BUILD}" make -k test "GOFLAGS_VENDOR=${GOFLAGS_VENDOR}" 2>&1 | make_test_to_junit

# build / push multi-arch images for validation
gcr_cloud_build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for clarification, this file .prow.sh is what runs in the presubmit jobs and .cloudbuild.sh is the one that runs on postsubmit jobs

9 changes: 9 additions & 0 deletions Dockerfile.Windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG BASE_IMAGE=nanoserver:1809
ARG REGISTRY=mcr.microsoft.com/windows

FROM ${REGISTRY}/${BASE_IMAGE}

Add /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"]
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all: build test
# include release tools for building binary and testing targets
include release-tools/build.make

BUILD_PLATFORMS=windows amd64 .exe
BUILD_PLATFORMS=windows amd64 .exe nanoserver:1809
GOPATH ?= $(shell go env GOPATH)
REPO_ROOT = $(CURDIR)
BUILD_DIR = bin
Expand Down Expand Up @@ -74,3 +74,5 @@ test-vet:
# see https://github.com/golangci/golangci-lint#binary-release
$(GOLANGCI_LINT):
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$$(dirname '$(GOLANGCI_LINT)')" '$(GOLANGCI_LINT_VERSION)'

.PHONY: push-multiarch-% push-multiarch
25 changes: 25 additions & 0 deletions deploy/csi-proxy-ds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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: mrosse3/csi-proxy:canary # for testing
imagePullPolicy: Always # for testing