Skip to content

Commit

Permalink
Fix supervisor example to work with TLS (#190)
Browse files Browse the repository at this point in the history
#174 enabled
TLS on the server and non-TLS connections are no longer
accepted.

This PR updates the Supervisor to use TLS connection
(with InsecureSkipVerify=true flag).
  • Loading branch information
tigrannajaryan authored Jul 6, 2023
1 parent 715146e commit 90b56d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/examples/supervisor/bin/supervisor.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
endpoint: ws://127.0.0.1:4320/v1/opamp
endpoint: wss://127.0.0.1:4320/v1/opamp

agent:
executable: ../../../../../opentelemetry-collector-contrib/bin/otelcontribcol_darwin_amd64
7 changes: 6 additions & 1 deletion internal/examples/supervisor/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package supervisor

import (
"context"
"crypto/tls"
"errors"
"fmt"
"math/rand"
Expand All @@ -17,6 +18,7 @@ import (
"github.com/knadh/koanf/providers/file"
"github.com/knadh/koanf/providers/rawbytes"
"github.com/oklog/ulid/v2"

"github.com/open-telemetry/opamp-go/client"
"github.com/open-telemetry/opamp-go/client/types"
"github.com/open-telemetry/opamp-go/internal/examples/supervisor/supervisor/commander"
Expand Down Expand Up @@ -133,7 +135,10 @@ func (s *Supervisor) startOpAMP() error {

settings := types.StartSettings{
OpAMPServerURL: s.config.Server.Endpoint,
InstanceUid: s.instanceId.String(),
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
InstanceUid: s.instanceId.String(),
Callbacks: types.CallbacksStruct{
OnConnectFunc: func() {
s.logger.Debugf("Connected to the server.")
Expand Down

0 comments on commit 90b56d9

Please sign in to comment.