Commit Graph

47 Commits

Author SHA1 Message Date
Blaine Gardner
03a7bb49b1
build & use multi-arch manifests for doc/crds
Build multi-arch manifests (amd64 and arm64) for PR 'build`, 'master'
images, and 'release' images. In the doc/crds/daemonset-install.yaml
file, remove amd64-specific items, and use the 'latest' manifest that
will autoselect the appropriate architecture for the system.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-05-22 11:41:51 -06:00
Blaine Gardner
39e228cf1f
fix 'latest-arm' image to build for arm64, not amd64
The build-push action for master 'latest-arm64' images were being done
for amd64 incorrectly. Fix this.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-05-09 13:01:52 -06:00
Blaine Gardner
8a201e5f8f
sign into registry for pushing arm master build
Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-04-27 12:54:30 -06:00
Blaine Gardner
85df144a6f
push arm master image build
The last thing I believe is missing is to actually push the ARM master
build.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-03-22 11:38:06 -06:00
Blaine Gardner
76b2c52ba2
add qemu setup for arm build
The ARM image build complains of a qemu script not being present. It
seems that qemu is required for `docker buildx` to work.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-03-21 13:54:58 -06:00
Blaine Gardner
a416ca3d37
Fix arm64 image builds in github actions
Add the 'platforms' option to arm64 image builds. Otherwise, builds are
still in amd64 containers.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2023-03-14 18:55:35 -06:00
Miguel Duarte Barroso
e40b0db2c0 ci: do not run tests when .md files are updated
Also skip the tests when the pictures in the docs folder are updated.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2023-03-07 16:46:36 +01:00
Miguel Duarte Barroso
06f6b6f826 ci: do not run tests on doc changes
Whenever the docs folder - or the README - changes, there is no need to
run the unit tests, nor the e2e tests. As such, do not run those actions
when the code changes are purely related to docs.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2023-03-07 11:55:34 +01:00
Miguel Duarte Barroso
f5469aed61 ci, go1.19: update revive action to 2.4.1
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2023-02-03 14:30:56 -06:00
Paulo Gomes
f5a820aa63 Bump Go version to 1.19
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
2023-02-03 14:24:28 -06:00
nicklesimba
3de4e9a566 Added tests for ipv6 ranges that end in zeroes
Signed-off-by: nicklesimba <simha.nikhil@gmail.com>
2023-02-03 14:22:27 -06:00
Antonin Bas
7f2330d91a Fix typo in Github workflow
Signed-off-by: Antonin Bas <abas@vmware.com>
2022-10-28 10:57:54 -07:00
Miguel Duarte Barroso
23fa7769ad ci automation, docs: maiqueb cares about docs
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-08-04 14:08:40 +02:00
Doug Smith
b5330f58e2
Merge pull request #245 from maiqueb/add-github-pr-template
automation: provide PR template
2022-07-12 08:40:50 -04:00
Doug Smith
552f066e87
Merge pull request #246 from k8snetworkplumbingwg/add-issue-template-for-bugs
Propose issue templates for bugs
2022-07-12 08:40:07 -04:00
Doug Smith
c8a38560f2
Merge pull request #238 from nicklesimba/cronjob-removal
Moved IP Reconciler code into IP Control Loop
2022-07-12 08:30:06 -04:00
nicklesimba
545f05525c Moved IP Reconciler code into IP Control Loop
Signed-off-by: nicklesimba <simha.nikhil@gmail.com>
2022-07-11 15:43:24 -05:00
Miguel Duarte Barroso
0cec00a1bd
Propose issue templates for enhancements
An issue template will help the community to know what information is required when requesting an enhancement from whereabouts.

This will improve the triage procedure, and reduce the back n' forth of the maintainers (no need to ask for info...).
2022-07-05 13:46:33 +02:00
Miguel Duarte Barroso
b2af6c4c65
Propose issue templates for bugs
An issue template will help the community to know what information is required for a bug.

This will improve the triage procedure, and reduce the back n' forth of the maintainers (no need to ask for info...).
2022-07-05 13:41:23 +02:00
Miguel Duarte Barroso
6eacd2589b automation: provide PR template
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-07-05 13:33:52 +02:00
Miguel Duarte Barroso
75c2809584 ci, test: bump staticcheck to latest version
This can be done since the latest staticcheck version runs on
golang1.17.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-06-10 16:40:57 +02:00
Miguel Duarte Barroso
a033c44635 build: differenciate the openshift / amd64 build names
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-05-19 13:58:40 +02:00
Miguel Duarte Barroso
4e70fa9e4b build, ci: bump the build imgs to use go1.17
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-05-19 13:58:39 +02:00
Miguel Duarte Barroso
8fe39ba97f ci: bump the worker golang version to 1.17
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-05-19 13:25:39 +02:00
Doug Smith
dc9b85c8f5
Merge pull request #219 from maiqueb/add-code-owners
ci: add codeowners
2022-05-06 12:14:27 -04:00
Miguel Duarte Barroso
79ded4c7ae ci: add codeowners
This way, new PRs are automatically added a reviewer from the list.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-05-06 17:40:56 +02:00
nicklesimba
1a8e5e1e7c Replaced bash e2e test with golang e2e test
Signed-off-by: nicklesimba <simha.nikhil@gmail.com>
2022-04-21 09:21:55 +02:00
Miguel Duarte Barroso
59f1052972
IP control loop (#185)
* build: generate ip pool clientSet/informers/listers

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* vendor: update vendor stuff

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* build: vendor net-attach-def-client types

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* config: look for the whereabouts config file in multiple places

The reconciler controller will have access to the whereabouts
configuration via a mount point. As such, we need a way to specify its
path.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* reconcile-loop: requires the IP ranges in normalized format

The IP reconcile loop also requires the IP ranges in a normalized
format; as such, we export it into a function, which will be used in a
follow-up commit.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* config: allow IPAM config parsing from a NetConfList

Currently whereabouts is only able to parse network configurations in
the strict [0] format - i.e. **do not accept** a plugin list - [1].

The `ip-control-loop` must recover the full plugin configuration, which
may be in the network configuration format.

This commit allows whereabouts to now understand both formats.

Furthermore, the current CNI release - v1.0.Z - removed the support for
[0], meaning that only the configuration list format is now supported
[2].

[0] - https://github.com/containernetworking/cni/blob/v0.8.1/SPEC.md#network-configuration
[1] - https://github.com/containernetworking/cni/blob/v0.8.1/SPEC.md#network-configuration-lists
[2] - https://github.com/containernetworking/cni/blob/master/SPEC.md#released-versions

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* reconcile-loop: add a controller

Listen to pod deletion, and for every deleted pod, assure their IPs
are gone.

The rough algorithm goes like this:
  - for every network-status in the pod's annotations:
    - read associated net-attach-def from the k8s API
    - extract the range from the net-attach-def
    - find the corresponding IP pool
    - look for allocations belonging to the deleted pod
    - delete them using `IPManagement(..., types.Deallocate, ...)`

All the API reads go through the informer cache, which is kept updated
whenever the objects are updated on the API.

The dockerfiles are also updated, to ship this new binary.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* e2e tests: remove manual cluster reconciliation

This would leave the `ip-control-loop` as the reconciliation tool.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* unit tests: assure stale IPAllocation cleanup

This commit adds a unit where it is checked that the pod deletion leads
to the cleanup of a stale IP address.

This commit features the automatic provisioning of the controller informer cache
with the data present on the fake clientset tracker (the "fake" datastore).

This way, users can just create the client with provisioned data, and
that'll trickle down to the informer cache of the pod controller.

Because the `network-attachment-definitions` resources feature dashes,
the heuristic function that guesses - yes, guesses. very deterministic
... - the name of the resource can't be used - [0]. As such, it was
needed to create an alternate `newFakeNetAttachDefClient` where it is
possible to specify the correct resource name.

[0] - 2fd7267afc/vendor/k8s.io/client-go/testing/fixture.go (L331)

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* unit tests: move helper funcs to other files

The helper files are tagged with the `test` build tag, to prevent them
from being shipped on the production code binary.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* control loop, queueing: use a rate-limiting queue

Using a queue allows us to re-queue errors.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* control loop: add IPAllocation cleanup related events

Adds two new events related to garbage collection of the whereabouts IP
addresses:
  - when an IP address is garbage collected
  - when a cleanup operation fails and is not re-queued

The former event looks like:
```
116s        Normal    IPAddressGarbageCollected   pod/macvlan1-worker1 \
            successful cleanup of IP address [192.168.2.1] from network \
            whereabouts-conf
```

The latter event looks like:
```
10s         Warning    IPAddressGarbageCollectionFailed    failed to garbage \
            collect addresses for pod default/macvlan1-worker1
```

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* e2e tests: check out statefulset scenarios

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* e2e tests: test different scale up/down order and instance deltas

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* ci: test e2e bash scripts last

These ugly tests do not cleanup after themselves; this way, the golang
based tests (which **do** cleanup after themselves) will not be impacted by
these left-overs.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* ip control loop, unit tests: test negative scenarios

Check the event thrown when a request is dropped from the queue, and
assure reconciling an allocation is impossible without having access to
the attachment configuration data.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* e2e tests: test fix for issue #182

Issue [0] reports an error when a pod associated to a `StatefulSet`
whose IPPool is already full is deleted. According to it, the new pod -
scheduled by the `StatefulSet` - cannot run because the IPPool is
already full, and the old pod's IP cannot be garbage collected because
we match by pod reference - and the "new" pod is stuck in `creating`
phase.

[0] - https://github.com/k8snetworkplumbingwg/whereabouts/issues/182

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* ip-control-loop: strip pod before queueing it

The ip reconcile loop only requires the pod metadata and its network
status annotatations to garbage collect the stale IP addresses.

As such, we remove the status and spec parameters from the pod before
queueing it.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* reconcile-loop: focus on networks w/ whereabouts IPAM type

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-04-13 10:49:18 -04:00
Miguel Duarte Barroso
329a1fef0c ci, test: pin staticcheck 0.2.2
The new `staticcheck` release - v0.3.0 - can only be installed on golang
1.17 or 1.18, since golang 1.16 already hit EOL.

This is tracked in issue [0].

A follow up PR should update whereabouts to use golang 1.17, but this PR
unlocks CI right now.

[0] - https://github.com/dominikh/go-tools/issues/1238

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-03-31 10:11:51 +02:00
Doug Smith
d8086a4987
Merge pull request #203 from maiqueb/remove-golint
Remove golint
2022-02-28 13:01:06 -05:00
Miguel Duarte Barroso
cd93d29352 build, tests: replace golint w/ go vet + staticcheck
Goling is deprecated, as per their page [0]; its readme says that tools
such as `go vet` and `staticcheck` should be used instead.

As such, this patch replaces golint with the suggested tools.

[0] - https://github.com/golang/lint

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-02-28 12:49:03 +01:00
Miguel Duarte Barroso
b5d77a7c16 github: fix test actions
Pass the path to the kubeconfig, and cleanup some variables that are not
in use.

Also, ensure that the e2e tests are not executed when the
`hack/test-go.sh` script is executed - that is for the unit tests only.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-02-28 11:47:54 +01:00
nicklesimba
ad93b9d247 Simple Whereabouts Golang E2E Test
Signed-off-by: nicklesimba <simha.nikhil@gmail.com>
2022-02-28 11:47:54 +01:00
Miguel Duarte Barroso
60af538922
Bump golang 1.16 (#184)
* build: synch the golang builders w/ the go version on go.mod

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* build: use golang 1.16

Bump the golang version in the module file and in the Dockerfiles
used to build the images.

The github actions config files are also updated accordingly.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2022-02-07 08:24:17 -05:00
Doug Smith
7e39872d14
Merge pull request #156 from maiqueb/disable-cni-check-cmd
e2e tests: fix currently broken setup on kind clusters
2021-10-21 14:03:28 -04:00
Ivan Kolodyazhny
9583b1d636 Use k8snetworkplumbingwg repo instead of dougbtv in sources 2021-10-07 17:29:56 +03:00
Miguel Duarte Barroso
876f0a2927 e2e tests: manually reconcile the cluster
Before checking for stale IP addresses, trigger the `ip-reconciler`
tool, which will cleanup stale IP addresses.

In order to manually run the reconciler, we need to build it first;
as such, the github action must be updated.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2021-10-07 15:41:40 +02:00
Doug Smith
b3c24e9c2e
Merge pull request #148 from martinkennelly/add_simple_e2e_test
Add E2E test cases and execute with GH workflow
2021-09-30 14:28:56 -04:00
Martin Kennelly
fa37afc8cf Add E2E test cases and execute with GH workflow
Test cases are simple and check that:
* IPs seen in IP pool are what is assigned
to pods.
* No stale IPs in IP pool following test run.

Signed-off-by: Martin Kennelly <mkennell@redhat.com>
2021-09-29 19:02:44 +01:00
Antonin Bas
d34caca6a5 Upload whereabouts binary as release asset
The binaries (built for amd64, arm64 and arm) are uploaded using a
Github workflow every time a new Github release is created. This
simplifies consumption of these binaries by other projects, and creates
an "official" build.

Signed-off-by: Antonin Bas <abas@vmware.com>
2021-09-21 13:22:55 -07:00
dougbtv
f16a162bcd Updates image push on release to refer to correct dockerfile location 2021-07-08 11:34:29 -04:00
Tomofumi Hayashi
cb38860d42 Fix github action due to org change. 2021-04-26 16:20:36 -04:00
Blair MacNeil
61bb39a3b4
feat: add arm64 dockerfile and add github action steps for new arch (#96)
* Added dockerfile for arm64  and added step in ci github action

* added additional elements to actions
2021-03-02 14:38:28 -05:00
Doug Smith
860f2fa23d Merge pull request #93 from s1061123/fix/gh-actions
Fix github actions
2021-02-22 11:57:10 -05:00
Tomofumi Hayashi
c1d93ef5b7 Fix github actions 2021-02-23 01:34:26 +09:00
Doug Smith
1368fd952c Merge pull request #92 from s1061123/dev/use-github-actions
Change CI pipeline from travis CI to github actions
2021-02-22 10:39:43 -05:00
Tomofumi Hayashi
0f0a9e5696 Change CI pipeline from travis CI to github actions
This change replaces travis CI with github actions.
2021-02-23 00:24:48 +09:00