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

Use common CSM baseimage #271

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/go-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Reusable workflow to perform go version update on Golang based projects
name: Go Version Update

on:
on: # yamllint disable-line rule:truthy
workflow_dispatch:
repository_dispatch:
types: [go-update-workflow]
Expand Down
46 changes: 32 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
# Dockerfile to build Unity CSI Driver
FROM centos:7.6.1810
ARG GOIMAGE
ARG BASEIMAGE
ARG GOPROXY

# Stage to build the driver
FROM $GOIMAGE as builder
RUN mkdir -p /go/src
COPY ./ /go/src/csi-unity

# dependencies, following by cleaning the cache
RUN yum install -y e2fsprogs xfsprogs which nfs-utils device-mapper-multipath \
&& \
yum clean all \
&& \
rm -rf /var/cache/run
WORKDIR /go/src/csi-unity
RUN mkdir -p bin
RUN go generate
RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o bin/csi-unity
# Print the version
RUN go run core/semver/semver.go -f mk

# validate some cli utilities are found
RUN which mkfs.ext4
RUN which mkfs.xfs

COPY "bin/csi-unity" /
COPY "scripts/run.sh" /
# Dockerfile to build Unity CSI Driver
# Fetching the base ubi micro image with the require packges committed using buildah
FROM $BASEIMAGE as driver

COPY --from=builder /go/src/csi-unity/bin/csi-unity /
COPY scripts/run.sh /
RUN chmod 777 /run.sh
ENTRYPOINT ["/run.sh"]

# final stage
FROM driver as final

ENTRYPOINT ["/run.sh"]
LABEL vendor="Dell Technologies" \
maintainer="Dell Technologies" \
name="csi-unity" \
summary="CSI Driver for Dell Unity XT" \
description="CSI Driver for provisioning persistent storage from Dell Unity XT" \
release="1.13.0" \
version="2.13.0" \
license="Apache-2.0"
COPY licenses /licenses
35 changes: 0 additions & 35 deletions Dockerfile.podman

This file was deleted.

21 changes: 10 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ifneq (on,$(GO111MODULE))
export GO111MODULE := on
endif

IMAGE_NAME=csi-unity
IMAGE_REGISTRY=dellemc
IMAGE_TAG=$(shell date +%Y%m%d%H%M%S)

.PHONY: go-vendor
go-vendor:
go mod vendor
Expand Down Expand Up @@ -40,25 +44,20 @@ download-csm-common:
# Generates the docker container (but does not push)
podman-build: download-csm-common go-build
$(eval include csm-common.mk)
sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE)

podman-push: download-csm-common go-build
$(eval include csm-common.mk)
sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --push
podman build --pull -t $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOPROXY=$(GOPROXY) . --format=docker

podman-build-no-cache: download-csm-common go-build
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the go-build still needed since the build is being done in the Docker image build?

$(eval include csm-common.mk)
sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --no-cache
podman build --pull --no-cache -t $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOPROXY=$(GOPROXY) . --format=docker

podman-no-cachepush: download-csm-common go-build
$(eval include csm-common.mk)
sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --push --no-cache
podman-push:
podman push $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)

#
# Docker-related tasks
#
# Generates the docker container (but does not push)
docker-build: go-build
docker-build: download-csm-common go-build
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the go-build still needed since the build is being done in the Docker image build?

cd core && go generate
go run core/semver/semver.go -f mk >semver.mk
make -f docker.mk docker-build
Expand All @@ -69,7 +68,7 @@ docker-push:
version:
go generate
go run core/semver/semver.go -f mk >semver.mk
sh build.sh -h
make -f docker.mk version

.PHONY: clean
clean:
Expand Down
99 changes: 0 additions & 99 deletions build.sh

This file was deleted.

7 changes: 0 additions & 7 deletions build_ubi_micro.sh

This file was deleted.

4 changes: 2 additions & 2 deletions docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DOCKER_IMAGE_TAG ?= ${VERSION}

.PHONY: docker-build
docker-build:
$(eval include csm-common.mk)
echo ${VERSION} ${GITLAB_CI} ${CI_COMMIT_TAG} ${CI_COMMIT_SHA}
rm -f core/core_generated.go
cd core && go generate
go run core/semver/semver.go -f mk >semver.mk
mkdir -p ${BIN_DIR}
GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o ${BIN_DIR}/${BIN_NAME}
docker build -t ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} .
docker tag ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKER_REPO}/${DOCKER_NAMESPACE}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
docker build --pull -t ${DOCKER_REPO}/${DOCKER_NAMESPACE}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} --build-arg GOPROXY=$(GOPROXY) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .

.PHONY: docker-push
docker-push: docker-build
Expand Down
20 changes: 10 additions & 10 deletions samples/secret/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
storageArrayList:
# Array ID of Unity XT
# Default value: None
# Examples: "ABC00000000001"
# Array ID of Unity XT
# Default value: None
# Examples: "ABC00000000001"
- arrayId: "ABC00000000001"
# username for connecting to Unity XT Unisphere REST API server
# Default value: None
Expand All @@ -24,10 +24,10 @@ storageArrayList:
# Examples: false, true
isDefault: true

# # To add more Unity XT arrays, uncomment the following lines and provide the required values
# - arrayId: "ABC00000000002"
# username: "user"
# password: "password"
# endpoint: "https://1.2.3.5/"
# skipCertificateValidation: true
# isDefault: false
# To add more Unity XT arrays, uncomment the following lines and provide the required values
# - arrayId: "ABC00000000002"
# username: "user"
# password: "password"
# endpoint: "https://1.2.3.5/"
# skipCertificateValidation: true
# isDefault: false
12 changes: 6 additions & 6 deletions samples/storageclass/unity-fc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ provisioner: csi-unity.dellemc.com
reclaimPolicy: Delete
# allowVolumeExpansion - Attribute to allow volume expansion
# Allowed values:
# "true" - Volume can be resized
# "false" - Volume cannot be resized
# "true" - Volume can be resized
# "false" - Volume cannot be resized
# Optional: true
# Default value: "true"
allowVolumeExpansion: true
Expand Down Expand Up @@ -56,27 +56,27 @@ parameters:
# Optional: false
# Examples: "APM000000001", "APM000000002"
arrayId: <ARRAY_ID>
#storagePool - Defines storage pool. The value should be picked from the column labeled "CLI ID" of Pools in the Unisphere GUI.
# storagePool - Defines storage pool. The value should be picked from the column labeled "CLI ID" of Pools in the Unisphere GUI.
# Allowed values: String
# Default value: None
# Optional: false
# Examples: pool_0
storagePool: <STORAGE_POOL>
#thinProvisioned- Defines Boolean to choose value of thinProvisioned while creating a new volume
# thinProvisioned- Defines Boolean to choose value of thinProvisioned while creating a new volume
# Allowed values:
# "true" - for thin provision
# "false" - for thick provision
# Optional: true
# Default value: false
thinProvisioned: "true"
#isDataReductionEnabled - Defines Boolean to choose value of is DataReductionEnabled while creating a new volume
# isDataReductionEnabled - Defines Boolean to choose value of is DataReductionEnabled while creating a new volume
# Allowed values:
# "true" - Enables data reduction for all-flash storage pool.
# "false" - Disables data reduction.
# Optional: true
# Default value: false
isDataReductionEnabled: "true"
#TieringPolicy - Tiering policy to be used during provisioning
# TieringPolicy - Tiering policy to be used during provisioning
# Requires FAST VP license.
# Allowed values: String
# Optional: true
Expand Down
12 changes: 6 additions & 6 deletions samples/storageclass/unity-iscsi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ provisioner: csi-unity.dellemc.com
reclaimPolicy: Delete
# allowVolumeExpansion - Attribute to allow volume expansion
# Allowed values:
# "true" - Volume can be resized
# "false" - Volume cannot be resized
# "true" - Volume can be resized
# "false" - Volume cannot be resized
# Default value: "true"
# Optional: true
allowVolumeExpansion: true
Expand Down Expand Up @@ -56,27 +56,27 @@ parameters:
# Optional: false
# Examples: "APM000000001", "APM000000002"
arrayId: <ARRAY_ID>
#storagePool - Defines storage pool. The value should be picked from the column labeled "CLI ID" of Pools in the Unisphere GUI.
# storagePool - Defines storage pool. The value should be picked from the column labeled "CLI ID" of Pools in the Unisphere GUI.
# Allowed values: String
# Default value: None
# Optional: false
# Examples: pool_0
storagePool: <STORAGE_POOL>
#thinProvisioned- Defines Boolean to choose value of thinProvisioned while creating a new volume
# thinProvisioned- Defines Boolean to choose value of thinProvisioned while creating a new volume
# Allowed values:
# "true" - for thin provision
# "false" - for thick provision
# Default value: false
# Optional: true
thinProvisioned: "true"
#isDataReductionEnabled - Defines Boolean to choose value of is DataReductionEnabled while creating a new volume
# isDataReductionEnabled - Defines Boolean to choose value of is DataReductionEnabled while creating a new volume
# Allowed values:
# "true" - Enables data reduction for all-flash storage pool.
# "false" - Disables data reduction.
# Optional: true
# Default value: false
isDataReductionEnabled: "true"
#TieringPolicy - Tiering policy to be used during provisioning
# TieringPolicy - Tiering policy to be used during provisioning
# Requires FAST VP license.
# Allowed values: String
# Optional: true
Expand Down
Loading