-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make PrometheusProviderRegistry fully injectable (#6592)
* Stop using source code in build file Signed-off-by: Sebastian Malton <[email protected]> * Add new injectable version of binaryName Signed-off-by: Sebastian Malton <[email protected]> * Add new NormalizedPlatform type Signed-off-by: Sebastian Malton <[email protected]> * Switch legacy execHelm to use legacy global DI for binaryPath Signed-off-by: Sebastian Malton <[email protected]> * Remove dead code Signed-off-by: Sebastian Malton <[email protected]> * Introduce injectable for kube auth proxy certs Signed-off-by: Sebastian Malton <[email protected]> * Introduce injectable forms of PrometheusProviders - Remove class requirement - Make everything injectable Signed-off-by: Sebastian Malton <[email protected]> * Update tests to not use private functions Signed-off-by: Sebastian Malton <[email protected]> * Cleanup creating binary names and paths Signed-off-by: Sebastian Malton <[email protected]> Signed-off-by: Sebastian Malton <[email protected]>
- Loading branch information
Showing
32 changed files
with
600 additions
and
647 deletions.
There are no files selected for viewing
This file contains 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 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,24 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable"; | ||
import normalizedPlatformInjectable from "../vars/normalized-platform.injectable"; | ||
|
||
const binaryNameInjectable = getInjectable({ | ||
id: "binary-name", | ||
instantiate: (di, binaryName) => { | ||
const normalizedPlatform = di.inject(normalizedPlatformInjectable); | ||
|
||
if (normalizedPlatform === "windows") { | ||
return `${binaryName}.exe`; | ||
} | ||
|
||
return binaryName; | ||
}, | ||
lifecycle: lifecycleEnum.keyedSingleton({ | ||
getInstanceKey: (di, binaryName: string) => binaryName, | ||
}), | ||
}); | ||
|
||
export default binaryNameInjectable; |
This file contains 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,24 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable"; | ||
import joinPathsInjectable from "../path/join-paths.injectable"; | ||
import baseBundledBinariesDirectoryInjectable from "../vars/base-bundled-binaries-dir.injectable"; | ||
import binaryNameInjectable from "./binary-name.injectable"; | ||
|
||
const bundledBinaryPathInjectable = getInjectable({ | ||
id: "bundled-binary-path", | ||
instantiate: (di, name) => { | ||
const joinPaths = di.inject(joinPathsInjectable); | ||
const binaryName = di.inject(binaryNameInjectable, name); | ||
const baseBundledBinariesDirectory = di.inject(baseBundledBinariesDirectoryInjectable); | ||
|
||
return joinPaths(baseBundledBinariesDirectory, binaryName); | ||
}, | ||
lifecycle: lifecycleEnum.keyedSingleton({ | ||
getInstanceKey: (di, binaryName: string) => binaryName, | ||
}), | ||
}); | ||
|
||
export default bundledBinaryPathInjectable; |
This file was deleted.
Oops, something went wrong.
This file contains 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 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.