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
[DRAFT] Add network functions on the DPU side #54
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bn222 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Containers: []corev1.Container{ | ||
{ | ||
Name: name, | ||
Image: image, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to have a PullPolicy = Always for debugging here.
return err | ||
} | ||
return d.Serve(lis) | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not work:
import (
"errors"
"fmt"
"time"
)
func something(c chan error) {
fmt.Println("HELLO1")
c <- nil
}
func something3(c chan error) {
fmt.Println("HELLO1")
time.Sleep(5 * time.Second)
c <- errors.New("an error")
}
func something2() error {
c := make(chan error, 1)
go something(c)
go something3(c)
return <-c
}
func main() {
err := something2()
fmt.Println(err)
}
It does not wait for all the go routines to finish, you need a wait group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this works:
package main
import (
"errors"
"fmt"
"sync"
"time"
)
func test1(wg *sync.WaitGroup, c chan error) {
defer wg.Done()
fmt.Println("HELLO1")
c <- nil
}
func test2(wg *sync.WaitGroup, c chan error) {
defer wg.Done()
fmt.Println("HELLO1")
time.Sleep(5 * time.Second)
c <- errors.New("an error")
}
func testing() chan error {
c := make(chan error, 2)
var wga sync.WaitGroup
wga.Add(1)
go test1(&wga, c)
wga.Add(1)
go test2(&wga, c)
wga.Wait()
close(c)
return c
}
func main() {
errors := testing()
for err := range errors {
fmt.Println(err)
}
}
listener, err := d.Listen() | ||
|
||
if err != nil { | ||
d.log.Error(err, "Failed to listen") | ||
return err | ||
} | ||
return d.Serve(listener) | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@bn222: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.