Skip to content

Commit 4554d48

Browse files
authored
Make the openapi client a separate Go module (#1322)
This will allow Kubeflow Pipelines to use the Go client directly without needing to import all of Model Registry and inheriting its dependencies. This introduces the concept of a Go workspace to allow multiple Go modules to live in the same repo. Signed-off-by: mprahl <[email protected]>
1 parent 88dfddf commit 4554d48

File tree

8 files changed

+366
-8
lines changed

8 files changed

+366
-8
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ __debug*
1616
# Output of the go coverage tool, specifically when used with LiteIDE
1717
*.out
1818

19-
# Go workspace file
20-
go.work
21-
2219
# Idea files
2320
.idea
2421

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ ARG TARGETOS
44
ARG TARGETARCH
55

66
WORKDIR /workspace
7-
# Copy the Go Modules manifests
8-
COPY ["go.mod", "go.sum", "./"]
7+
# Copy the Go Modules manifests and workspace file
8+
COPY ["go.mod", "go.sum", "go.work", "./"]
9+
COPY ["pkg/openapi/go.mod", "pkg/openapi/"]
910
# cache deps before building and copying source so that we don't need to re-download as much
1011
# and so that source changes don't invalidate our downloaded layer
1112
RUN go mod download

Dockerfile.odh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
FROM registry.access.redhat.com/ubi9/go-toolset:1.24.4 AS builder
33

44
WORKDIR /workspace
5-
# Copy the Go Modules manifests
6-
COPY ["go.mod", "go.sum", "./"]
5+
# Copy the Go Modules manifests and workspace file
6+
COPY ["go.mod", "go.sum", "go.work", "./"]
7+
COPY ["pkg/openapi/go.mod", "pkg/openapi/"]
78
# cache deps before building and copying source so that we don't need to re-download as much
89
# and so that source changes don't invalidate our downloaded layer
910
RUN go mod download

cmd/csi/Dockerfile.csi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ ARG TARGETARCH
55

66
WORKDIR /workspace
77
# Copy the Go Modules manifests
8-
COPY ["go.mod", "go.sum", "./"]
8+
COPY ["go.mod", "go.sum", "go.work", "./"]
9+
COPY ["pkg/openapi/go.mod", "pkg/openapi/"]
910
# cache deps before building and copying source so that we don't need to re-download as much
1011
# and so that source changes don't invalidate our downloaded layer
1112
RUN go mod download

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/golang-migrate/migrate/v4 v4.18.3
1111
github.com/golang/glog v1.2.5
1212
github.com/kserve/kserve v0.15.2
13+
github.com/kubeflow/model-registry/pkg/openapi v0.0.0
1314
github.com/onsi/ginkgo v1.16.5
1415
github.com/onsi/ginkgo/v2 v2.23.4
1516
github.com/onsi/gomega v1.37.0
@@ -205,3 +206,5 @@ require (
205206
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect
206207
gopkg.in/yaml.v3 v3.0.1 // indirect
207208
)
209+
210+
replace github.com/kubeflow/model-registry/pkg/openapi => ./pkg/openapi

go.work

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
go 1.24.4
2+
3+
use (
4+
.
5+
./pkg/openapi
6+
)

go.work.sum

Lines changed: 346 additions & 0 deletions
Large diffs are not rendered by default.

pkg/openapi/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/kubeflow/model-registry/pkg/openapi
2+
3+
go 1.23

0 commit comments

Comments
 (0)