Skip to content

Conversation

@mauriciovasquezbernal
Copy link
Contributor

pcn-k8s was broken in few places:

  • List validation was wrong and hence it was not possible to create a cube with the ports using a rest client
  • k8switch had a bad logic to init the cube on construction time
  • k8sfilter had a problem that prevented the creation of ports on this.

The validation code for the list was not testing all the elements of the list,
it instead was testing the list as a container.  Due to this complex commands
issued with a rest client were failing, for instance:

curl -L -X POST --data '{"name":"hw0","ports":[{"name":"pippo"}]}' \
  "http://localhost:9000/polycube/v1/helloworld/hw0/"

curl -L -X POST --data \
  '[{"name":"toveth1", "peer":"veth1"}, {"name":"toveth2", "peer":"veth2"}]' \
  "http://localhost:9000/polycube/v1/helloworld/hw0/ports/

This commit implements a new logic that tests all the elements in a list, also
a new logic fill the keys in json body of a list request is added as well.

This failure was unnoticed because polycubectl does not allow to perform such
complex operations in a single command.

Fixes: d8d280c ("Added new REST API and validation code")
Fixes: 795ce96 ("move help generation from services to daemon")

Signed-off-by: Mauricio Vasquez B <[email protected]>
after 18becf4 ("polycubed: fix list validation") a parameter that can only
be set at initialization time must be "config true" and use the init-only-config
extension of polycube.

Fixes: ab259a9 ("Ported k8sfilter")

Signed-off-by: Mauricio Vasquez B <[email protected]>
Before 09356c4c033 ("services: remove generate_code and generate_code_vector")
the k8switch was created with a stub program and then reloaded with the initial
configuration.  That approach is far from optimal as the code is immediately
reloaded, then 09356c4c033 changed that to created the cube without any eBPF
program and then add it with the initial configuration.

However, the call to reload_program was still there, it fails because the
stub is not present anymore.  This commits fix that by calling add_program
when the cube is created.

Fixes: e09356c ("services: remove generate_code and generate_code_vector")

Signed-off-by: Mauricio Vasquez B <[email protected]>
Copy link
Contributor

@acloudiator acloudiator left a comment

Choose a reason for hiding this comment

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

LGTM

@frisso frisso merged commit 1b1bd69 into master Apr 5, 2019
@frisso frisso deleted the pr/fix_pcn_k8s branch April 5, 2019 05:43
@mnshrr mnshrr mentioned this pull request May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants