Skip to content
Merged
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
3 changes: 2 additions & 1 deletion Dockerfile.controller
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM registry.fedoraproject.org/fedora-minimal:34
FROM registry.fedoraproject.org/fedora-minimal:37
RUN microdnf install glibc -y
COPY _out/hostpath-provisioner /
CMD ["/hostpath-provisioner"]
3 changes: 2 additions & 1 deletion Dockerfile.csi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM registry.fedoraproject.org/fedora-minimal:34
FROM registry.fedoraproject.org/fedora-minimal:37
RUN microdnf install glibc -y
COPY _out/hostpath-csi-driver /
ENTRYPOINT ["/hostpath-csi-driver"]

61 changes: 44 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,85 @@ KUBEVIRT_PROVIDER?=k8s-1.22
HPP_IMAGE?=hostpath-provisioner
HPP_CSI_IMAGE?=hostpath-csi-driver
TAG?=latest
DOCKER_REPO?=kubevirt
DOCKER_REPO?=quay.io/kubevirt
ARTIFACTS_PATH?=_out
GOLANG_VER?=1.16.8
GOOS?=linux
GOARCH?=amd64
BUILDAH_PLATFORM_FLAG?=--platform $(GOOS)/$(GOARCH)
OCI_BIN ?= $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi)

export GOLANG_VER
export KUBEVIRT_PROVIDER
export DOCKER_REPO
export GOOS
export GOARCH
export OCI_BIN

all: controller hostpath-provisioner

hostpath-provisioner:
GOLANG_VER=${GOLANG_VER} ./hack/build-provisioner.sh
./hack/build-provisioner.sh

hostpath-csi-driver:
GOLANG_VER=${GOLANG_VER} ./hack/build-csi.sh
./hack/build-csi.sh

image: image-controller image-csi

push: push-controller push-csi
push: clean manifest manifest-push

push-controller: hostpath-provisioner image
docker push $(DOCKER_REPO)/$(HPP_IMAGE):$(TAG)
manifest: manifest-controller manifest-csi

manifest-push: push-csi push-controller

image-controller: hostpath-provisioner
docker build -t $(DOCKER_REPO)/$(HPP_IMAGE):$(TAG) -f Dockerfile.controller .
buildah build $(BUILDAH_PLATFORM_FLAG) -t $(DOCKER_REPO)/$(HPP_IMAGE):$(GOARCH) -f Dockerfile.controller .

image-csi: hostpath-csi-driver
docker build -t $(DOCKER_REPO)/$(HPP_CSI_IMAGE):$(TAG) -f Dockerfile.csi .
buildah build $(BUILDAH_PLATFORM_FLAG) -t $(DOCKER_REPO)/$(HPP_CSI_IMAGE):$(GOARCH) -f Dockerfile.csi .

manifest-controller: image-controller
-buildah manifest create $(DOCKER_REPO)/$(HPP_IMAGE):local
buildah manifest add --arch $(GOARCH) $(DOCKER_REPO)/$(HPP_IMAGE):local containers-storage:$(DOCKER_REPO)/$(HPP_IMAGE):$(GOARCH)

manifest-csi: image-csi
-buildah manifest create $(DOCKER_REPO)/$(HPP_CSI_IMAGE):local
buildah manifest add --arch $(GOARCH) $(DOCKER_REPO)/$(HPP_CSI_IMAGE):local containers-storage:$(DOCKER_REPO)/$(HPP_CSI_IMAGE):$(GOARCH)

push-csi: hostpath-csi-driver image-csi
docker push $(DOCKER_REPO)/$(HPP_CSI_IMAGE):$(TAG)
push-csi:
buildah manifest push $(BUILDAH_PUSH_FLAGS) --all $(DOCKER_REPO)/$(HPP_CSI_IMAGE):local docker://$(DOCKER_REPO)/$(HPP_CSI_IMAGE):$(TAG)

clean:
push-controller:
buildah manifest push $(BUILDAH_PUSH_FLAGS) --all $(DOCKER_REPO)/$(HPP_IMAGE):local docker://$(DOCKER_REPO)/$(HPP_IMAGE):$(TAG)

clean: manifest-clean
rm -rf _out

manifest-clean:
-buildah manifest rm $(DOCKER_REPO)/$(HPP_IMAGE):local
-buildah manifest rm $(DOCKER_REPO)/$(HPP_CSI_IMAGE):local

build: clean hostpath-provisioner hostpath-csi-driver

cluster-up:
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./cluster-up/up.sh
./cluster-up/up.sh

cluster-down:
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./cluster-up/down.sh
./cluster-up/down.sh

cluster-sync: cluster-clean
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./cluster-sync/sync.sh
./cluster-sync/sync.sh

cluster-clean:
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./cluster-sync/clean.sh
./cluster-sync/clean.sh

test:
GOLANG_VER=${GOLANG_VER} ./hack/run-unit-test.sh
./hack/run-unit-test.sh
hack/language.sh

test-functional:
go mod vendor
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} gotestsum --format short-verbose --junitfile ${ARTIFACTS_PATH}/junit.functest.xml -- ./tests/... -kubeconfig="../_ci-configs/$(KUBEVIRT_PROVIDER)/.kubeconfig"

test-sanity:
GOLANG_VER=${GOLANG_VER} DOCKER_REPO=${DOCKER_REPO} hack/sanity.sh
hack/sanity.sh
6 changes: 5 additions & 1 deletion cluster-sync/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ for i in $(seq 1 ${KUBEVIRT_NUM_NODES}); do
done

registry=${IMAGE_REGISTRY:-localhost:$(_port registry)}
DOCKER_REPO=${registry} make push
if [[ ${registry} == localhost* ]]; then
echo "not verifying tls, registry contains localhost"
export BUILDAH_PUSH_FLAGS="--tls-verify=false"
fi
DOCKER_REPO=${registry} make manifest manifest-push

if [ ! -z $UPGRADE_FROM ]; then
_kubectl apply -f https://github.com/kubevirt/hostpath-provisioner-operator/releases/download/$UPGRADE_FROM/namespace.yaml
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
google.golang.org/grpc v1.38.0
gotest.tools/gotestsum v1.7.0 // indirect
k8s.io/api v0.22.2
k8s.io/apiextensions-apiserver v0.22.2
k8s.io/apimachinery v0.22.2
Expand Down
Loading