Allow Periscope to run on Windows nodes #167
Merged
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.
(Finally) addresses #10. Some notes:
nodeSelector
andvolumes
property are at the DaemonSet level, not container level.CheckSupported
method to all collectors. The initial purpose of this was to check the OS type, but is intentionally generic to allow checking any contextual information (e.g. environment variables).RunCommandOnHost
cannot be run on Windows (Windows does not support privileged mode).cat
to get file contents also could not run on Windows.RunCommandOnHost
andcat
, and so required a completely different approach.cat
was replaced by host volume mapping and standard OS file reading (the volume mappings were already set up, so thecat
s were unnecessary anyway).CheckSupported
method.runtime.GOOS
.RuntimeInfo
type into collectors, which would contain the OS identifier.RuntimeInfo
, making it easier to see what variables are being used, and removing the need to set env vars in test classes.KnownFilePaths
type was added for carrying these around. As well as making file system usage more obvious and explicit, this allows a single type to be injected into collectors for more flexible testing.FileContentReader
interface into collectors, which could be substituted for a fake in-memory file content map.FileContentReader
implementation is now moved out ofhelper.go
into its own file, with unit tests. Unfortunately this made the coverage checker include theutils
package, dramatically lowering overall test coverage, so I had to add an override to exclude it again.aks-periscope.go
file involved conditionally adding collectors depending on environment variables. This kind of checking was a good fit for theCheckSupported
method of the collectors themselves, and was moved there instead. This means (a) the main file is simplified, and (b) this logic is now completely covered by unit tests.