/
setup.go
36 lines (33 loc) · 877 Bytes
/
setup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package instrumentation
import (
"fmt"
"os"
"time"
)
func SetupTraceServerClient(endpoint string, _numAncCpids int) func() {
setupDoneCh, cancel := InitSender(endpoint, 240*time.Second, _numAncCpids)
go func() {
// receive in another goroutine to avoid blocking
<-setupDoneCh
}()
// <-setupDoneCh // EPPPPI-NOTE: don't wait for setup because trace server is deployed after controller-manager
return cancel
}
func WriteResolvconf() {
resolvconf := `search default.svc.cluster.local svc.cluster.local cluster.local
nameserver 10.96.0.10
options ndots:5
`
fp, err := os.Create("/etc/resolv.conf")
if err != nil {
fmt.Println("failed to open resolv.conf: ", err)
return
}
defer fp.Close()
_, err = fp.Write([]byte(resolvconf))
if err != nil {
fmt.Println("failed to write resolv.conf: ", err)
return
}
fmt.Println("sucessfully wrote resolv.conf")
}