Skip to content

Commit

Permalink
fixed TLS instrumentation (issue 70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri Eival committed Jan 29, 2022
1 parent c1a225d commit a8b45c5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 2 additions & 3 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"syscall"

"github.com/omrikiei/ktunnel/pkg/client"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -39,7 +38,7 @@ ktunnel client --host ktunnel-server.yourcompany.com -s tcp 8000 8001:8432
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL, syscall.SIGQUIT)
go func() {
o.Do(func() {
_ = <-sigs
<-sigs
log.Info("Got exit signal, closing client tunnels")
cancel()
})
Expand All @@ -49,7 +48,7 @@ ktunnel client --host ktunnel-server.yourcompany.com -s tcp 8000 8001:8432
client.WithServer(Host, port),
client.WithTunnels(Scheme, args...),
client.WithLogger(&logger),
client.WithTLS(CertFile, ServerHostOverride),
client.WithTLS(CaFile, ServerHostOverride),

}

Expand Down
4 changes: 2 additions & 2 deletions cmd/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ktunnel expose redis 6379
// Teardown
go func() {
o.Do(func() {
_ = <-sigs
<-sigs
if Reuse {
log.Info("Got exit signal, closing client tunnels")
} else {
Expand Down Expand Up @@ -111,7 +111,7 @@ ktunnel expose redis 6379
client.WithLogger(&logger),
}
if tls {
opts = append(opts, client.WithTLS(CertFile, ServerHostOverride))
opts = append(opts, client.WithTLS(CaFile, ServerHostOverride))
}
err = client.RunClient(ctx, opts...)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ ktunnel inject deploymeny mydeployment 3306 6379
client.WithLogger(&logger),
}
if tls {
opts = append(opts, client.WithTLS(CertFile, ServerHostOverride))
opts = append(opts, client.WithTLS(CaFile, ServerHostOverride))
}
err = client.RunClient(ctx, opts...)
if err != nil {
log.Fatalf("Failed to run client: %v", err)
}
}()
}
_ = <-done
<-done
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
version = "1.4.4"
version = "1.4.5"
)

var port int
Expand Down
9 changes: 6 additions & 3 deletions pkg/k8s/injector_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package k8s

import (
"context"
"net/url"
"testing"

v12 "k8s.io/api/apps/v1"
v14 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
testclient "k8s.io/client-go/kubernetes/fake"
v1 "k8s.io/client-go/kubernetes/typed/apps/v1"
"k8s.io/client-go/rest"
"net/url"
"testing"
)

type TestCase struct {
Expand Down Expand Up @@ -36,7 +39,7 @@ func createDeployment(c v1.DeploymentInterface, replicas int32, containers *[]v1
},
},
}
_, err := deploymentsClient.Create(&d)
_, err := deploymentsClient.Create(context.Background(), &d, metav1.CreateOptions{})
if err != nil {
return err
}
Expand Down

0 comments on commit a8b45c5

Please sign in to comment.