Skip to content

Commit

Permalink
updated caduceus with new webhook-schema and new ancla packages
Browse files Browse the repository at this point in the history
  • Loading branch information
maurafortino committed May 20, 2024
1 parent cbc2cbd commit 9522dec
Show file tree
Hide file tree
Showing 12 changed files with 1,120 additions and 341 deletions.
9 changes: 8 additions & 1 deletion caduceus.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import (
_ "github.com/goschtalt/goschtalt/pkg/typical"
_ "github.com/goschtalt/yaml-decoder"
_ "github.com/goschtalt/yaml-encoder"
"github.com/xmidt-org/ancla"

Check failure on line 17 in caduceus.go

View workflow job for this annotation

GitHub Actions / ci / Go Unit Tests

github.com/xmidt-org/[email protected]: replacement directory /Users/mforti446/Documents/work/xmidt-repos/ancla does not exist

Check failure on line 17 in caduceus.go

View workflow job for this annotation

GitHub Actions / ci / Build Go Program

github.com/xmidt-org/[email protected]: replacement directory /Users/mforti446/Documents/work/xmidt-repos/ancla does not exist
"github.com/xmidt-org/arrange/arrangehttp"
anclahelper "github.com/xmidt-org/caduceus/internal/anclaHelper"
"github.com/xmidt-org/caduceus/internal/client"
"github.com/xmidt-org/caduceus/internal/handler"
"github.com/xmidt-org/caduceus/internal/metrics"
"github.com/xmidt-org/caduceus/internal/sink"
Expand Down Expand Up @@ -87,11 +90,13 @@ func Caduceus(arguments []string, run bool) error {
goschtalt.UnmarshalFunc[touchstone.Config]("prometheus"),
goschtalt.UnmarshalFunc[sink.Config]("sender"),
goschtalt.UnmarshalFunc[Service]("service"),
goschtalt.UnmarshalFunc[client.HttpClientTimeout]("argusClientTimeout"),
goschtalt.UnmarshalFunc[[]string]("authHeader"),
goschtalt.UnmarshalFunc[bool]("previousVersionSupport"),
goschtalt.UnmarshalFunc[HealthPath]("servers.health.path"),
goschtalt.UnmarshalFunc[MetricsPath]("servers.metrics.path"),
goschtalt.UnmarshalFunc[PprofPathPrefix]("servers.pprof.path"),
goschtalt.UnmarshalFunc[ancla.Config]("webhook"),
fx.Annotated{
Name: "server",
Target: goschtalt.UnmarshalFunc[string]("server"),
Expand Down Expand Up @@ -151,10 +156,12 @@ func Caduceus(arguments []string, run bool) error {
touchstone.Provide(),
touchhttp.Provide(),
metrics.Provide(),
// ancla.ProvideMetrics(), //TODO: need to add back in once we fix the ancla/argus dependency issue
client.Provide(),
ancla.ProvideMetrics(),

fx.Invoke(
lifeCycle,
anclahelper.InitializeAncla,
),
)

Expand Down
53 changes: 27 additions & 26 deletions caduceus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,32 +291,33 @@ authHeader: ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=", "dXNlcjpwYXNz"]
# Webhooks Related Configuration
##############################################################################
# webhook provides configuration for storing and obtaining webhook
# information using Argus.
# webhook:
# # JWTParserType establishes which parser type will be used by the JWT token
# # acquirer used by Argus. Options include 'simple' and 'raw'.
# # Simple: parser assumes token payloads have the following structure: https://github.com/xmidt-org/bascule/blob/c011b128d6b95fa8358228535c63d1945347adaa/acquire/bearer.go#L77
# # Raw: parser assumes all of the token payload == JWT token
# # (Optional). Defaults to 'simple'.
# jwtParserType: "raw"
# basicClientConfig:
# # listen is the subsection that configures the listening feature of the argus client
# # (Optional)
# # listen:
# # # pullInterval provides how often the current webhooks list gets refreshed.
# # pullInterval: 5s

# # bucket is the partition name where webhooks will be stored.
# bucket: "webhooks"

# # address is Argus' network location.
# address: "http://localhost:6600"

# # auth the authentication method for argus.
# auth:
# # basic configures basic authentication for argus.
# # Must be of form: 'Basic xyz=='
# basic: "Basic dXNlcjpwYXNz"
# information using Argus
webhook:
# JWTParserType establishes which parser type will be used by the JWT token
# acquirer used by Argus. Options include 'simple' and 'raw'.
# Simple: parser assumes token payloads have the following structure: https://github.com/xmidt-org/bascule/blob/c011b128d6b95fa8358228535c63d1945347adaa/acquire/bearer.go#L77
# Raw: parser assumes all of the token payload == JWT token
# (Optional). Defaults to 'simple'.
jwtParserType: "raw"

basicClientConfig:
# listen is the subsection that configures the listening feature of the argus client
# (Optional)
# listen:
# # pullInterval provides how often the current webhooks list gets refreshed.
# pullInterval: 5s

# bucket is the partition name where webhooks will be stored.
bucket: "webhooks"

# address is Argus' network location.
address: "http://localhost:6600"

# auth the authentication method for argus.
auth:
# basic configures basic authentication for argus.
# Must be of form: 'Basic xyz=='
basic: "Basic Zm9vYmFyOmxvY2FsdGVzdGluZwo="
#
# # jwt configures jwt style authentication for argus.
# JWT:
Expand Down
17 changes: 4 additions & 13 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ package caduceus
import (
"fmt"
"os"
"time"

"github.com/goschtalt/goschtalt"
"github.com/xmidt-org/ancla"
"github.com/xmidt-org/arrange/arrangehttp"
"github.com/xmidt-org/arrange/arrangepprof"
"github.com/xmidt-org/bascule"
"github.com/xmidt-org/caduceus/internal/client"
"github.com/xmidt-org/caduceus/internal/sink"
"github.com/xmidt-org/candlelight"
"github.com/xmidt-org/clortho"
Expand All @@ -27,7 +28,7 @@ type Config struct {
Tracing candlelight.Config
Prometheus touchstone.Config
Servers Servers
ArgusClientTimeout HttpClientTimeout
ArgusClientTimeout client.HttpClientTimeout
JWTValidator JWTValidator
Sender sink.Config
Service Service
Expand All @@ -38,8 +39,7 @@ type Config struct {
Flavor string
PreviousVersionSupport bool
Region string
// Webhook ancla.Config //@TODO: need to fix the ancla/argus dependency issue

Webhook ancla.Config
}

type Service struct {
Expand Down Expand Up @@ -103,15 +103,6 @@ type PprofServer struct {

type PprofPathPrefix string

// httpClientTimeout contains timeouts for an HTTP client and its requests.
type HttpClientTimeout struct {
// ClientTimeout is HTTP Client Timeout.
ClientTimeout time.Duration

// NetDialerTimeout is the net dialer timeout
NetDialerTimeout time.Duration
}

type MetricsOption struct {
Namespace string
Subsystem string
Expand Down
33 changes: 23 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ go 1.21

require (
github.com/alecthomas/kong v0.8.1
github.com/go-chi/chi/v5 v5.0.10
github.com/goschtalt/goschtalt v0.22.1
github.com/go-chi/chi/v5 v5.0.12
github.com/goschtalt/goschtalt v0.25.0
github.com/goschtalt/yaml-decoder v0.0.1
github.com/goschtalt/yaml-encoder v0.0.3
github.com/prometheus/client_golang v1.17.0
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/xmidt-org/ancla v0.0.0-00010101000000-000000000000
github.com/xmidt-org/arrange v0.5.1-0.20230914215531-f02b8651b631
github.com/xmidt-org/bascule v0.11.7
github.com/xmidt-org/candlelight v0.0.21
Expand All @@ -25,11 +26,13 @@ require (
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.46.1
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
go.uber.org/fx v1.20.1
go.uber.org/zap v1.26.0
go.uber.org/zap v1.27.0
gopkg.in/dealancer/validate.v2 v2.1.0
)

require (
emperror.dev/emperror v0.33.0 // indirect
emperror.dev/errors v0.8.1 // indirect
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
Expand All @@ -51,7 +54,8 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect
github.com/jtacoma/uritemplates v1.0.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/justinas/alice v1.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.4 // indirect
Expand All @@ -61,15 +65,18 @@ require (
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/xmidt-org/argus v0.9.10 // indirect
github.com/xmidt-org/chronon v0.1.1 // indirect
github.com/xmidt-org/urlegit v0.1.0 // indirect
github.com/xmidt-org/urlegit v0.1.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
Expand All @@ -83,9 +90,9 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
Expand All @@ -94,3 +101,9 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/xmidt-org/webhook-schema => /Users/mforti446/Documents/work/xmidt-repos/webhook-schema

replace github.com/xmidt-org/argus => /Users/mforti446/Documents/work/xmidt-repos/argus

replace github.com/xmidt-org/ancla => /Users/mforti446/Documents/work/xmidt-repos/ancla
Loading

0 comments on commit 9522dec

Please sign in to comment.