# LFX Mentorship 2024_01 test task First, we'd like to thank everyone who is interested in taking part to the LFX Mentorship program with us, and we are excited to welcome new contributors to Project Antrea. We have 3 projects for this iteration of the LFX Mentorship program: - East-west connectivity monitoring tool for Pod network - https://mentorship.lfx.linuxfoundation.org/project/12b695a0-e05c-46b9-a42d-c7e4709f0129 - Issue [#5514](https://github.com/antrea-io/antrea/issues/5514) - Ability to install / upgrade Antrea using the CLI - https://mentorship.lfx.linuxfoundation.org/project/ae950bcf-d16b-4d26-aed0-702c1eedb507 - Issue [#5896](https://github.com/antrea-io/antrea/issues/5896) - Replace deprecated bincover with golang built-in coverage profiling tool - https://mentorship.lfx.linuxfoundation.org/project/8f08ebb1-05a8-41fb-8c4c-85626f63c195 - Issue [#4962](https://github.com/antrea-io/antrea/issues/4962) In order to help us find the right candidates, we have prepared some simple tasks. It's a good opportunity for you to get familiar with Antrea, and for us to ensure that you have some of the required skills for a successful mentorship. Remember to apply at https://lfx.linuxfoundation.org/tools/mentorship/ in addition to completing the appropriate tasks. ## Tasks details ### For all proposals (`#5514`, `#5896`, `#4962`) **This task needs be performed no matter which one(s) of the project proposals you are applying to.** Steps: 1. Create a Kind cluster locally with 1 control-plane Node and 1 worker Node. You will need to *disable the default CNI*, as we will later deploy Antrea for networking. Refer to the [Kind documentation](https://kind.sigs.k8s.io/docs/user/configuration/) for information. 2. Fork the Antrea Github repository (https://github.com/antrea-io/antrea) to your personal Github account, and clone the fork to your local machine. This is a standard Github workflow, but you can refer to our [CONTRIBUTING.md](https://github.com/antrea-io/antrea/blob/main/CONTRIBUTING.md) for assistance. More generally, this document may be helpful for later steps as well. 3. Modify the Antrea source code as follows: - Add a test log entry to the antrea-agent program *and* the antrea-controller programs. The source code for these programs can be found here: https://github.com/antrea-io/antrea/tree/main/cmd. Hint: look for the `run(o *Options)` function. - Each of the 2 log entries should be a call to `klog.InfoS` (look at the rest of the source code for examples). - In both cases, the call should happen early in the execution of the program. Ideally it should be one of the first entries to be logged after the program starts. - `klog.InfoS` is a "structured logging" primitive and lets you include key-value pairs with your log message. Your log message should include the following data: 1) your Github ID, and 2) the name of the K8s Pod executing the program (antrea-agent and antrea-controller are meant to be run as Pods). Hint: You will need the `env.GetPodName()` function from the `antrea.io/antrea/pkg/util/env` package. 4. Build Antrea locally with `make`. Again you may find it useful to refer to [CONTRIBUTING.md](https://github.com/antrea-io/antrea/blob/main/CONTRIBUTING.md). 5. Deploy your Antrea build to the Kind cluster that you created in the first step. The instructions to do this can be found in https://github.com/antrea-io/antrea/blob/main/docs/kind.md#deploy-a-local-build-of-antrea-to-your-kind-cluster-for-developers. 6. Using `kubectl`, dump the logs for each antrea Pod (1 controller Pod and 2 agent Pods) and copy the first 10 lines of each log to a local file at the root of the repository: (`controller.txt`, `agent1.txt`, `agent2.txt`). Among the log lines should be the one you added in step 3. 7. Using kubectl, exec into the `antrea-ovs` container of the antrea-agent Pod (any one of them) and find out the version of OVS which is installed, using the appropriate OVS command. Write it to to a local file (`ovs-version.txt`) at the root of the repository. To get the OVS version, you will need to use the `ovs-vsctl` command-line utility (find the documentation online). 8. Download antctl from the Github release assets for the latest Antrea release. Run the `antctl version` command and write the output to `antrea-version.txt`, at the root of the repository. 9. Commit all your changes (changes to the Antrea source code + all five `*.txt` files that were created in earlier steps) as a single commit. *We ask that you*: - sign your commit: see https://github.com/antrea-io/antrea/blob/main/CONTRIBUTING.md#sign-off-your-work - follow best practices when writing your commit message: see https://cbea.ms/git-commit/ 10. Push the changes to your fork, using branch name `antrea-lfx-mentorship-2024_01`. If you are only applying for *East-west connectivity monitoring tool for Pod network* - [#5514](https://github.com/antrea-io/antrea/issues/5514), then this is the only task you will need to perform. If you are applying for one of the other 2 projects, you will need to work on an additonal task. ### For proposal `#4962` **Only perform this task if you are applying for *Replace deprecated bincover with golang built-in coverage profiling tool* - [#4962](https://github.com/antrea-io/antrea/issues/4962)** Steps: 1. Just like for the "common task", you will need a Kind cluster running Antrea as the CNI. We recommend that you delete your existing Kind cluster, and create a new one with the same configuration. This time, you do not need to build Antrea locally and you should install Antrea using Helm: https://github.com/antrea-io/antrea/blob/main/docs/helm.md 2. Once again, you will need to use the local clone of your personal Antrea Github fork (see instructions for "common task"). This time, we will work with a new branch name for our changes: `antrea-lfx-mentorship-2024_01-4962`. Create this new branch, and make sure that it doesn't include changes from other tasks. 3. Read about Golang coverage profiling support for integration tests: https://go.dev/doc/build-cover 4. Build a custom antctl (antrea CLI) binary with the following command, from the root of the repository: `CGO_ENABLED=0 go build -cover -o bin/my-antctl antrea.io/antrea/cmd/antctl` 5. Run the coverage-instrumented binary with `./bin/my-antctl get controllerinfo` and collect the coverage data in a directory of your choice. 6. Write the output of the previous command to file `controllerinfo.txt` at the root of the repository. 7. Using `go tool covdata` and the coverage data collected in step 5, find the "percent statements covered" for package `antrea.io/antrea/pkg/antctl`. This percentage corresponds to the fraction of statements in the package which were execute when we ran the `get controllerinfo` command with the CLI. Write the percentage value (in format `X.Y%`) to file `coverage.txt` at the root of the repository. 8. Finally, just like for the "common task", commit your changes (the 2 `*.txt` files) and push them to your fork using branch name `antrea-lfx-mentorship-2024_01-4962`. Guidelines for the commit message are the same as for the "common task". ### For proposal `#5514` **Only perform this task if you are applying for *East-west connectivity monitoring tool for Pod network* - [#5514](https://github.com/antrea-io/antrea/issues/5514)** Steps: 1. Just like for the "common task", you will need a Kind cluster running Antrea as the CNI. We recommend that you delete your existing Kind cluster, and create a new one with the same configuration. This time, you do not need to build Antrea locally and you should install Antrea using Helm: https://github.com/antrea-io/antrea/blob/main/docs/helm.md 2. Fork the Antrea UI Github repository (https://github.com/antrea-io/antrea-ui) to your personal Github account, and clone the fork to your local machine. This is a standard Github workflow, but you can refer to our [CONTRIBUTING.md](https://github.com/antrea-io/antrea-ui/blob/main/CONTRIBUTING.md) for assistance. More generally, this document may be helpful for later steps as well. 3. Follow these steps to run the Antrea UI (backend + frontend) locally: https://github.com/antrea-io/antrea-ui/blob/main/CONTRIBUTING.md#running-the-ui-locally 4. When everything is up-and-running, access the UI at http://localhost:3000/. The admin password is `admin`. 5. Now, modify the `client/web/antrea-ui/src/routes/summary.tsx` file to add a third "card" container to the Summary page in the UI. The card should include your Github ID. **See https://github.com/antrea-io/antrea-ui/assets/2495809/b4f459c8-dda9-4b55-8420-3e0f2fb83080 for an example**. Hint: take a look at the `ComponentSummary` React component, and add a new `CdsCard` element to the `Summary` component. The change represents ~10 lines of TSX code. 6. When you save the modified file, the UI will automatically refresh in your browser. Once you are satisfied with your changes, take a screenshot of the Summary page and save it as a PNG, JPEG or PDF file to the root of the repository (e.g., as `screenshot.png`). 7. Finally, just like for the "common task", commit your changes (changes to the frontend souce code + screenshot file) and push them to your fork using branch name `antrea-lfx-mentorship-2024_01-5514`. Guidelines for the commit message are the same as for the "common task". ## Submissions Upon completing the task(s), send an email to cncf-antrea-maintainers@lists.cncf.io with the following information: ``` Name: [Your name, as it appears in your LFX mentorship profile] Applied Issue: [Indicate the issue number(s) you are applying for] Antrea GitHub Repo: [Provide a link to your GitHub repository containing the completed task(s)] Antrea UI Github Repo: [Provide a link to your GitHub repository containing the completed task for #5514 IF APPLICABLE] ``` Make sure that your Github repositories use the correct branch names, as described above for each one of the tasks. For any queries, please reply reply to this discussion below or post in the `#antrea` channel in the K8s Slack workspace. Do not send emails or DMs to ask for assistance, use public channels only. We are happy to provide some assistance if you get stuck or if some instructions are not clear enough. ## Deadlines **Tasks Deadline: Submissions must be completed by February 20, 5:00 PM PDT.** **LFX Application Deadline: LFX applicants must submit by February 13, 5:00 PM PDT.**