-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Remove module dependency cycle between Thanos and Cortex #3832
Comments
Another idea is to add to go.mod of cortex and thanos:
|
This what we have done in Prometheus. I am wondering if all of this is yet another fallout of Prometheus removing the vendor/ directory. |
An exclude block like that is good for when you want to do Once you pick up a transitive dependency on |
Actually, it looks like there were changes made to the exclude directives in go 1.16: https://groups.google.com/g/golang-nuts/c/FAO6x5AhfPg/m/-Z5baPnLBQAJ That might be enough for now... I'll do some tests. |
Discussion during contributor hours:
|
who owns github.com/corthanos ? ;) |
👋🏽 @vatin could you check if the method above helps? @abursavich are you unblocked? Would be nice to fix it anyway (: There is a new way btw in Go to retract certain versions: https://golang.org/ref/mod#go-mod-file-retract but I think it does not help much here I would not try to reset deps before Go1.17. Reasons: In that version all non-go modules Go packages will be blocked, so there will be lot's of fixing anyway. (: |
@bwplotka For my specific use-case, I would prefer having "something that works directly from upstream" (this all basically ends up feeding into a Go build farm that extracts statistics from packages, see https://github.com/vatine/gochecker/ for details, and in the reports/ subdir for painfully many details). From my POV, it'd be easier to throw away the stats I have collected so far and simply not feed in Thanos as a "seed package") than trying to retrofit a "rewrite the go.mod for specific module-versions" framework into the existing builder. |
Yeah, with go 1.16 I can just use excludes. |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Closing for now as promised, let us know if you need this to be reopened! 🤗 |
This is about reseting the cycle, but ideally we can track removing cycle at all here 🤗 As discussed here: |
AC:
Motivation:
|
Go 1.17 might help, so worth to check the upgrade process with this Go version |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
I believe this is still unresolved |
After recent developments concerning Cortex licensing, I think this has now more importance on the long run. |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Following up here from a Slack conversation with @bwplotka (cc: @pracucci)...
Summary of the issue
An old version of Prometheus pulled in
k8s.io/client-go@v12.0.0+incompatible
.An old version of Alertmanager pulled in that version of Prometheus.
An old version of Cortex pulled in that version of Alertmanager.
An old version of Thanos pulled in that version of Cortex
A newer version of Cortex pulled in that version of Thanos
A newer version of Thanos pulled in that version of Cortex
...
A newer version of Cortex pulled in that version of Thanos
A newer version of Thanos pulled in that version of Cortex
A recent version of Cortex pulled in that version of Thanos
A recent version of Thanos pulled in that version of Cortex
Newer versions of Prometheus have moved to
k8s.io/client-go@v0.20.2
.Newer versions of Alertmanager have removed the dependency on Prometheus.
Newer versions of Cortex have moved to newer versions of Alertmanager.
Newer versions of Thanos have moved to newer versions of Cortex.
Newer versions of Cortex have moved to newer versions of Thanos.
Kubernetes releases predate go modules and historical tags do not conform to go module standards.
Go treats
k8s.io/client-go@v12.0.0+incompatible
as newer thank8s.io/client-go@v0.20.2
.The cycle between Thanos and Cortex keeps their oldest history together alive in the dependency graph.
If you depend on Thanos or Cortex, then you get stuck with
k8s.io/client-go@v12.0.0+incompatible
and must use replace directives if you need to use a newer version such ask8s.io/client-go@v0.20.2
.Solution A
Go doesn't allow dependency cycles in packages, so there must not be any. Thanos and Cortex could work together to break the module cycle my extracting shared packages into separate modules.
This is theoretically the better option, but I don't know how much work would be involved and it may add a significant maintenance burden.
Solution B
Thanos and Cortex could work together to reset the cycle in their dependency graph. The cycle would continue to exist, but the historical dependencies would be dropped. This is probably the quicker fix and the other solution may still be undertaken in the future if desired.
Here's how this could work, which I've tested with dummy modules:
Step 1
go.mod
file. At this commit, Thanos won't build properly.go.mod
file. At this commit, Cortex won't build properly.Step 2
github.com/cortexproject/cortex@Y
. Thanos will now build properly.github.com/thanos-io/thanos@X
. Cortex will now build properly.Step 3
The text was updated successfully, but these errors were encountered: