Skip to content

Commit

Permalink
Make operator custom image functional test work with crio providers
Browse files Browse the repository at this point in the history
crio tooling in our prioviders doesn't support 'docker tag' so
we have to push the same image to our local registry with the
alternate tag

Signed-off-by: David Vossel <[email protected]>
  • Loading branch information
davidvossel committed Mar 8, 2019
1 parent f268858 commit 584568c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bazel-build:
//cmd/..."

bazel-push-images:
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} ./hack/bazel-push-images.sh"
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} ./hack/bazel-push-images.sh"

bazel-tests:
hack/dockerized "bazel test --test_output=errors -- //pkg/... "
Expand Down
9 changes: 3 additions & 6 deletions cluster/ephemeral-provider-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function prepare_config() {
cat >hack/config-provider-$KUBEVIRT_PROVIDER.sh <<EOF
master_ip=$(_main_ip)
docker_tag=devel
docker_tag_alt=devel-alt
docker_tag_alt=devel_alt
kubeconfig=${BASE_PATH}/cluster/$KUBEVIRT_PROVIDER/.kubeconfig
kubectl=${BASE_PATH}/cluster/$KUBEVIRT_PROVIDER/.kubectl
docker_prefix=localhost:$(_port registry)/kubevirt
Expand All @@ -44,22 +44,19 @@ function _add_common_params() {
function build() {
# Build everyting and publish it
${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/build-manifests.sh"
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/bazel-push-images.sh"
${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/bazel-push-images.sh"

# Make sure that all nodes use the newest images
container=""
container_alias=""
for arg in ${docker_images}; do
local name=$(basename $arg)
container="${container} ${manifest_docker_prefix}/${name}:${docker_tag}"
container="${container} ${manifest_docker_prefix}/${name}:${docker_tag} ${manifest_docker_prefix}/${name}:${docker_tag_alt}"
container_alias="${container_alias} ${manifest_docker_prefix}/${name}:${docker_tag} kubevirt/${name}:${docker_tag}"
# the alt tag is another image tag alias we can use while testing the virt operator
container_alt_alias="${container_alt_alias} ${manifest_docker_prefix}/${name}:${docker_tag} ${manifest_docker_prefix}/${name}:${docker_tag_alt}"
done
for i in $(seq 1 ${KUBEVIRT_NUM_NODES}); do
${_cli_with_tty} ssh --prefix $provider_prefix "node$(printf "%02d" ${i})" "echo \"${container}\" | xargs \-\-max-args=1 sudo docker pull"
${_cli_with_tty} ssh --prefix $provider_prefix "node$(printf "%02d" ${i})" "echo \"${container_alias}\" | xargs \-\-max-args=2 sudo docker tag"
${_cli_with_tty} ssh --prefix $provider_prefix "node$(printf "%02d" ${i})" "echo \"${container_alt_alias}\" | xargs \-\-max-args=2 sudo docker tag"
done
}

Expand Down
9 changes: 9 additions & 0 deletions hack/bazel-push-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ bazel run \
--define container_prefix=${docker_prefix} \
--define container_tag=${docker_tag} \
//:push-images

if [ -n "$docker_tag_alt" ]; then
bazel run \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
--workspace_status_command=./hack/print-workspace-status.sh \
--define container_prefix=${docker_prefix} \
--define container_tag=${docker_tag_alt} \
//:push-images
fi
1 change: 1 addition & 0 deletions hack/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ binaries="cmd/virt-operator cmd/virt-controller cmd/virt-launcher cmd/virt-handl
docker_images="cmd/virt-operator cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/disks-images-provider images/vm-killer cmd/subresource-access-test images/winrmcli cmd/example-hook-sidecar cmd/example-cloudinit-hook-sidecar images/cdi-http-import-server cmd/container-disk-v1alpha"
docker_prefix=${DOCKER_PREFIX:-kubevirt}
docker_tag=${DOCKER_TAG:-latest}
docker_tag_alt=${DOCKER_TAG_ALT}
master_ip=192.168.200.2
network_provider=flannel
namespace=kubevirt
Expand Down
2 changes: 1 addition & 1 deletion pkg/virt-operator/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (c *KubeVirtController) generateInstallStrategyJob(kv *v1.KubeVirt) *batchv

ObjectMeta: metav1.ObjectMeta{
Namespace: kv.Namespace,
Name: fmt.Sprintf("virt-install-strategy-job-%s", imageTag),
Name: fmt.Sprintf("%s-job", kv.Name),
Labels: map[string]string{
v1.AppLabel: "",
v1.ManagedByLabel: v1.ManagedByLabelOperatorValue,
Expand Down

0 comments on commit 584568c

Please sign in to comment.