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

refactor: cleanup and move API #95

Merged
merged 88 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
55616be
refactor: mv api and metrics to dedicated packages
lvlcn-t Jan 14, 2024
6f759d9
chore: updated helm chart version to 0.0.4
niklastreml Jan 16, 2024
820cd55
chore: bump appVersion to v0.3.0
niklastreml Jan 17, 2024
da317cc
fix: incorrect formatting on empty labels
lvlcn-t Jan 17, 2024
02e06b5
refactor: remove any configurations
puffitos Jan 17, 2024
078de7c
chore: removed decode (RIP)
puffitos Jan 17, 2024
975e77f
fix: newline indent
lvlcn-t Jan 17, 2024
4a2d58f
chore: merged from main
puffitos Jan 17, 2024
68d066a
refactor: restructure checks pkg
puffitos Jan 17, 2024
761d7c4
fix: remove default runtime config in helm chart
niklastreml Jan 18, 2024
2fa7fb2
feat: simplify helm chart
niklastreml Jan 18, 2024
b9abd15
fix: remove -n
niklastreml Jan 18, 2024
8bb3f07
fix: register healthcheck for e2e test
niklastreml Jan 18, 2024
c8c764a
feat: separate checks and sparrow config
niklastreml Jan 18, 2024
8f0d564
fix: e2e tests
niklastreml Jan 18, 2024
551f07c
fix: bug where env variables would not be read correctly
niklastreml Jan 18, 2024
d81ad4a
feat: allow mounting extra secrets as env variables
niklastreml Jan 18, 2024
3f40604
Merge remote-tracking branch 'origin/feat/simplify-helm-chart-config'…
puffitos Jan 18, 2024
7fa28db
Merge remote-tracking branch 'origin' into refactor/typed-runtime-cfg
puffitos Jan 18, 2024
fc72395
Merge branch 'main' into chore/bump-chart-version
niklastreml Jan 18, 2024
2a1cb4c
Merge branch 'chore/bump-chart-version' into feat/simplify-helm-chart…
niklastreml Jan 18, 2024
0bd9674
chore: added helm docs
puffitos Jan 18, 2024
c6f0ca7
Merge branch 'feat/simplify-helm-chart-config' of github.com:caas-tea…
puffitos Jan 18, 2024
0c4042f
docs: envfromSecrets
niklastreml Jan 18, 2024
9339cdd
chore: merge from main
puffitos Jan 18, 2024
90988e7
Merge branch 'feat/simplify-helm-chart-config' into refactor/typed-ru…
puffitos Jan 18, 2024
3d0971f
fix: checks are properly configured on start
puffitos Jan 18, 2024
2f6333b
fix: target manager nil check when enriching
puffitos Jan 18, 2024
eb5fc0a
chore: merge from main
puffitos Jan 19, 2024
2742590
Merge remote-tracking branch 'origin/main' into refactor/typed-runtim…
puffitos Jan 23, 2024
5cc774f
feat: add dns check
lvlcn-t Jan 24, 2024
cc5e74c
chore: merged from main
puffitos Jan 24, 2024
a0a5a84
chore: updated docs of structs for more clarity
puffitos Jan 24, 2024
bae1f8e
feat: implement the rest of the dns check
lvlcn-t Jan 24, 2024
3f7ce94
feat: add dns check to check register
lvlcn-t Jan 24, 2024
0441d58
chore: licensing headers
lvlcn-t Jan 24, 2024
aa628e6
chore: mv route name to constant
lvlcn-t Jan 25, 2024
5434508
fix: retry on lookup failures
lvlcn-t Jan 25, 2024
dc0c6cd
feat: mv metrics to dedicated file
lvlcn-t Jan 25, 2024
89aa3a1
chore: adjust log messages
lvlcn-t Jan 25, 2024
e873397
test: add context cancelation test
lvlcn-t Jan 25, 2024
90b36ef
chore: rename test functions
lvlcn-t Jan 26, 2024
89dc498
chore: rm unused check handlers
lvlcn-t Jan 26, 2024
3367913
test: create ctx for each test
lvlcn-t Jan 26, 2024
1d3f671
fix: handle injected global targets
lvlcn-t Jan 26, 2024
d3928f0
chore: PR review
lvlcn-t Jan 26, 2024
2777514
Merge branch 'main' into feat/dns-check
lvlcn-t Jan 26, 2024
ecd5c24
test: add more set config test cases
lvlcn-t Jan 26, 2024
31a26d7
chore: merged from feat/dns-checks
puffitos Jan 27, 2024
adf8bfa
chore: added black magic back
puffitos Jan 27, 2024
53ce54f
[no ci] chore: remove binary from repo
puffitos Jan 27, 2024
f83241d
refactor: factory moved outside checks
puffitos Jan 27, 2024
b9f14c6
refactor: removed uneeded Checks field from check's configuration
puffitos Jan 27, 2024
9732fc3
chore: adapted helm chart to new checksconfig
puffitos Jan 27, 2024
0c8c779
docs: adjust metrics godocs
lvlcn-t Jan 27, 2024
0b84250
docs: add dns check
lvlcn-t Jan 27, 2024
69e0105
General cleanup:
puffitos Jan 27, 2024
99e1cb6
refactor: rm unused dynamic check handlers
lvlcn-t Jan 27, 2024
9717641
chore: rm dynamic routing tree
lvlcn-t Jan 27, 2024
e9b711f
Merge branch 'refactor/sparrow-api' into refactor/api
lvlcn-t Jan 27, 2024
5a7dacc
chore: merged from feat/dns-checks
puffitos Jan 27, 2024
b24fe36
fix: latency tests correct comparison, removed error string comparison
puffitos Jan 27, 2024
4f3a355
chore: renamed runtime cfg channel
puffitos Jan 27, 2024
8bda6ac
chore: fixed variable shadowing
puffitos Jan 27, 2024
c551e23
chore: godocs of tests corrected
puffitos Jan 27, 2024
fbdfc6d
fix: metrics route
lvlcn-t Jan 28, 2024
9bf603c
chore: licensing
lvlcn-t Jan 28, 2024
4670b16
test: add route registering tests
lvlcn-t Jan 28, 2024
2dc94fd
chore: add godocs and improve naming
lvlcn-t Jan 28, 2024
d1d1bdc
chore: embedded struct naming
lvlcn-t Jan 28, 2024
2251399
chore: merged from main
puffitos Jan 29, 2024
743d79b
Merge branch 'main' into refactor/api
lvlcn-t Jan 29, 2024
d91def5
feat: gitlab tm handles dns targets
puffitos Jan 29, 2024
97a376b
Merge branch 'refactor/typed-runtime-cfg' into refactor/api
lvlcn-t Jan 30, 2024
b6ffe0a
chore: mv metrics back to sparrow
lvlcn-t Jan 30, 2024
bed6004
fix: return error if no routes are registered
lvlcn-t Jan 30, 2024
7131a3e
test: add run api and gen check specs unittests
lvlcn-t Jan 30, 2024
2ff55bc
chore: correct metric name
lvlcn-t Jan 30, 2024
526eabd
Merge branch 'main' into refactor/api
lvlcn-t Feb 1, 2024
b364676
chore: revert viper bump
lvlcn-t Feb 1, 2024
b9a8b6a
chore: licensing
lvlcn-t Feb 1, 2024
42722b9
chore: extract api startup to dedicated method
lvlcn-t Feb 2, 2024
cd57f16
refactor: custom error type
lvlcn-t Feb 2, 2024
76aa330
chore: mv api config struct
lvlcn-t Feb 2, 2024
2c1b1ae
refactor: simplify route registering
lvlcn-t Feb 6, 2024
e5ee811
chore: simplify wildcard route registration
lvlcn-t Feb 7, 2024
f57aef5
Merge branch 'main' into refactor/api
lvlcn-t Feb 7, 2024
fbae36b
chore: add api moq
lvlcn-t Feb 8, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
--set sparrowConfig.name=the-sparrow.com \
--set sparrowConfig.loader.type=file \
--set sparrowConfig.loader.file.path=/config/.sparrow.yaml \
--set checksConfig.checks.health.interval=1s \
--set checksConfig.health.interval=1s \
./chart

- name: Check Pods
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ checks:
- Description: Count of DNS checks done
- Labelled with `target`

- `sparrow_dns_duration`
- `sparrow_dns_duration_seconds`
- Type: Gauge
- Description: Duration of DNS resolution attempts
- Labelled with `target`
Expand Down
2 changes: 1 addition & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A Helm chart to install Sparrow
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| checksConfig | object | `{"checks":{}}` | Check configuration of the Sparrow read on runtime see: https://github.com/caas-team/sparrow?tab=readme-ov-file#checks |
| checksConfig | object | `{}` | Check configuration of the Sparrow read on runtime see: https://github.com/caas-team/sparrow?tab=readme-ov-file#checks |
| env | object | `{}` | |
| envFromSecrets | list | `[]` | extra environment variables Allows you to set environment variables through secrets you defined outside of the helm chart Useful for sensitive information like the http loader token |
| extraArgs | object | `{}` | Extra command line start parameters see: https://github.com/caas-team/sparrow/blob/main/docs/sparrow_run.md |
Expand Down
58 changes: 28 additions & 30 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,36 +137,34 @@ sparrowConfig:

# -- Check configuration of the Sparrow read on runtime
# see: https://github.com/caas-team/sparrow?tab=readme-ov-file#checks
checksConfig:
checks: {}
# checks:
# health:
# interval: 15s
# timeout: 10s
# retry:
# count: 3
# delay: 1s
# targets:
# - "https://www.example.com/"
# - "https://www.google.com/"
# latency:
# interval: 15s
# timeout: 30s
# retry:
# count: 3
# delay: 2s
# targets:
# - https://example.com/
# - https://google.com/
# dns:
# interval: 10s
# timeout: 30s
# retry:
# count: 5
# delay: 1s
# targets:
# - www.example.com
# - www.google.com
checksConfig: {}
# health:
# interval: 15s
# timeout: 10s
# retry:
# count: 3
# delay: 1s
# targets:
# - "https://www.example.com/"
# - "https://www.google.com/"
# latency:
# interval: 15s
# timeout: 30s
# retry:
# count: 3
# delay: 2s
# targets:
# - https://example.com/
# - https://google.com/
# dns:
# interval: 10s
# timeout: 30s
# retry:
# count: 5
# delay: 1s
# targets:
# - www.example.com
# - www.google.com

# -- Configure a service monitor for prometheus-operator
serviceMonitor:
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewCmdRun() *cobra.Command {
// run is the entry point to start the sparrow
func run() func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) error {
cfg := config.NewConfig()
cfg := &config.Config{}
err := viper.Unmarshal(cfg)
if err != nil {
return fmt.Errorf("failed to parse config: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ require (
github.com/getkin/kin-openapi v0.120.0
github.com/go-chi/chi/v5 v5.0.10
github.com/jarcoal/httpmock v1.3.1
github.com/mitchellh/mapstructure v1.5.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -29,6 +28,7 @@ require (
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.18.0 h1:pN6W1ub/G4OfnM+NR9p7xP9R6TltLUzp5JG9yZD3Qg0=
github.com/spf13/viper v1.18.0/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
62 changes: 0 additions & 62 deletions internal/helper/decode.go

This file was deleted.

83 changes: 0 additions & 83 deletions internal/helper/decode_test.go

This file was deleted.

Loading
Loading