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

feat/target-manager-shutdown #51

Merged
merged 5 commits into from
Dec 29, 2023
Merged

feat/target-manager-shutdown #51

merged 5 commits into from
Dec 29, 2023

Conversation

puffitos
Copy link
Collaborator

@puffitos puffitos commented Dec 20, 2023

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
⚠️ Review after #50 ⚠️
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

Motivation

Last thing to do for #30 is to make sure a sparrow tries to unregister itself if shutdown.

Changes

  • Implemented the shutdown procedure for the target manager
  • removed a whole lot of panics which stopped the sparrow from shutting down properly

For additional information look at the commits.

Tests done

  • New unittests
  • E2E test with a main context with a short timeout, to test a cancelled timeout, which would trigger the shutdown functions.

E2E Tests with shutdown

Logs:

/home/bbressi/.cache/JetBrains/GoLand2023.3/tmp/GoLand/___remote_check_config run --config ./.tmp/sparrow.yaml --tmconfig ./.tmp/tmconfig.yaml
Using config file: ./.tmp/sparrow.yaml
{"time":"2023-12-20T10:32:11.534374502+01:00","level":"INFO","msg":"Running sparrow"}
{"time":"2023-12-20T10:32:11.534568139+01:00","level":"INFO","msg":"Serving Api","sparrow":{"api":{"addr":":8080"}}}
{"time":"2023-12-20T10:32:11.534818472+01:00","level":"INFO","msg":"Starting global gitlabTargetManager reconciler"}
{"time":"2023-12-20T10:32:11.731858215+01:00","level":"INFO","msg":"Successfully got remote runtime configuration"}
{"time":"2023-12-20T10:32:11.732110322+01:00","level":"INFO","msg":"Next health check will run after delay","sparrow":{"health":{"delay":"15s"}}}
{"time":"2023-12-20T10:32:11.732130862+01:00","level":"INFO","msg":"Using latency check interval of 1s"}
{"time":"2023-12-20T10:32:15.734814109+01:00","level":"ERROR","msg":"Error while checking latency","sparrow":{"latency":{"url":"https://example.com/","error":"Get \"https://example.com/\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}}}
{"time":"2023-12-20T10:32:21.907126231+01:00","level":"INFO","msg":"Successfully got remote runtime configuration"}
{"time":"2023-12-20T10:32:22.264007233+01:00","level":"INFO","msg":"Successfully fetched all target files","sparrow":{"files":5}}
{"time":"2023-12-20T10:32:26.732242622+01:00","level":"INFO","msg":"Start health check run"}
{"time":"2023-12-20T10:32:27.057723806+01:00","level":"INFO","msg":"Successfully finished health check run"}
{"time":"2023-12-20T10:32:27.057812073+01:00","level":"INFO","msg":"Next health check will run after delay","sparrow":{"health":{"delay":"15s"}}}
{"time":"2023-12-20T10:32:31.534570567+01:00","level":"ERROR","msg":"Failed to run check","sparrow":{"name":"health","error":"context deadline exceeded"}}
{"time":"2023-12-20T10:32:31.534621303+01:00","level":"ERROR","msg":"Failed to serve api","sparrow":{"api":{"error":"http: Server closed"}}}
{"time":"2023-12-20T10:32:31.534655838+01:00","level":"ERROR","msg":"Context canceled","sparrow":{"latency":{"err":"context deadline exceeded"}}}
{"time":"2023-12-20T10:32:31.53466717+01:00","level":"ERROR","msg":"Failed to run check","sparrow":{"name":"latency","error":"context deadline exceeded"}}
{"time":"2023-12-20T10:32:31.534657161+01:00","level":"ERROR","msg":"Api context canceled","sparrow":{"api":{"error":"context deadline exceeded"}}}
{"time":"2023-12-20T10:32:31.534668852+01:00","level":"ERROR","msg":"Context canceled","sparrow":{"error":"context deadline exceeded"}}
{"time":"2023-12-20T10:32:31.534689552+01:00","level":"ERROR","msg":"Error running api server","sparrow":{"error":"api context canceled: context deadline exceeded"}}
{"time":"2023-12-20T10:32:32.31158724+01:00","level":"INFO","msg":"Stopping reconcile routine"}
{"time":"2023-12-20T10:32:32.311657082+01:00","level":"ERROR","msg":"Error while running sparrow","error":"context deadline exceeded"}
{"time":"2023-12-20T10:32:32.311709943+01:00","level":"INFO","msg":"Ending Reconcile routine"}

Process finished with the exit code 1

Long history of tests can be seen in the commits of the registration repository as well:

https://gitlab.devops.telekom.de/caas/sparrow/registration/-/commits/main

image

TODO

  • I've assigned this PR to myself
  • I've labeled this PR correctly

@puffitos puffitos added the request/internal Indicates an internal feature request label Dec 20, 2023
@puffitos puffitos self-assigned this Dec 20, 2023
Copy link
Member

@y-eight y-eight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please merge main to branch

Copy link
Member

@y-eight y-eight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@puffitos puffitos requested a review from lvlcn-t December 28, 2023 17:00
@puffitos puffitos linked an issue Dec 28, 2023 that may be closed by this pull request
1 task
@puffitos puffitos added this to the 0.2.0 milestone Dec 28, 2023
Copy link
Collaborator

@lvlcn-t lvlcn-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@puffitos puffitos merged commit 831d522 into main Dec 29, 2023
7 checks passed
@lvlcn-t lvlcn-t deleted the feat/target-manager-shutdown branch December 29, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request/internal Indicates an internal feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Automatic Central Registration of Instances
3 participants