Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clients/ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ ARG BFF_SOURCE_CODE
ARG TARGETOS
ARG TARGETARCH

WORKDIR /usr/src/app
COPY ../../pkg/openapi /usr/src/app/pkg/openapi

WORKDIR /usr/src/app/clients/ui/bff

# Copy the Go Modules manifests
COPY ${BFF_SOURCE_CODE}/go.mod ${BFF_SOURCE_CODE}/go.sum ./
Expand All @@ -45,7 +47,7 @@ COPY ${BFF_SOURCE_CODE}/cmd/ cmd/
COPY ${BFF_SOURCE_CODE}/internal/ internal/

# Build the Go application
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o bff ./cmd
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o /usr/src/app/bff ./cmd

# Final stage
# Use distroless as minimal base image to package the application binary
Expand Down
6 changes: 4 additions & 2 deletions clients/ui/Dockerfile.standalone
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ ARG BFF_SOURCE_CODE
ARG TARGETOS
ARG TARGETARCH

WORKDIR /usr/src/app
COPY ../../pkg/openapi /usr/src/app/pkg/openapi

WORKDIR /usr/src/app/clients/ui/bff

# Copy the Go Modules manifests
COPY ${BFF_SOURCE_CODE}/go.mod ${BFF_SOURCE_CODE}/go.sum ./
Expand All @@ -45,7 +47,7 @@ COPY ${BFF_SOURCE_CODE}/cmd/ cmd/
COPY ${BFF_SOURCE_CODE}/internal/ internal/

# Build the Go application
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o bff ./cmd
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o /usr/src/app/bff ./cmd

# Install setup-envtest and download K8s binaries for mock mode
RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.19
Expand Down
4 changes: 3 additions & 1 deletion clients/ui/bff/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/brianvoe/gofakeit/v7 v7.14.1
github.com/google/uuid v1.6.0
github.com/julienschmidt/httprouter v1.3.0
github.com/kubeflow/model-registry/pkg/openapi v0.3.2
github.com/kubeflow/hub/pkg/openapi v0.0.0
github.com/onsi/ginkgo/v2 v2.28.2
github.com/onsi/gomega v1.39.0
github.com/rs/cors v1.11.1
Expand Down Expand Up @@ -75,3 +75,5 @@ require (
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)

replace github.com/kubeflow/hub/pkg/openapi => ../../../pkg/openapi
2 changes: 0 additions & 2 deletions clients/ui/bff/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubeflow/model-registry/pkg/openapi v0.3.2 h1:t/H+zxHiwcPGUITG/fWHUrTrJwoi9IlVa7vmzZI1eZk=
github.com/kubeflow/model-registry/pkg/openapi v0.3.2/go.mod h1:0V0wF5hGlLDSNS+on0MTnEOFiubfVYNc7QhuthKBu+8=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/api/artifacts_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"

"github.com/julienschmidt/httprouter"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/constants"
"github.com/kubeflow/model-registry/pkg/openapi"
)

type ArtifactListEnvelope Envelope[*openapi.ArtifactList, None]
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/api/model_artifacts_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"

"github.com/julienschmidt/httprouter"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/constants"
"github.com/kubeflow/model-registry/pkg/openapi"
)

type ModelArtifactUpdateEnvelope Envelope[*openapi.ModelArtifactUpdate, None]
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/api/model_versions_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/constants"
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"
"github.com/kubeflow/hub/ui/bff/internal/validation"
"github.com/kubeflow/model-registry/pkg/openapi"
)

type ModelVersionEnvelope Envelope[*openapi.ModelVersion, None]
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/api/model_versions_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"net/http"

"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/integrations/kubernetes"
"github.com/kubeflow/hub/ui/bff/internal/mocks"
"github.com/kubeflow/model-registry/pkg/openapi"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/api/registered_models_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/constants"
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"
"github.com/kubeflow/hub/ui/bff/internal/validation"
"github.com/kubeflow/model-registry/pkg/openapi"
)

type RegisteredModelEnvelope Envelope[*openapi.RegisteredModel, None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"net/http"

"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/integrations/kubernetes"
"github.com/kubeflow/hub/ui/bff/internal/mocks"
"github.com/kubeflow/model-registry/pkg/openapi"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"

"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/stretchr/testify/mock"
)

Expand Down
12 changes: 5 additions & 7 deletions clients/ui/bff/internal/mocks/static_data_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/brianvoe/gofakeit/v7"
"github.com/google/uuid"
"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/constants"
"github.com/kubeflow/hub/ui/bff/internal/models"
"github.com/kubeflow/model-registry/pkg/openapi"
)

func GetRegisteredModelMocks() []openapi.RegisteredModel {
Expand Down Expand Up @@ -184,8 +184,8 @@ func GetModelArtifactListMock() openapi.ModelArtifactList {
}
}

func newCustomProperties() *map[string]openapi.MetadataValue {
result := map[string]openapi.MetadataValue{
func newCustomProperties() map[string]openapi.MetadataValue {
return map[string]openapi.MetadataValue{
"tensorflow": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: "",
Expand Down Expand Up @@ -223,8 +223,6 @@ func newCustomProperties() *map[string]openapi.MetadataValue {
},
},
}

return &result
}

func catalogCustomProperties() *map[string]openapi.MetadataValue {
Expand Down Expand Up @@ -1047,7 +1045,7 @@ func GetCatalogLabelListMock() models.CatalogLabelList {
func GetCatalogModelArtifactMock() []models.CatalogArtifact {
architecturesJSON, _ := json.Marshal([]string{"amd64", "arm64", "s390x", "ppc64le"})
customProps := newCustomProperties()
(*customProps)["architecture"] = openapi.MetadataValue{
customProps["architecture"] = openapi.MetadataValue{
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: string(architecturesJSON),
MetadataType: "MetadataStringValue",
Expand All @@ -1060,7 +1058,7 @@ func GetCatalogModelArtifactMock() []models.CatalogArtifact {
Uri: stringToPointer("oci://registry.sample.io/repo1/modelcar-granite-7b-starter:1.4.0"),
CreateTimeSinceEpoch: stringToPointer("1693526400000"),
LastUpdateTimeSinceEpoch: stringToPointer("1704067200000"),
CustomProperties: customProps,
CustomProperties: &customProps,
},
}
}
Expand Down
8 changes: 4 additions & 4 deletions clients/ui/bff/internal/mocks/types_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"

"github.com/brianvoe/gofakeit/v7"
"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

func GenerateMockRegisteredModelList() openapi.RegisteredModelList {
Expand All @@ -26,7 +26,7 @@ func GenerateMockRegisteredModelList() openapi.RegisteredModelList {

func GenerateMockRegisteredModel() openapi.RegisteredModel {
model := openapi.RegisteredModel{
CustomProperties: &map[string]openapi.MetadataValue{
CustomProperties: map[string]openapi.MetadataValue{
"example_key": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: gofakeit.Sentence(3),
Expand All @@ -48,7 +48,7 @@ func GenerateMockRegisteredModel() openapi.RegisteredModel {

func GenerateMockModelVersion() openapi.ModelVersion {
model := openapi.ModelVersion{
CustomProperties: &map[string]openapi.MetadataValue{
CustomProperties: map[string]openapi.MetadataValue{
"example_key": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: gofakeit.Sentence(3),
Expand Down Expand Up @@ -87,7 +87,7 @@ func GenerateMockModelVersionList() openapi.ModelVersionList {
func GenerateMockModelArtifact() openapi.ModelArtifact {
artifact := openapi.ModelArtifact{
ArtifactType: stringToPointer("model-artifact"),
CustomProperties: &map[string]openapi.MetadataValue{
CustomProperties: map[string]openapi.MetadataValue{
"example_key": {
MetadataStringValue: &openapi.MetadataStringValue{
StringValue: gofakeit.Sentence(3),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

type CatalogModelArtifact struct {
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/models/catalog_model_list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

type CatalogModel struct {
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/models/mcp_server_catalog.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package models

import "github.com/kubeflow/model-registry/pkg/openapi"
import "github.com/kubeflow/hub/pkg/openapi"

type McpDeploymentMode string

Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/repositories/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"

"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

const artifactPath = "/artifacts"
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/repositories/model_artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"

"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

const modelArtifactPath = "/model_artifacts"
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/repositories/model_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"net/url"

"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"
"github.com/kubeflow/model-registry/pkg/openapi"
)

const modelVersionPath = "/model_versions"
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/repositories/registered_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"net/url"

"github.com/kubeflow/hub/pkg/openapi"
"github.com/kubeflow/hub/ui/bff/internal/integrations/httpclient"
"github.com/kubeflow/model-registry/pkg/openapi"
)

const registeredModelPath = "/registered_models"
Expand Down
2 changes: 1 addition & 1 deletion clients/ui/bff/internal/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package validation
import (
"errors"

"github.com/kubeflow/model-registry/pkg/openapi"
"github.com/kubeflow/hub/pkg/openapi"
)

func ValidateRegisteredModel(input openapi.RegisteredModel) error {
Expand Down
3 changes: 2 additions & 1 deletion clients/ui/bff/internal/validation/validation_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package validation

import (
"github.com/kubeflow/model-registry/pkg/openapi"
"testing"

"github.com/kubeflow/hub/pkg/openapi"
)

func TestValidateRegisteredModel(t *testing.T) {
Expand Down
Loading