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

Check deployed images against newly-built images #1265

Closed
wants to merge 3 commits into from
Closed
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
19 changes: 19 additions & 0 deletions scripts/shared/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ fi

run_if_defined post_deploy

# Check that the deployed images match those we built (if any)
image_mismatch=false
for image in package/.image.*; do
expected="$(docker image inspect "$(cat "$image")" | jq -r '.[0].RepoDigests[0]')"
image="${image#package/.image.}"
for deployed in $(kubectl get pods -A -o json | jq -r '.items[].status.containerStatuses[].imageID' | grep "$image"); do
if [ "$deployed" != "$expected" ]; then
printf "Image %s is deployed with %s, expected %s\n" "$image" "$deployed" "$expected"
image_mismatch=true
else
printf "Successfully checked image %s, deployed with %s\n" "$image" "$deployed"
fi
done
done
if [ "$image_mismatch" = true ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be run when opted-in, since you might want to deploy with various images when deploying locally or when we're doing upgrade testing

kubectl get pods -A -o json
Copy link
Member Author

Choose a reason for hiding this comment

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

This is too verbose and will be simplified before the patch is submitted for final review.

Copy link
Member

Choose a reason for hiding this comment

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

Does this still need tweaking?

Copy link
Member

Choose a reason for hiding this comment

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

exit 1
fi

# Print installed versions for manual validation of CI
subctl show versions
print_clusters_message
9 changes: 6 additions & 3 deletions scripts/shared/lib/deploy_operator
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ component_by_image['submariner-operator']=submariner-operator
component_by_image['submariner-route-agent']=submariner-routeagent
component_by_image['lighthouse-agent']=submariner-lighthouse-agent
component_by_image['lighthouse-coredns']=submariner-lighthouse-coredns
component_by_image['nettest']='submariner-nettest submariner-metrics-proxy'

### Functions ###

Expand Down Expand Up @@ -66,9 +67,11 @@ function subctl_install_subm() {
[[ "$AIR_GAPPED" = true ]] && extra_flags+=(--repository "${SUBM_IMAGE_REPO}" --version "${SUBM_IMAGE_TAG}")

for image in ${PRELOAD_IMAGES}; do
local image_key="${component_by_image[$image]}"
[[ -n "${image_key}" ]] || continue
extra_flags+=(--image-override "${image_key}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
local image_keys="${component_by_image[$image]}"
[[ -n "${image_keys}" ]] || continue
for image_key in $image_keys; do
extra_flags+=(--image-override "${image_key}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
done
done
fi

Expand Down