From 75e95887258b018a9ecf929b2ab33ec1bb8a0271 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Tue, 30 May 2023 10:53:52 +0530 Subject: [PATCH 1/6] update redhat base image to ubi-micro. --- Dockerfile | 12 +----------- Makefile | 4 ++-- docker.mk | 8 +++++++- overrides.mk | 10 +--------- scripts/build_ubi_micro.sh | 7 +++++++ 5 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 scripts/build_ubi_micro.sh diff --git a/Dockerfile b/Dockerfile index 89815135..615b7a96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,17 +26,7 @@ RUN CGO_ENABLED=0 \ make build # Stage to build the driver image -FROM $BASEIMAGE@${DIGEST} AS final -# install necessary packages -# alphabetical order for easier maintenance -RUN microdnf update -y && \ - microdnf install -y \ - e4fsprogs \ - kmod \ - libaio \ - numactl \ - xfsprogs && \ - microdnf clean all +FROM $BASEIMAGE AS final ENTRYPOINT ["/csi-vxflexos.sh"] # copy in the driver COPY --from=builder /go/src/csi-vxflexos / diff --git a/Makefile b/Makefile index 6c30e7be..133fe5b4 100644 --- a/Makefile +++ b/Makefile @@ -36,11 +36,11 @@ build: dependencies # Generates the docker container (but does not push) docker: dependencies - make -f docker.mk docker + make -f docker.mk build-base-image docker # Pushes container to the repository push: docker - make -f docker.mk push + make -f docker.mk build-base-image push # Windows or Linux; requires no hardware unit-test: diff --git a/docker.mk b/docker.mk index 66d6abb3..e4671ab3 100644 --- a/docker.mk +++ b/docker.mk @@ -18,8 +18,14 @@ endif docker: @echo "Base Images is set to: $(BASEIMAGE)" @echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" - $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg GOPROXY --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) --build-arg DIGEST=$(DIGEST) . + $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg GOPROXY --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) . push: @echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" $(BUILDER) push "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" + +build-base-image: + @echo "Building base image from $(BASEIMAGE) and loading dependencies..." + ./scripts/build_ubi_micro.sh $(BASEIMAGE) + @echo "Base image build: SUCCESS" + $(eval BASEIMAGE=localhost/csipowerflex-ubimicro:latest) \ No newline at end of file diff --git a/overrides.mk b/overrides.mk index bcd7ea44..8cfc39d2 100644 --- a/overrides.mk +++ b/overrides.mk @@ -3,9 +3,7 @@ # # DEFAULT values -DEFAULT_BASEIMAGE="registry.access.redhat.com/ubi8/ubi-minimal" -# digest for 8.7-1085 -DEFAULT_DIGEST="sha256:ab03679e683010d485ef0399e056b09a38d7843ba4a36ee7dec337dd0037f7a7" +DEFAULT_BASEIMAGE="registry.access.redhat.com/ubi8/ubi-micro:8.7-8" DEFAULT_GOVERSION="1.20" DEFAULT_REGISTRY="sample_registry" DEFAULT_IMAGENAME="csi-vxflexos" @@ -17,10 +15,6 @@ ifeq ($(BASEIMAGE),) export BASEIMAGE="$(DEFAULT_BASEIMAGE)" endif -# set the IMAGEDIGEST if needed -ifeq ($(DIGEST),) -export DIGEST="$(DEFAULT_DIGEST)" -endif # set the GOVERSION if needed ifeq ($(GOVERSION),) @@ -63,8 +57,6 @@ overrides-help: @echo " Current setting is: $(GOVERSION)" @echo "BASEIMAGE - The base container image to build from, default is: $(DEFAULT_BASEIMAGE)" @echo " Current setting is: $(BASEIMAGE)" - @echo "IMAGEDIGEST - The digest of baseimage, default is: $(DEFAULT_DIGEST)" - @echo " Current setting is: $(DIGEST)" @echo "REGISTRY - The registry to push images to, default is: $(DEFAULT_REGISTRY)" @echo " Current setting is: $(REGISTRY)" @echo "IMAGENAME - The image name to be built, defaut is: $(DEFAULT_IMAGENAME)" diff --git a/scripts/build_ubi_micro.sh b/scripts/build_ubi_micro.sh new file mode 100644 index 00000000..0900417d --- /dev/null +++ b/scripts/build_ubi_micro.sh @@ -0,0 +1,7 @@ +#!/bin/bash +microcontainer=$(buildah from registry.access.redhat.com/ubi8/ubi-micro) +micromount=$(buildah mount $microcontainer) +dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ e4fsprogs xfsprogs libaio kmod numactl util-linux -y +dnf clean all --installroot $micromount +buildah umount $microcontainer +buildah commit $microcontainer csipowerflex-ubimicro \ No newline at end of file From 0db6262e98fd781678a2f87b468f80a8c2e802d0 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Tue, 30 May 2023 11:07:11 +0530 Subject: [PATCH 2/6] fixed the makefile indentation. --- Makefile | 2 +- docker.mk | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 133fe5b4..ea8dfd9e 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ docker: dependencies # Pushes container to the repository push: docker - make -f docker.mk build-base-image push + make -f docker.mk push # Windows or Linux; requires no hardware unit-test: diff --git a/docker.mk b/docker.mk index e4671ab3..f717167b 100644 --- a/docker.mk +++ b/docker.mk @@ -26,6 +26,6 @@ push: build-base-image: @echo "Building base image from $(BASEIMAGE) and loading dependencies..." - ./scripts/build_ubi_micro.sh $(BASEIMAGE) - @echo "Base image build: SUCCESS" - $(eval BASEIMAGE=localhost/csipowerflex-ubimicro:latest) \ No newline at end of file + ./scripts/build_ubi_micro.sh $(BASEIMAGE) + @echo "Base image build: SUCCESS" + $(eval BASEIMAGE=localhost/csipowerflex-ubimicro:latest) From 8fb5597203d289de224aa54752c2d1e94fb53b91 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Tue, 30 May 2023 11:10:19 +0530 Subject: [PATCH 3/6] adjusted spaces and new lines. --- Makefile | 2 +- scripts/build_ubi_micro.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ea8dfd9e..a13043db 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ docker: dependencies # Pushes container to the repository push: docker - make -f docker.mk push + make -f docker.mk push # Windows or Linux; requires no hardware unit-test: diff --git a/scripts/build_ubi_micro.sh b/scripts/build_ubi_micro.sh index 0900417d..9f3e5630 100644 --- a/scripts/build_ubi_micro.sh +++ b/scripts/build_ubi_micro.sh @@ -4,4 +4,4 @@ micromount=$(buildah mount $microcontainer) dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ e4fsprogs xfsprogs libaio kmod numactl util-linux -y dnf clean all --installroot $micromount buildah umount $microcontainer -buildah commit $microcontainer csipowerflex-ubimicro \ No newline at end of file +buildah commit $microcontainer csipowerflex-ubimicro From 6121cd2347516a7eb131f498e4714226d6246e6a Mon Sep 17 00:00:00 2001 From: Rajshree Khare <69839943+khareRajshree@users.noreply.github.com> Date: Tue, 30 May 2023 11:00:48 +0530 Subject: [PATCH 4/6] bug fix for parsing uncommented lines only (#200) * fix added to parse uncommented lines only --- dell-csi-helm-installer/install-csi-vxflexos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dell-csi-helm-installer/install-csi-vxflexos.sh b/dell-csi-helm-installer/install-csi-vxflexos.sh index 119e8210..9673420d 100644 --- a/dell-csi-helm-installer/install-csi-vxflexos.sh +++ b/dell-csi-helm-installer/install-csi-vxflexos.sh @@ -22,7 +22,7 @@ function install_mdm_secret() { log error "secret ${SECRET} in namespace ${NS} not found" else JSON=$(kubectl get secret ${SECRET} -n ${NS} -o go-template='{{ .data.config }}' | base64 --decode) - DATA=$(echo "${JSON}" | grep mdm | awk -F "\"" '{ print $(NF-1)}') + DATA=$(echo "${JSON}" | grep -v '^#*' | grep mdm | awk -F "\"" '{ print $(NF-1)}') MDM=$(echo ${DATA} | sed "s/ /\&/g") if [ "${MDM}" != "" ]; then ENC=$(echo ${MDM} | base64 | tr -d "\n") From 01fe3d39ea1c190b1b2ab8f7d97f1eb6e985eac2 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Tue, 30 May 2023 01:55:04 -0400 Subject: [PATCH 5/6] make the script executable. --- scripts/build_ubi_micro.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/build_ubi_micro.sh diff --git a/scripts/build_ubi_micro.sh b/scripts/build_ubi_micro.sh old mode 100644 new mode 100755 From 0f378fe31532dc93abf05164c74a8c960227511e Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Tue, 30 May 2023 02:16:44 -0400 Subject: [PATCH 6/6] fixed the file build_ubi_micro.sh --- scripts/build_ubi_micro.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_ubi_micro.sh b/scripts/build_ubi_micro.sh index 9f3e5630..deda061a 100755 --- a/scripts/build_ubi_micro.sh +++ b/scripts/build_ubi_micro.sh @@ -1,5 +1,5 @@ #!/bin/bash -microcontainer=$(buildah from registry.access.redhat.com/ubi8/ubi-micro) +microcontainer=$(buildah from $1) micromount=$(buildah mount $microcontainer) dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ e4fsprogs xfsprogs libaio kmod numactl util-linux -y dnf clean all --installroot $micromount