Skip to content

Commit

Permalink
sync master branch with upstream (#5)
Browse files Browse the repository at this point in the history
* bump golang to 1.20

Signed-off-by: yulng <[email protected]>

* bump gopkg.in/yaml.v2

Upgrade gopkg.in/yaml.v2 prior to v2.2.4. Currently this outdated version is indirectly references as follows:

github.com/stretchr/testify requires gopkg.in/yaml.v2 v2.2.2

github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 requires gitub.com/stretchr/testify v1.5.1, and is required by a number of packages.

To upgrade from yaml <v2.2.4, ginkgo must be migrated to v2.

Additionally, bump the versions of the following to remove indirect dependencies on outdated version of ginkgo, gomega, and slim-sprig:

github.com/onsi/gomega
github.com/containernetworking/cni
github.com/containernetworking/plugins

Signed-off-by: Salvatore Daniele <[email protected]>

* fix golangci-lint issues

Signed-off-by: Sebastian Sch <[email protected]>

* bump golangci-lint

Signed-off-by: Sebastian Sch <[email protected]>

* Add codeql workflow

add codeql workflow similarly to other
projects in k8snetworkplumbingwg org

Signed-off-by: adrianc <[email protected]>

* Bump golangci-lint in Makefile as well

make didn't work without it.

Signed-off-by: Jiri Prokes <[email protected]>

* Remove unused GODOC from Makefile

Signed-off-by: adrianc <[email protected]>

* update multus configuration reference link in README

Signed-off-by: frbimo <[email protected]>

* Enable race detection in unit tests

This change updates "Go test" step in buildtest.yml to include the '-race' flag, enabling race detection in the CI during testing.
 
Signed-off-by: Alina Sudakov <[email protected]>

* use make lint in the github actions

Signed-off-by: Sebastian Sch <[email protected]>

* Add support to revert VF trust

Signed-off-by: Sebastian Sch <[email protected]>

* Add both hardware and nic mac allocation retry

This commit add a retry function for all the mac address allocation
functions.
this is needed because some of the drivers have async mac allocation
or get a device or resouce busy errors until the vf device is fully
configured on the system so instead of failing the CNI we just wait
100 miliseconds

Signed-off-by: Sebastian Sch <[email protected]>

* Workflow Maintenance

- Fix issue in pushing images to master/release
  with multi-arch build
- Bump action versions

Signed-off-by: adrianc <[email protected]>

* fix typo in push workflows

Signed-off-by: adrianc <[email protected]>

* Add support for allmulticast flag

This allows users to set the allmulticast mode for a VF.

Signed-off-by: Marcelo Guerrero <[email protected]>

* Delete ConfIFNames parameter

This parameter is only used in a check that is not valid
because only a single interface name is used by the plugin.
Additionally, the func GetVFLinkNames was renamed to
GetVFLinkName to reflect that a single name is returned.

Signed-off-by: Marcelo Guerrero <[email protected]>

* Revert "Add support for allmulticast flag"

* expose mac address in cni result

the commit allow to expose the mac address in the cni result object
also for devices that are attached to user-space drivers like vfio

mac address selection method:
1. if the vf is attached to the kernel use it
2. if the vf is attached to user-space driver check the vf admin mac
2.1 if the vf admin mac is not 0 publish it
2.2 if the vf admin mac is 0 don't publish the info

Signed-off-by: Sebastian Sch <[email protected]>

* Check VF ID existence in Del cmd

This checks if the VF is still present in the node when
the Del command is executed.

Fixes k8snetworkplumbingwg#271

Signed-off-by: Marcelo Guerrero <[email protected]>

* Convert mac address to lower case always

Without this commit there is a possible bug if the user
request a mac address with upper case.

The issue is that netlink lib will always return the hardware struct
for mac address and it will always be lower case.

So to be able and do a right equal check we convert the user provided mac
address to lower case always

Signed-off-by: Sebastian Sch <[email protected]>

* Remove Dockerfile.rhel7

This Dockerfile is specific to RHEL but upstream is agnostic of the
distribution.

Signed-off-by: Balazs Nemeth <[email protected]>

* Support vlan Proto

This allows users to set the vlan protocol.

Signed-off-by: Marcelo Guerrero <[email protected]>

* Fix checks for vlan parameters

- Add check to not allow non default values of qos and proto
  when vlan is zero.
- Remove check when vlan is zero and qos and proto are not in
  config since default values are now set.

Signed-off-by: Marcelo Guerrero <[email protected]>

* Makefile: Provide switch for container engine

Provide a way to choose the container engine with IMAGE_BUILDER var.

Signed-off-by: Andreas Karis <[email protected]>

* Add vendoring for logging

Signed-off-by: Andreas Karis <[email protected]>

* Add debug logging for SR-IOV plugin

Signed-off-by: Andreas Karis <[email protected]>

* Bump golang.org/x/net from 0.8.0 to 0.17.0

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.8.0 to 0.17.0.
- [Commits](golang/net@v0.8.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Set MAC address after renaming the interface

Setting the MAC address at the end of SetupVF reduces
the chances of race conditions with tools that set MAC
address asynchronously (i.e. iavf).

This commit solve an issue with i40e driver where calling
`SetVFEffectiveMAC` after `SetVFHardwareMAC` may produce
a VF with no connectivity even if the last configuration step
didn't produce any error:

```
+ ip link set dev ens1f0 vf 0 mac 20:04:0f:f1:88:A1   # No error
+ ip link set dev temp_71 address 20:04:0f:f1:88:A1   # Transient error
RTNETLINK answers: Resource temporarily unavailable
+ ip link set dev temp_71 address 20:04:0f:f1:88:A1   # No error
```

Note: this seems to be a kernel driver regression introduced near
torvalds/linux@c34743d

Signed-off-by: Andrea Panattoni <[email protected]>

* Fix release workflow

- remove "latest" image tage from docker meta
- remove use of IMAGE_NAME in manifest creation as
  docker meta tag is the full image name

Signed-off-by: adrianc <[email protected]>

* fix platform in image push release workflow

set correct platform

Signed-off-by: adrianc <[email protected]>

* Add SRIOV Operator CI lane

Add a Github Action lane to trigger the SRIOV Network
Operator tests. This allows to verify if PR changes break
any working scenario.

Signed-off-by: Andrea Panattoni <[email protected]>

* bump go version to 1.21

Signed-off-by: ii2day <[email protected]>

* Optionally avoid sleeping in `entrypoint.sh`

Container image might be used as `initcontainers` in kubernetes Pods. In
such scenarios, it's important for the image entrypoint to exits once the
copy logic is completed. Otherwise, the pod would stuck in a `PodInitializing`
phase.

Add Makefile rule `image-test` to check the integrity of the entrypoint.sh script.

https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
Signed-off-by: Andrea Panattoni <[email protected]>

* chore: Add OWNERS file

Signed-off-by: killianmuldoon <[email protected]>

---------

Signed-off-by: yulng <[email protected]>
Signed-off-by: Salvatore Daniele <[email protected]>
Signed-off-by: Sebastian Sch <[email protected]>
Signed-off-by: adrianc <[email protected]>
Signed-off-by: Jiri Prokes <[email protected]>
Signed-off-by: frbimo <[email protected]>
Signed-off-by: Marcelo Guerrero <[email protected]>
Signed-off-by: Balazs Nemeth <[email protected]>
Signed-off-by: Andreas Karis <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Andrea Panattoni <[email protected]>
Signed-off-by: ii2day <[email protected]>
Signed-off-by: killianmuldoon <[email protected]>
Co-authored-by: yulng <[email protected]>
Co-authored-by: Salvatore Daniele <[email protected]>
Co-authored-by: Sebastian Sch <[email protected]>
Co-authored-by: Andrea Panattoni <[email protected]>
Co-authored-by: Adrian Chiris <[email protected]>
Co-authored-by: Jiri Prokes <[email protected]>
Co-authored-by: frbimo <[email protected]>
Co-authored-by: Alina Sudakov <[email protected]>
Co-authored-by: Marcelo Guerrero <[email protected]>
Co-authored-by: Balazs Nemeth <[email protected]>
Co-authored-by: Andreas Karis <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ii2day <[email protected]>
Co-authored-by: killianmuldoon <[email protected]>
  • Loading branch information
15 people authored Mar 12, 2024
1 parent 0303583 commit eaf1833
Show file tree
Hide file tree
Showing 34 changed files with 1,291 additions and 481 deletions.
47 changes: 39 additions & 8 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build-test:
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.21.x]
os: [ubuntu-latest]
goos: [linux]
goarch: [amd64, arm64, ppc64le]
Expand All @@ -18,12 +18,12 @@ jobs:
GO111MODULE: on
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build test for ${{ matrix.goarch }}
env:
Expand All @@ -33,17 +33,17 @@ jobs:

- name: Go test
if: ${{ matrix.goarch }} == "amd64"
run: sudo go test ./... # sudo needed for netns change in test
run: sudo go test -race ./... # sudo needed for netns change in test

coverage:
runs-on: ubuntu-latest
needs: build-test
name: coverage
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: 1.21.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -52,7 +52,38 @@ jobs:
run: sudo make test-coverage # sudo needed for netns change in test

- name: Coveralls
uses: coverallsapp/github-action@1.1.3
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: test/coverage/lcov.info
file: test/coverage/lcov.info

sriov-operator-e2e-test:
name: SR-IOV operator e2e tests
needs: [ build-test ]
runs-on: [ sriov ]
env:
TEST_REPORT_PATH: k8s-artifacts
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: build sriov-cni image
run: podman build -t ghaction-sriov-cni:pr-${{github.event.pull_request.number}} .

- name: Check out sriov operator's code
uses: actions/checkout@v2
with:
repository: k8snetworkplumbingwg/sriov-network-operator
path: sriov-network-operator-wc

- name: run test
run: make test-e2e-conformance-virtual-k8s-cluster-ci
working-directory: sriov-network-operator-wc
env:
LOCAL_SRIOV_CNI_IMAGE: ghaction-sriov-cni:pr-${{github.event.pull_request.number}}

- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ env.TEST_REPORT_PATH }}
path: ./sriov-network-operator-wc/${{ env.TEST_REPORT_PATH }}
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "37 4 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ go ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
52 changes: 22 additions & 30 deletions .github/workflows/image-push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,51 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push sriov-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_NAME }}:latest-amd64
${{ steps.docker_meta.outputs.tags }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:${{ github.sha }}
file: ./Dockerfile

build-and-push-arm64-sriov-cni:
name: Image Push ARM64
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push sriov-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -71,23 +71,23 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push sriov-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -98,29 +98,21 @@ jobs:

push-manifest:
runs-on: ubuntu-20.04
needs: [build-and-push-amd64-sriov-cni,build-and-push-amr64-sriov-cni,build-and-push-ppc64le-sriov-cni]
needs: [build-and-push-amd64-sriov-cni,build-and-push-arm64-sriov-cni,build-and-push-ppc64le-sriov-cni]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest for multi-arch images
run: |
# pull
docker pull ${{ env.IMAGE_NAME }}:latest-amd64
docker pull ${{ env.IMAGE_NAME }}:latest-arm64
docker pull ${{ env.IMAGE_NAME }}:latest-ppc64le
# create
docker manifest create ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 ${{ env.IMAGE_NAME }}:latest-arm64 ${{ env.IMAGE_NAME }}:latest-ppc64le
# annotate
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 --arch amd64
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-arm64 --arch arm64
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-ppc64le --arch ppc64le
# push
docker manifest push ${{ env.IMAGE_NAME }}:latest
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest \
${{ env.IMAGE_NAME }}:latest-amd64 \
${{ env.IMAGE_NAME }}:latest-arm64 \
${{ env.IMAGE_NAME }}:latest-ppc64le
Loading

0 comments on commit eaf1833

Please sign in to comment.