Skip to content

Commit

Permalink
Merge pull request #196 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…95-to-release-4.10

Bug 2050190: Rebase v1.5.1
  • Loading branch information
openshift-merge-robot committed Feb 5, 2022
2 parents 8741c5f + 781976c commit 153118c
Show file tree
Hide file tree
Showing 104 changed files with 2,180 additions and 2,496 deletions.
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-8-release-golang-1.16-openshift-4.10
tag: rhel-8-release-golang-1.17-openshift-4.10
51 changes: 11 additions & 40 deletions .github/workflows/container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ jobs:
buildx:
# this is to prevent the job to run at forked projects
if: github.repository == 'kubernetes-sigs/aws-ebs-csi-driver'
env:
IMAGE: aws-ebs-csi-driver
DEB_BUILD_TAG: aws-ebs-csi-driver:debian
AL2_BUILD_TAG: aws-ebs-csi-driver:amazonlinux
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -20,49 +16,24 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build debian target
run: |
docker buildx build \
-t $DEB_BUILD_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=false" . \
--target=debian-base
- name: Build amazonlinux target
run: |
docker buildx build \
-t $AL2_BUILD_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=false" . \
--target=amazonlinux
- name: Set environment variables
run: |
BRANCH=$(echo $GITHUB_REF | cut -d'/' -f3)
SHORT_SHA=$(echo $GITHUB_SHA | cut -c -7)
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
if [ "$BRANCH" = "master" ]; then
TAG=$SHORT_SHA
REGISTRY_NAME=docker.io/amazon
BRANCH_OR_TAG=$(echo $GITHUB_REF | cut -d'/' -f3)
if [ "$BRANCH_OR_TAG" = "master" ]; then
GIT_TAG=$GITHUB_SHA
else
TAG=$BRANCH
GIT_TAG=$BRANCH_OR_TAG
fi
echo "TAG=$TAG" >> $GITHUB_ENV
echo "REGISTRY_NAME=$REGISTRY_NAME" >> $GITHUB_ENV
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push debian target to Docker Hub
run: |
DEB_PUSH_TAG="amazon/$IMAGE:$TAG"
docker buildx build \
-t $DEB_PUSH_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=true" . \
--target=debian-base
- name: Push amazonlinux target to Docker Hub
- name: Push manifest list containing amazon linux and windows based images to Docker Hub
run: |
AL2_PUSH_TAG="amazon/$IMAGE:$TAG-amazonlinux"
docker buildx build \
-t $AL2_PUSH_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=true" . \
--target=amazonlinux
export REGISTRY=$REGISTRY_NAME
export TAG=$GIT_TAG
make all-push
62 changes: 62 additions & 0 deletions CHANGELOG-0.x.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# v1.5.1
## Notable changes
* Address CVE ALAS-2021-1552

# v1.5.0
### Misc.
* Update windows example to refer to v1.4.0 ([#1093](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1093), [@wongma7](https://github.com/wongma7))
* Bump eksctl used in e2e tests to 0.69.0 ([#1094](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1094), [@wongma7](https://github.com/wongma7))
* Update to go 1.17 ([#1109](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1109), [@bertinatto](https://github.com/bertinatto))

# v1.4.0
## Notable changes
* Recognize instance-type node label when EC2 metadata isn't available ([#1060](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1060), [@rifelpet](https://github.com/rifelpet))
* Fix windows NodePublish failing because mount target doesn't exist ([#1081](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1081), [@wongma7](https://github.com/wongma7))
* Search for nvme device path even if non-nvme exists ([#1082](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1082), [@wongma7](https://github.com/wongma7))

### Misc.
* Bump csi-proxy from RC v1.0.0 to GA v1.0.1 ([#1018](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1018), [@wongma7](https://github.com/wongma7))
* Fix spacing in RELEASE.md ([#1035](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1035), [@wongma7](https://github.com/wongma7))
* [chart] Support image.pullPolicy for csi-resizer image ([#1045](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1045), [@jyaworski](https://github.com/jyaworski))
* merge 1.3.0 release and post-release commits into master ([#1068](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1068), [@vdhanan](https://github.com/vdhanan))
* Allow default fstype to be overriden via values.yaml ([#1069](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1069), [@jcrsilva](https://github.com/jcrsilva))
* Update windows example for image release ([#1070](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1070), [@wongma7](https://github.com/wongma7))
* Refactor pkg/cloud/metadata.go into pkg/cloud/metadata_*.go files ([#1074](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1074), [@wongma7](https://github.com/wongma7))
* Move mocks to parent package to avoid import cycle ([#1078](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1078), [@wongma7](https://github.com/wongma7))
* deploy: Add resizer and snapshotter images to kustomization ([#1080](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1080), [@maxbrunet](https://github.com/maxbrunet))
* deploy: Fix csi-resizer tag and bump to v1.1.0 ([#1085](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1085), [@maxbrunet](https://github.com/maxbrunet))
* Reorder isMounted for readability ([#1087](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1087), [@wongma7](https://github.com/wongma7))

# v1.3.1
* Push multi-arch/os image manifest to ECR.

# v1.3.0
## Notable changes
* Make NodePublish Mount Idempotent ([#1019](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1019), [@nirmalaagash](https://github.com/nirmalaagash))
* Build and push multi-arch/os (amazon and windows, no debian) image manifest via Make rules ([#957](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/957), [@wongma7](https://github.com/wongma7))

### Bug fixes
* Fix windows build IsCorruptedMnt not implemented ([#1047](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1047), [@wongma7](https://github.com/wongma7))
* Hash volume name to get client token ([#1041](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1041), [@vdhanan](https://github.com/vdhanan))
* Include ClusterRole and ClusterRoleBinding for csi-node ([#1021](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1021), [@groodt](https://github.com/groodt))
* Fix gcr prow builld failing because docker missing --os-version ([#1020](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1020), [@wongma7](https://github.com/wongma7))
* Fix gcr prow build failing because of IMAGE variable collision ([#1017](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1017), [@wongma7](https://github.com/wongma7))
* Fix github build failing because of wrong docker hub registry name ([#1016](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1016), [@wongma7](https://github.com/wongma7))

### New features
* [chart] Add controller strategy ([#1008](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1008), [@stevehipwell](https://github.com/stevehipwell))
* [chart] Node update strategy & auto driver image tag ([#988](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/988), [@stevehipwell](https://github.com/stevehipwell))

### Misc.
* Update helm chart alongside kustomize, after images have been pushed, for consistency ([#1015](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1015), [@wongma7](https://github.com/wongma7))
* Update kustomize templates only after verifying images are available in registries ([#995](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/995), [@wongma7](https://github.com/wongma7))

# v1.2.1
## Notable changes
- Fix mount idempotency ([#1019](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1019), [@nirmalaagash](https://github.com/nirmalaagash))

# v1.2.0
## Notable changes
* utilize latest go sdk to ensure createVolume idempotency ([#982](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/982), [@AndyXiangLi](https://github.com/AndyXiangLi))
Expand Down Expand Up @@ -46,6 +103,11 @@
* Release 1.1.3 ([#992](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/992), [@wongma7](https://github.com/wongma7))
* add ecr images to readme ([#998](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/998), [@vdhanan](https://github.com/vdhanan))

# v1.1.4

## Notable changes
- Fix mount idempotency ([#1019](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1019), [@nirmalaagash](https://github.com/nirmalaagash))

# v1.1.3

## Notable changes
Expand Down
29 changes: 18 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.16 AS builder
FROM --platform=$BUILDPLATFORM golang:1.17 AS builder
WORKDIR /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver
COPY . .
RUN make
ARG OS
ARG ARCH
RUN make $OS/$ARCH

FROM amazonlinux:2 AS amazonlinux
RUN yum update -y
RUN yum install ca-certificates e2fsprogs xfsprogs util-linux -y
RUN yum clean all
FROM amazonlinux:2 AS linux-amazon
RUN yum update -y && \
yum install ca-certificates e2fsprogs xfsprogs util-linux -y && \
yum clean all
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver /bin/aws-ebs-csi-driver

ENTRYPOINT ["/bin/aws-ebs-csi-driver"]

FROM k8s.gcr.io/build-image/debian-base:buster-v1.8.0 AS debian-base
RUN clean-install ca-certificates e2fsprogs mount udev util-linux xfsprogs
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver /bin/aws-ebs-csi-driver
FROM mcr.microsoft.com/windows/servercore:1809 AS windows-1809
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver.exe /aws-ebs-csi-driver.exe
ENTRYPOINT ["/aws-ebs-csi-driver.exe"]

ENTRYPOINT ["/bin/aws-ebs-csi-driver"]
FROM mcr.microsoft.com/windows/servercore:2004 AS windows-2004
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver.exe /aws-ebs-csi-driver.exe
ENTRYPOINT ["/aws-ebs-csi-driver.exe"]

FROM mcr.microsoft.com/windows/servercore:20H2 AS windows-20H2
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver.exe /aws-ebs-csi-driver.exe
ENTRYPOINT ["/aws-ebs-csi-driver.exe"]
2 changes: 1 addition & 1 deletion Dockerfile.openshift.rhel7
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.16-openshift-4.10 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.17-openshift-4.10 AS builder
WORKDIR /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver
COPY . .
RUN make
Expand Down
23 changes: 0 additions & 23 deletions Dockerfile.windows

This file was deleted.

92 changes: 83 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,103 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION=v1.5.1

PKG=github.com/kubernetes-sigs/aws-ebs-csi-driver
IMAGE?=amazon/aws-ebs-csi-driver
VERSION=v1.2.0
VERSION_AMAZONLINUX=$(VERSION)-amazonlinux
GIT_COMMIT?=$(shell git rev-parse HEAD)
BUILD_DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILD_DATE?=$(shell date -u -Iseconds)

LDFLAGS?="-X ${PKG}/pkg/driver.driverVersion=${VERSION} -X ${PKG}/pkg/cloud.driverVersion=${VERSION} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE} -s -w"

GO111MODULE=on
GOPROXY=direct
GOPATH=$(shell go env GOPATH)
GOOS=$(shell go env GOOS)
GOBIN=$(shell pwd)/bin

REGISTRY?=gcr.io/k8s-staging-provider-aws
IMAGE?=$(REGISTRY)/aws-ebs-csi-driver
TAG?=$(GIT_COMMIT)

OUTPUT_TYPE?=docker

OS?=linux
ARCH?=amd64
OSVERSION?=amazon

ALL_OS?=linux windows
ALL_ARCH_linux?=amd64 arm64
ALL_OSVERSION_linux?=amazon
ALL_OS_ARCH_OSVERSION_linux=$(foreach arch, $(ALL_ARCH_linux), $(foreach osversion, ${ALL_OSVERSION_linux}, linux-$(arch)-${osversion}))
ALL_ARCH_windows?=amd64
ALL_OSVERSION_windows?=1809 2004 20H2
ALL_OS_ARCH_OSVERSION_windows=$(foreach arch, $(ALL_ARCH_windows), $(foreach osversion, ${ALL_OSVERSION_windows}, windows-$(arch)-${osversion}))
ALL_OS_ARCH_OSVERSION=$(foreach os, $(ALL_OS), ${ALL_OS_ARCH_OSVERSION_${os}})

# split words on hyphen, access by 1-index
word-hyphen = $(word $2,$(subst -, ,$1))

.EXPORT_ALL_VARIABLES:

.PHONY: bin/aws-ebs-csi-driver
.PHONY: linux/$(ARCH) bin/aws-ebs-csi-driver
linux/$(ARCH): bin/aws-ebs-csi-driver
bin/aws-ebs-csi-driver: | bin
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-ebs-csi-driver ./cmd/
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-ebs-csi-driver ./cmd/

.PHONY: bin/aws-ebs-csi-driver.exe
.PHONY: windows/$(ARCH) bin/aws-ebs-csi-driver.exe
windows/$(ARCH): bin/aws-ebs-csi-driver.exe
bin/aws-ebs-csi-driver.exe: | bin
CGO_ENABLED=0 GOOS=windows go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-ebs-csi-driver.exe ./cmd/
CGO_ENABLED=0 GOOS=windows GOARCH=$(ARCH) go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-ebs-csi-driver.exe ./cmd/

# Builds all linux images (not windows because it can't be exported with OUTPUT_TYPE=docker)
all: all-image-docker

# Builds all linux and windows images and pushes them
all-push: all-image-registry push-manifest

push-manifest: create-manifest all-annotate-manifest
docker manifest push --purge $(IMAGE):$(TAG)

create-manifest:
# sed expression:
# LHS: match 0 or more not space characters
# RHS: replace with $(IMAGE):$(TAG)-& where & is what was matched on LHS
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_OS_ARCH_OSVERSION) | sed -e "s~[^ ]*~$(IMAGE):$(TAG)\-&~g")

all-annotate-manifest: $(addprefix sub-annotate-manifest-,$(ALL_OS_ARCH_OSVERSION))

sub-annotate-manifest-%:
$(MAKE) OS=$(call word-hyphen,$*,1) ARCH=$(call word-hyphen,$*,2) OSVERSION=$(call word-hyphen,$*,3) annotate-manifest

annotate-manifest: .annotate-manifest-$(OS)-$(ARCH)-$(OSVERSION)
.annotate-manifest-$(OS)-$(ARCH)-$(OSVERSION):
set -x; docker manifest annotate --os $(OS) --arch $(ARCH) --os-version $(OSVERSION) $(IMAGE):$(TAG) $(IMAGE):$(TAG)-$(OS)-$(ARCH)-$(OSVERSION)

# only linux for OUTPUT_TYPE=docker because windows image cannot be exported
# "Currently, multi-platform images cannot be exported with the docker export type. The most common usecase for multi-platform images is to directly push to a registry (see registry)."
# https://docs.docker.com/engine/reference/commandline/buildx_build/#output
all-image-docker: $(addprefix sub-image-docker-,$(ALL_OS_ARCH_OSVERSION_linux))
all-image-registry: $(addprefix sub-image-registry-,$(ALL_OS_ARCH_OSVERSION))

sub-image-%:
$(MAKE) OUTPUT_TYPE=$(call word-hyphen,$*,1) OS=$(call word-hyphen,$*,2) ARCH=$(call word-hyphen,$*,3) OSVERSION=$(call word-hyphen,$*,4) image

image: .image-$(TAG)-$(OS)-$(ARCH)-$(OSVERSION)
.image-$(TAG)-$(OS)-$(ARCH)-$(OSVERSION):
docker buildx build \
--platform=$(OS)/$(ARCH) \
--build-arg OS=$(OS) \
--build-arg ARCH=$(ARCH) \
--progress=plain \
--target=$(OS)-$(OSVERSION) \
--output=type=$(OUTPUT_TYPE) \
-t=$(IMAGE):$(TAG)-$(OS)-$(ARCH)-$(OSVERSION) \
.
touch $@

.PHONY: clean
clean:
rm -rf .*image-* bin/

bin /tmp/helm /tmp/kubeval:
@mkdir -p $@
Expand Down Expand Up @@ -142,7 +217,6 @@ verify-vendor:
@ echo; echo "### $@:"
@ ./hack/verify-vendor.sh


.PHONY: generate-kustomize
generate-kustomize: bin/helm
cd charts/aws-ebs-csi-driver && ../../bin/helm template kustomize . -s templates/clusterrole-attacher.yaml > ../../deploy/kubernetes/base/clusterrole-attacher.yaml
Expand Down

0 comments on commit 153118c

Please sign in to comment.