-
Notifications
You must be signed in to change notification settings - Fork 333
WPB-24072 mount galley.yaml into background-worker #5180
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
Open
battermann
wants to merge
15
commits into
develop
Choose a base branch
from
WPB-24072-wire-meeting-delete-endpoint-prep
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f5f92d5
mount galley.yaml into background-worker
battermann c3db036
moved Galley.Options to wire-subsystems
battermann 946a818
use galley options in background-worker
battermann f5dfd4e
update usages in galley and patch the local integration setup
battermann 14d1cd6
clean up all files, do it finally
battermann 7679f9b
also mount the galley secrets into background-worker
battermann a95e399
remove redundancy
battermann 6f0fea7
changelog
battermann 79e9b9d
Update changelog.d/0-release-notes/WPB-24072
battermann 5b99943
remove background workers own tlsCaSecretRef
battermann 966a476
remove duplicat existance check
battermann 1ec5034
re enabled postgres pool settings
battermann 31bb4e0
dedup
battermann a8906f9
removed redundant secret
battermann abb3833
list redundant configs in release note
battermann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| `background-worker` now reuses `galley`'s configmap and secrets for cassandra, postgres and federation domain settings. This removes redundant settings and keeps the two services aligned. No operator action is strictly required, however we advice to remove the value overrides of the `background-worker` for galley's cassandra, postgres, and the federation domain as they are duplicate an no longer needed. | ||
|
battermann marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -439,23 +439,27 @@ processColors = | |
|
|
||
| data ServiceInstance = ServiceInstance | ||
| { handle :: ProcessHandle, | ||
| config :: FilePath | ||
| configs :: [FilePath] | ||
| } | ||
|
|
||
| timeout :: Int -> IO a -> IO (Maybe a) | ||
| timeout usecs action = either (const Nothing) Just <$> race (threadDelay usecs) action | ||
|
|
||
| cleanupService :: (HasCallStack) => ServiceInstance -> IO () | ||
| cleanupService inst = do | ||
| mPid <- getPid inst.handle | ||
| for_ mPid (signalProcess keyboardSignal) | ||
| timeout 50000 (waitForProcess inst.handle) >>= \case | ||
| Just _ -> pure () | ||
| Nothing -> do | ||
| for_ mPid (signalProcess killProcess) | ||
| void $ waitForProcess inst.handle | ||
| whenM (doesFileExist inst.config) $ removeFile inst.config | ||
| whenM (doesDirectoryExist inst.config) $ removeDirectoryRecursive inst.config | ||
| cleanupService inst = stopProcesses `E.finally` cleanupPaths | ||
| where | ||
| stopProcesses = do | ||
| mPid <- getPid inst.handle | ||
| for_ mPid (signalProcess keyboardSignal) | ||
| timeout 50000 (waitForProcess inst.handle) >>= \case | ||
| Just _ -> pure () | ||
| Nothing -> do | ||
| for_ mPid (signalProcess killProcess) | ||
| void $ waitForProcess inst.handle | ||
| cleanupPaths = | ||
| for_ inst.configs $ \path -> do | ||
| whenM (doesFileExist path) $ removeFile path | ||
| whenM (doesDirectoryExist path) $ removeDirectoryRecursive path | ||
|
|
||
| -- | Wait for a service to come up. | ||
| waitUntilServiceIsUp :: (HasCallStack) => Maybe ProcessDebug -> String -> Service -> App () | ||
|
|
@@ -501,10 +505,23 @@ withProcess resource overrides service = do | |
| phRef <- liftIO $ newIORef Nothing | ||
|
|
||
| getConfig <- lift $ readAndUpdateConfig overrides resource service | ||
| getGalleyConf <- lift $ readAndUpdateConfig overrides resource Galley | ||
| let prefix = "[" <> execName <> "@" <> domain <> maybe "" (":" <>) env.currentTestName <> "] " | ||
| let initProcess = case (service, cwd) of | ||
| (Nginz, Nothing) -> startNginzK8s domain sm | ||
| (Nginz, Just _) -> startNginzLocalIO | ||
| (BackgroundWorker, _) -> do | ||
| config <- getConfig | ||
| galleyConf <- getGalleyConf | ||
| tempFile <- writeTempFile "/tmp" (execName <> "-" <> domain <> "-" <> ".yaml") (cs $ Yaml.encode config) | ||
| galleyConfTemp <- writeTempFile "/tmp" (configName Galley <> "-" <> domain <> "-" <> ".yaml") (cs $ Yaml.encode galleyConf) | ||
| let params = ["-c", tempFile, "--galley-config-file", galleyConfTemp] | ||
| (_, Just stdoutHdl, Just stderrHdl, ph) <- createProcess (proc exe params) {cwd = cwd, std_out = CreatePipe, std_err = CreatePipe} | ||
| let colorize = fromMaybe id (lookup execName processColors) | ||
| void $ forkIO $ logToConsoleDebug (Just stdOut) colorize prefix stdoutHdl | ||
| void $ forkIO $ logToConsoleDebug (Just stdErr) colorize prefix stderrHdl | ||
| liftIO $ writeIORef phRef (Just ph) | ||
| pure $ ServiceInstance ph [tempFile, galleyConfTemp] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if it makes sense to write the config once before these processes start and then just use those configs as needed. Also it'd be nice to dedup this code. |
||
| _ -> do | ||
| config <- getConfig | ||
| tempFile <- writeTempFile "/tmp" (execName <> "-" <> domain <> "-" <> ".yaml") (cs $ Yaml.encode config) | ||
|
|
@@ -513,7 +530,7 @@ withProcess resource overrides service = do | |
| void $ forkIO $ logToConsoleDebug (Just stdOut) colorize prefix stdoutHdl | ||
| void $ forkIO $ logToConsoleDebug (Just stdErr) colorize prefix stderrHdl | ||
| liftIO $ writeIORef phRef (Just ph) | ||
| pure $ ServiceInstance ph tempFile | ||
| pure $ ServiceInstance ph [tempFile] | ||
|
|
||
| void $ | ||
| hoistCodensity $ | ||
|
|
@@ -600,7 +617,7 @@ startNginzK8s domain sm = do | |
| Text.writeFile nginxConfFile $ replaceUpstreamsInConfig conf' sm | ||
|
|
||
| ph <- startNginz domain nginxConfFile "/" | ||
| pure $ ServiceInstance ph tmpDir | ||
| pure $ ServiceInstance ph [tmpDir] | ||
|
|
||
| startNginzLocal :: BackendResource -> App ServiceInstance | ||
| startNginzLocal resource = do | ||
|
|
@@ -665,7 +682,7 @@ startNginzLocal resource = do | |
| ph <- liftIO $ startNginz domain nginxConfFile tmpDir | ||
|
|
||
| -- return handle and nginx tmp dir path | ||
| pure $ ServiceInstance ph tmpDir | ||
| pure $ ServiceInstance ph [tmpDir] | ||
|
|
||
| makeUpstreamsCfgs :: ServiceMap -> String | ||
| makeUpstreamsCfgs sm = | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.