Skip to content

Commit

Permalink
Fix supervisor example to work with TLS
Browse files Browse the repository at this point in the history
open-telemetry#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 committed Jul 6, 2023
1 parent 715146e commit 130e83d
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 130e83d

Please sign in to comment.