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

Install calico for tests #2820

Conversation

hansinikarunarathne
Copy link
Member

Pull Request Template for Kubeflow manifests Issues

✏️ A brief description of the changes

  • Disabled the default CNI
  • Added calico installation script
  • Added calico installation step for all the tests

Note: Now we can create network policies and manage them with the help of calico. (Examples: https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/04-deny-traffic-from-other-namespaces.md)

🐛 If this PR is related to an issue, please put the link to the issue here.

#2718

✅ Contributor checklist


You can join the CNCF Slack and access our meetings at the Kubeflow Community website. Our channel on the CNCF Slack is here #kubeflow-platform.

@juliusvonkohout
Copy link
Member

@AndersBennedsgaard can you review this PR?

@juliusvonkohout juliusvonkohout self-assigned this Jul 30, 2024
@juliusvonkohout juliusvonkohout linked an issue Jul 30, 2024 that may be closed by this pull request
7 tasks
Comment on lines 29 to 30
chmod +x ./tests/gh-actions/install_calico.sh
./tests/gh-actions/install_calico.sh
Copy link
Contributor

@AndersBennedsgaard AndersBennedsgaard Aug 5, 2024

Choose a reason for hiding this comment

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

No reason to change the file modes and leaving the git work tree in a "dirty" state. You could just run chmod +x ./tests/gh-actions/install_calico.sh, commit that to the repository (like what is done with the other scripts in tests/gh-actions/), and use

run: ./tests/gh-actions/install_calico.sh

As an alternative, you can skip the chmod +x entirely, and just run the Bash script using bash:

run: |
  bash ./tests/gh-actions/install_calico.sh

I personally prefer this, since I am not a fan of committing executables in git repositories, but I guess that the former is the preferred way in Kubeflow 🤷‍♂️

kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/custom-resources.yaml

kubectl wait --for=condition=Ready pods --all --namespace=tigera-operator --timeout 300s
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not ensure that Calico is in a running state. This only ensures that the Tigera operator is.
Also: you should generally speaking not wait for Pods to be ready, but instead wait for the controlling Deployment, DaemonSet, StatefulSet, etc. to report that it is ready.

I got the following to work on my machine:

Suggested change
kubectl wait --for=condition=Ready pods --all --namespace=tigera-operator --timeout 300s
kubectl rollout status deployment -n tigera-operator tigera-operator --timeout 60s
# TODO: use 'kubectl wait --for=create namespace/calico-system' when https://github.com/kubernetes/kubernetes/pull/125868 is released
echo 'Waiting for namespace "calico-system" to be created'
start=$(date +%s)
while [ -z "$(kubectl get ns calico-system 2>/dev/null)" ]; do
sleep 1
now=$(date +%s)
[ $((now - start)) -le 60 ] || { echo "timeout waiting for calico-system namespace" && exit 1; }
done
kubectl rollout status deployment -n calico-system calico-typha --timeout 60s
kubectl rollout status deployment -n calico-system calico-kube-controllers --timeout 60s
kubectl rollout status daemonset -n calico-system calico-node --timeout 60s
kubectl rollout status daemonset -n calico-system csi-node-driver --timeout 60s

@hansinikarunarathne
Copy link
Member Author

#2718 (comment) . Based on this comment, we can close this PR. Let me know if you have any concerns. @juliusvonkohout

@hansinikarunarathne hansinikarunarathne force-pushed the feature-installing-calico-in-tests branch from 1c6eec9 to 569b304 Compare August 15, 2024 06:57
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from juliusvonkohout. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@hansinikarunarathne
Copy link
Member Author

@juliusvonkohout , When I commit to this, each time different tests fail. Do you know any reason for this?

hansinikarunarathne and others added 12 commits August 16, 2024 10:18
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
Signed-off-by: hansinikarunarathne <[email protected]>
@hansinikarunarathne hansinikarunarathne force-pushed the feature-installing-calico-in-tests branch from 489e44f to 0144c08 Compare August 16, 2024 04:49
@hansinikarunarathne
Copy link
Member Author

I add the calico plugging to enable networkpolicies . Let me know any concerns you guys have?

@hansinikarunarathne
Copy link
Member Author

We can close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the networkpolicies to cicd tests
3 participants