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 deployed MR for python e2e tests #447

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

isinyaaa
Copy link
Contributor

@isinyaaa isinyaaa commented Oct 2, 2024

Fixes: #380

Description

Python e2e tests will use an environment variable to MR, delegating clean-up to a separate script.
The script is made environment-aware using envvars.

The CI has been updated to account for the changes, separating the Python workflows into 3 types to make it clearer.

How Has This Been Tested?

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

@tarilabs
Copy link
Member

tarilabs commented Oct 3, 2024

On brief look I like a lot the re-use of the kind startup part, the workflow-dispatch to trigger manually if desired and the industrialization of #380

thank you so far @isinyaaa @Al-Pragliola this is looking great already :)

@isinyaaa isinyaaa force-pushed the push-vktkvnoluyno branch 6 times, most recently from bd1136d to 9e8d0d4 Compare October 3, 2024 18:03
@isinyaaa isinyaaa marked this pull request as ready for review October 3, 2024 18:03
Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

as mentioned in #447 (comment) I really like this, thank you so much

Screenshot 2024-10-04 at 09 21 19

Overall

/lgtm

with some comments below:

scripts/deploy_on_kind.sh Show resolved Hide resolved
scripts/cleanup.sh Outdated Show resolved Hide resolved
scripts/cleanup.sh Show resolved Hide resolved
REGISTRY_URL = f"{REGISTRY_HOST}:{REGISTRY_PORT}"
COMPOSE_FILE = "docker-compose.yaml"
MAX_POLL_TIME = 1200 # the first build is extremely slow if using docker-compose-*local*.yaml for bootstrap of builder image
REGISTRY_URL = os.environ.get("MR_URL", "http://localhost:8080")
Copy link
Member

Choose a reason for hiding this comment

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

on a totally unrelated note, I would use analogous "injection approach" also for the other capability about #421

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer to use the serialization capabilities already available on Pydantic with the addition of Python-dotenv, would you prefer to have this change applied to this PR or later?

Copy link
Member

Choose a reason for hiding this comment

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

definitely for later.

I'm not opinionated on a library for bringing in the config values a-la Vyper or SmallRye Config, but we will need to support env variables, .env, and ConfigMaps, etc a-la 12Factor apps imho
@Al-Pragliola thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we definitely need to support them as this approach makes everything more flexible 👍🏼

isinyaaa and others added 3 commits October 4, 2024 10:26
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Co-authored-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Isabella do Amaral <idoamara@redhat.com>
Signed-off-by: Matteo Mortari <matteo.mortari@gmail.com>
Co-authored-by: Matteo Mortari <matteo.mortari@gmail.com>
Signed-off-by: Isabella do Amaral <idoamara@redhat.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Co-authored-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Isabella do Amaral <idoamara@redhat.com>
@Al-Pragliola
Copy link
Contributor

Al-Pragliola commented Oct 4, 2024

what about using lsof -i :8080 -t to get the PID of a port-forward to 8080, if found we skip creating a new one? @isinyaaa @tarilabs

overall LGTM

fi

kubectl apply -k manifests/kustomize/overlays/db
kubectl set image -n kubeflow deployment/model-registry-deployment rest-container="$IMG"
Copy link
Member

Choose a reason for hiding this comment

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

to double-check.

during release, a PR with the updated manifest kustomization image setting is applied.
So first, the manifests are deployed to kind with an image tag which will not be found (the tag does not exists yet in the container registry).

This line (36) actually set the deployment model registry image to the one locally built, hence existing and loaded in the kind cluster.

Can this be confirmed, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the image is being loaded on local mode inside the script. and on the CI it's loaded with a different command, but by the same method. So two cases here:

  1. LOCAL envvar set:
    create the cluster and load the pre-built image inside, then run line 36 eventually.
  2. No envvar set:
    assume the cluster already exists and has the image loaded. then we only set it after deploying MR (this avoids using kustomize directly which would change the manifests)

does this answer? otherwise @Al-Pragliola might be able to answer better as he suggested this change :)

Copy link
Member

Choose a reason for hiding this comment

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

thanks @isinyaaa I see, in case of GHA we do not set the LOCAL and we invoke directly the pytest via nox (instead of make):

https://github.com/kubeflow/model-registry/pull/447/files#diff-207f09dfa0bc604a684631a1c78be7d9aa00f9a6c778eec30afa287990be3da1R119-R143

that should do it.

I will wait for confirmation from @Al-Pragliola and likely will add some comments into it.

(no need to reply over weekend 😅 but I wanted to mark it down before forgetting 🙃 thanks a lot)

Copy link
Contributor

Choose a reason for hiding this comment

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

I confirm what @isinyaaa just said, the job of the deploy_on_kind script is to first fill all the requirements for deploying mr and then deploy it on the current's context cluster.

In case of CI all requirements:

  • existing Kubernetes cluster
  • mr docker image built
  • mr docker image present on the cluster's registry

are already done in the previous steps of the action, so we can just create the namespace and deploy by not setting the LOCAL env.

We decided to replace kustomize edit with kubectl edit for two reasons:

  1. remove a dependency
  2. avoid creating drifts, since kustomize actually modifies the manifests, which is a bit of a pain when running the script locally because the user has to undo local changes.

Hope this works well for everyone.

scripts/deploy_on_kind.sh Outdated Show resolved Hide resolved
Co-authored-by: Alessio Pragliola <83355398+Al-Pragliola@users.noreply.github.com>
Signed-off-by: Isabella Basso <isabellabdoamaral@gmail.com>
Copy link
Contributor

@Al-Pragliola Al-Pragliola left a comment

Choose a reason for hiding this comment

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

LGTM

@tarilabs
Copy link
Member

retested

/lgtm

image

@google-oss-prow google-oss-prow bot added the lgtm label Oct 15, 2024
@tarilabs
Copy link
Member

/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Al-Pragliola, tarilabs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 9ad39cb into kubeflow:main Oct 16, 2024
16 checks passed
@isinyaaa isinyaaa deleted the push-vktkvnoluyno branch October 16, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor pytest e2e on top of k8s manifests
3 participants