Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sc 34020 #107

Merged
merged 37 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
20cd085
adding dockerfile and config for dd-agent
chase-replicated May 5, 2022
dd4e9a6
temp remove filter for dd-agent job to push w/o tagging for testing
chase-replicated May 5, 2022
5e5d228
moving fly cfg out of submodule to commit
chase-replicated May 5, 2022
7ecc4b7
relying on image again taking out repo, have dd-fly toml so that shou…
chase-replicated May 6, 2022
5f6af6a
increase timeout time
chase-replicated May 6, 2022
06a009c
Updating port info dd-fly.toml
chase-replicated May 6, 2022
c645e05
Fixing datadog agent healthcheck
chase-replicated May 6, 2022
0b1d4f5
removing submodule reference
chase-replicated May 7, 2022
4319958
reapplying some changes
chase-replicated May 8, 2022
044dac7
reapplying some changes
chase-replicated May 8, 2022
13e3455
reapplying some changes
chase-replicated May 8, 2022
d918c40
typo
chase-replicated May 8, 2022
934cd35
typo
chase-replicated May 8, 2022
dca8762
typo
chase-replicated May 8, 2022
b9a0234
typo
chase-replicated May 9, 2022
80362e3
removing extraneous env var
chase-replicated May 9, 2022
6f5187b
temp remove action filters
chase-replicated May 9, 2022
51f52eb
typo
chase-replicated May 9, 2022
43a6b1b
moving env vars from fly toml to github action
chase-replicated May 9, 2022
80789d1
moving env var back
chase-replicated May 9, 2022
e5e5962
Updating http port in dd-fly.toml and moving env vars from github act…
chase-replicated May 9, 2022
b3af832
moving env vars back, failing deploy
chase-replicated May 9, 2022
567de76
moving image build into dd-fly.toml
chase-replicated May 9, 2022
f094c66
updating datadog agent hostname
chase-replicated May 10, 2022
7c7b674
adding internal tld
chase-replicated May 10, 2022
2966b0d
removing datadog from app.go, to follow pattern from other services
chase-replicated May 10, 2022
95b48d8
typo
chase-replicated May 10, 2022
a641621
Starting Datadog Tracer with Debug Enabled
chase-replicated May 10, 2022
b62ef79
fixing saaskit version
chase-replicated May 10, 2022
7121bbd
Updating saaskit
chase-replicated May 10, 2022
fbb2d29
updating dd instrumentation across app.go & pkg/daemon/daemon.go
chase-replicated May 11, 2022
a966a61
updating hostname & tracer start to daemon
chase-replicated May 11, 2022
a0f6802
go mod tidy
chase-replicated May 11, 2022
1a39e68
removing redundant tracer start from app.go
chase-replicated May 11, 2022
a4531a6
quotes around true to enable apm
chase-replicated May 13, 2022
b8ceaa5
remove comment on filter for flyio dd agent github action job
chase-replicated May 13, 2022
fc1c1c8
final update
chase-replicated May 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
go-version: '^1.17.4'

- run: sudo apt-get -qq -y install
- run: sudo apt-get -qq -y install

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
Expand Down Expand Up @@ -72,18 +72,19 @@ jobs:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@1.1
with:
args: deploy --app kots-lint --image-label ${GITHUB_REF:10} -e DD_AGENT_HOST=dd-agent
args: deploy --app kots-lint --config ./fly.toml --image-label ${GITHUB_REF:10}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

flyio-dd-agent:
runs-on: ubuntu-latest
needs: flyio
# runs-on: ubuntu-latest
# needs: flyio
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- run: curl https://s3.amazonaws.com/apt.datadoghq.com/pool/d/da/datadog-agent_7-1_amd64.deb -o datadog-agent_7-1_amd64.deb
- uses: superfly/flyctl-actions@1.1
with:
args: deploy --app dd-agent --image gcr.io/datadoghq/agent:7 -e DD_API_KEY=${{ secrets.DD_API_KEY }} -e DD_SITE="datadoghq.com" -e DD_APM_NON_LOCAL_TRAFFIC=true
args: deploy --config ./dd-fly.toml --app dd-agent --build-arg DD_AGENT_ARTIFACT=./datadog-agent_7-1_amd64.deb --image datadog/agent:7 -e DD_API_KEY=${{ secrets.DD_API_KEY }} -e DD_SITE="datadoghq.com" -e DD_APM_NON_LOCAL_TRAFFIC=true
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

10 changes: 3 additions & 7 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ import (
"github.com/replicatedhq/kots-lint/pkg/daemon"
"github.com/replicatedhq/kots-lint/pkg/kots"
"github.com/replicatedhq/kots-lint/pkg/version"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
"github.com/replicatedcom/saaskit/tracing/datadog"
log "github.com/sirupsen/logrus"

)

func main() {
tracer.Start(
tracer.WithService("kots-lint"),
tracer.WithServiceVersion(version.GitSHA()),
tracer.WithAgentAddr("dd-agent.internal:8126"),
)
defer tracer.Stop()
datadog.StartTracer("kots-lint", version.GitSHA())
defer datadog.StopTracer()

rand.Seed(time.Now().UTC().UnixNano())

Expand Down
40 changes: 40 additions & 0 deletions dd-fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# fly.toml file generated for dd-agent on 2022-05-05T11:33:31-07:00

app = "dd-agent"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
internal_port = 8126
processes = ["app"]
protocol = "tcp"

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 8126

[[services.tcp_checks]]
grace_period = "30s"
interval = "15s"
restart_limit = 0
timeout = "10s"

[[statics]]
guest_path = "/app/public"
url_prefix = "/static/"
3 changes: 3 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
app = "kots-lint"

[env]
DD_AGENT_HOST = "sjc.dd-agent.internal"
USE_DATADOG_APM = true

[[services]]
internal_port = 8082
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ require (
github.com/instrumenta/kubeval v0.0.0-20190918223246-8d013ec9fc56
github.com/mitchellh/mapstructure v1.4.2
github.com/open-policy-agent/opa v0.34.2
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/replicatedcom/saaskit v0.0.0-20220404234806-42d82ab45c31
github.com/replicatedhq/kots v1.69.2-0.20220427202613-e7b5ac2fe43e
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
github.com/tommy351/gin-cors v0.0.0-20150617141853-dc91dec6313a
github.com/xeipuuv/gojsonschema v1.2.1-0.20200118195451-b537c054d4b4 // indirect
go.undefinedlabs.com/scopeagent v0.1.15
gopkg.in/DataDog/dd-trace-go.v1 v1.31.0
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.7.1
k8s.io/client-go v0.23.1
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/aws/aws-sdk-go v1.34.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
github.com/aws/aws-sdk-go v1.38.2/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go v1.38.45/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go v1.38.49 h1:E31vxjCe6a5I+mJLmUGaZobiWmg9KdWaud9IfceYeYQ=
github.com/aws/aws-sdk-go v1.38.49/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
Expand Down Expand Up @@ -282,9 +283,11 @@ github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
github.com/bugsnag/bugsnag-go v1.5.3/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
github.com/bugsnag/bugsnag-go v2.1.1+incompatible/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50=
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/bugsnag/panicwrap v1.3.2/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/bytecodealliance/wasmtime-go v0.30.0 h1:WfYpr4WdqInt8m5/HvYinf+HrSEAIhItKIcth+qb1h4=
github.com/bytecodealliance/wasmtime-go v0.30.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
github.com/c9s/goprocinfo v0.0.0-20170724085704-0010a05ce49f/go.mod h1:uEyr4WpAH4hio6LFriaPkL938XnrvLpNPmQHBdrmbIE=
Expand Down Expand Up @@ -1102,6 +1105,7 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22/go.mod h1:u0Jo4f2dNlTJeeOywkM6bLwxq6gC3pZ9rEFHn3AhTdk=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
Expand Down Expand Up @@ -1264,6 +1268,7 @@ github.com/mattn/go-shellwords v1.0.11/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lL
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
Expand Down Expand Up @@ -1573,6 +1578,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/replicatedcom/saaskit v0.0.0-20220404234806-42d82ab45c31 h1:omR7cHtAQ4f/8MelmsBvm2yYwr4dBXngvrIq2uD16Bg=
github.com/replicatedcom/saaskit v0.0.0-20220404234806-42d82ab45c31/go.mod h1:ae2LAb6COZAKb9oI4bgh52xrq17Ql4lqXfPXHZpGwPQ=
github.com/replicatedhq/kots v1.69.2-0.20220427202613-e7b5ac2fe43e h1:Z9InQR6BKsX85tWPu9laBhgn6cwRsYccJCQOwXG6u4g=
github.com/replicatedhq/kots v1.69.2-0.20220427202613-e7b5ac2fe43e/go.mod h1:V8kilzb9/V4ieJtyPnS81QBnTP9hxH/8TDqIPb1e+tU=
github.com/replicatedhq/kurl v0.0.0-20210414162418-8d6211901244 h1:aSORttMXeqRXgRnIS7kpRfR32c3MBkJGkZ6KoqWimhc=
Expand Down
13 changes: 4 additions & 9 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@ import (
"os"

"github.com/gin-gonic/gin"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
gintrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gin-gonic/gin"
"github.com/replicatedhq/kots-lint/pkg/version"
"github.com/replicatedcom/saaskit/tracing/datadog"
"github.com/replicatedhq/kots-lint/pkg/handlers"
log "github.com/sirupsen/logrus"
cors "github.com/tommy351/gin-cors"
)

// Run is the main entry point of the kots lint.
func Run() {
tracer.Start(
tracer.WithService("kots-lint"),
tracer.WithServiceVersion(version.GitSHA()),
tracer.WithAgentAddr("dd-agent.internal:8126"),
)
defer tracer.Stop()
datadog.StartTracer("kots-lint", version.GitSHA())
defer datadog.StopTracer()

debugMode := os.Getenv("DEBUG_MODE")
if debugMode != "on" {
Expand All @@ -32,7 +27,7 @@ func Run() {
SkipPaths: []string{"/livez"},
}),
gin.Recovery(),
gintrace.Middleware("kots-lint"),
datadog.GinMiddleware("kots-lint"),
)

r.RedirectTrailingSlash = false
Expand Down