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

feat: deploy and functest make tasks #196

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

nestoracunablanco
Copy link
Contributor

This tasks are helpful when working wieh an external Kubernetes cluster.

The 'deploy' task installs the bundels and their dependencies, whilw the 'functest' task runs the function tests against the cluster.

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
No issue writen

Special notes for your reviewer:
The file deploy-kubevirt-and-cdi is very similar to the one in the ssp-operator repository. The plan is to update it in the other repository if the one there gets merged.

Release note:


@kubevirt-bot kubevirt-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jul 3, 2024
@kubevirt-bot kubevirt-bot added the dco-signoff: no Indicates the PR's author has not DCO signed all their commits. label Jul 3, 2024
@kubevirt-bot
Copy link
Contributor

Hi @nestoracunablanco. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels Jul 3, 2024
Comment on lines 20 to 27
kubectl patch -n ${KUBEVIRT_NAMESPACE} kubevirt kubevirt --type='json' -p '[{
"op": "add",
"path": "/spec/configuration/developerConfiguration/featureGates/-",
"value": "DataVolumes",
},{
"op": "add",
"path": "/spec/configuration/developerConfiguration/featureGates/-",
"value": "CPUManager",
},{
"op": "add",
"path": "/spec/configuration/developerConfiguration/featureGates/-",
"value": "KubevirtSeccompProfile",
},{
"op": "add",
"path": "/spec/configuration/developerConfiguration/featureGates/-",
"value": "NUMA",
},{
"op": "replace",
"path": "/spec/configuration/seccompConfiguration",
"value": {
"virtualMachineInstanceProfile": {
"customProfile": {
"localhostProfile": "kubevirt/kubevirt.json"
}
}
},
}]'
Copy link
Member

Choose a reason for hiding this comment

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

None of them should be needed anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To ensure that the function tests run successfully, both NUMA and GPU are required. However, I have removed the others.

#!/bin/bash
set -e

KUBEVIRT_NIGHTLY=$(curl -L https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/latest)
Copy link
Member

Choose a reason for hiding this comment

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

Can you change it to KUBEVIRT_VERSION and make it use the latest stable version by default? This will help pinning KUBEVIRT_VERSION to a specific value in release branches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 5 to 12
KUBEVIRT_NAMESPACE=${1:-kubevirt}

kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: ${KUBEVIRT_NAMESPACE}
EOF
Copy link
Member

Choose a reason for hiding this comment

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

Not sure this is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted

Comment on lines 55 to 60
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: ${CDI_NAMESPACE}
EOF
Copy link
Member

Choose a reason for hiding this comment

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

Same, I don't think this is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted

@lyarwood
Copy link
Member

/ok-to-test

Makefile Outdated

.PHONY: functest
functest:
cd tests && kubectl config view --flatten > /tmp/kubeconfig && KUBECONFIG=/tmp/kubeconfig go test -v -timeout 0 ./functests/... -ginkgo.v -ginkgo.randomize-all $(FUNCTEST_EXTRA_ARGS)
Copy link
Member

Choose a reason for hiding this comment

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

What does writing to /tmp/kubeconfig first help with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @0xFelix, thank you for your comment.
If I understood the code correctly, in order for the function tests to work effectively, the variable KUBECONFIG must point to a kubectl config file. Given this information, I have thought of a solution: dumping the config to a temporary file and then loading it as an environment variable for the tests.
I am open to any ideas, comments, suggestions, etc. How would you approach solving this?

Copy link
Member

Choose a reason for hiding this comment

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

If you don't specify KUBECONFIG it should pick up the default ~/.kube/config that in this case is also used by kubectl. Did it not work without KUBECONFIG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example, in my case, when using minikube, it does not write the configuration to ~/.kube/config. Therefore, I came up with the idea of dumping the config to an extra file and changing KUBECONFIG only within the context of the function tests.

Copy link
Member

Choose a reason for hiding this comment

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

Where is kubectl config view --flatten looking at in this case? IIUC without KUBECONFIG it will look at ~/.kube/config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved in a more elegant way. @0xFelix you can take a look.



# Deploying kubevirt
KUBEVIRT_VERSION=$(latest_version "kubevirt")
Copy link
Member

Choose a reason for hiding this comment

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

Can you just use https://storage.googleapis.com/kubevirt-prow/devel/release/kubevirt/kubevirt/stable.txt as we do elsewhere?

KUBEVIRT_VERSION=$(curl -L https://storage.googleapis.com/kubevirt-prow/devel/release/kubevirt/kubevirt/stable.txt)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.



# Deploying CDI
CDI_VERSION=$(latest_version "containerized-data-importer")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have a version of stable.txt available for CDI so this is fine.

@nestoracunablanco nestoracunablanco force-pushed the feat/deploy branch 2 times, most recently from ed4831b to 6634e73 Compare July 12, 2024 13:49
Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2024
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2024
@nestoracunablanco
Copy link
Contributor Author

Hey @0xFelix, I've made some updates to the code as the tests were failing. Could you please take another look?

Makefile Outdated
@@ -41,6 +44,14 @@ lint: generate
generate: kustomize yq
scripts/generate.sh

.PHONY: deploy
deploy: generate lint
Copy link
Member

Choose a reason for hiding this comment

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

nit: generate is a dependency of lint, so it's redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

This tasks are helpful when working wieh an external Kubernetes
cluster.

The 'deploy' task installs the bundles and their dependencies,
while the 'functest' task runs the function tests against the
cluster.

Signed-off-by: Nestor Acuna-Blanco <nestor.acuna@ibm.com>
@nestoracunablanco
Copy link
Contributor Author

/retest

@kubevirt-bot
Copy link
Contributor

@nestoracunablanco: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@0xFelix 0xFelix closed this Jul 16, 2024
@0xFelix 0xFelix reopened this Jul 16, 2024
@0xFelix
Copy link
Member

0xFelix commented Jul 16, 2024

/test all

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

Thanks!

/lgtm

@lyarwood Can you PTAL?

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2024
@lyarwood
Copy link
Member

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lyarwood

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2024
@kubevirt-bot kubevirt-bot merged commit 2bcf46f into kubevirt:main Jul 19, 2024
4 checks passed
@nestoracunablanco nestoracunablanco deleted the feat/deploy branch July 19, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants