-
Notifications
You must be signed in to change notification settings - Fork 515
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
Opencost Core Refactor #2440
Opencost Core Refactor #2440
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@bolt given everything is moving right now and this move is bound to break people, it seems like now would be a good time to remove the name kubecost from the pkg name. What do you think? |
Not to say it should be this PR necessarily but flagging that both should land in the same release to prevent a double move for external users |
c7932dc
to
000010a
Compare
* Add ReadLocked and WriteLocked to fileutil Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Use locking r/w in FileStorage This is necessary as we plan to use multiple processes with this library accessing files on the same filesystem. Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Add FD-based flock()-ed read and write Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Move file lock code to separate file Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Make locks unimplemented for Windows This should allow Windows users to still import Opencost but functionality which requires these functions will not work. This should have minimal impact. Refer to the following when wishing to implement for windows: - https://github.com/golang/go/blob/master/src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go - maybe also https://github.com/gofrs/flock/blob/master/flock_windows.go Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Unlock after failed read and write Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Add further unit test Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> * Make r/w locked robust to FD position Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> --------- Signed-off-by: Michael Dresser <michaelmdresser@gmail.com> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
… First pass at unifying filters Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Sachin Kumar <sachin@rafay.co> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Sachin Kumar <sachin@rafay.co> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Sachin Kumar <sachin@rafay.co> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Sachin Kumar <sachin@rafay.co> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Niko Kovacevic <nikovacevic@gmail.com> Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
017dd62
to
67fdc24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the 2 comments it looks like a global find and replace.
Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 15 New issues |
Major Changes
This refactor is focusing on a few main concerns revolving around filters, legacy filters, and unification around the current implementation. It separates an easier to consume module for external projects which reference opencost for the models and/or utilities.
Opencost Core Module
Created a new go module under the
core/
directory which will now contain sharable opencost code:core
core
env
are moved tocore
Filter Unification
core/pkg/filter
-- legacy filtering support will temporarily be supported during this process undercore/pkg/filter/legacy
Require Answers
go.mod
was created for the module:github.com/opencost/opencost/core
and the opencostgo.mod
uses:to ensure that both modules are still "versioned" together. However, it's unclear if this method of replacement is the correct convention for long term maintenance.