Skip to content

Commit

Permalink
[GEN-2202] chore: remove legacy UI (#2166)
Browse files Browse the repository at this point in the history
This pull request includes several changes to remove legacy UI support
and clean up the codebase by eliminating unused endpoints and
simplifying port forwarding logic.

Removal of legacy UI support:

*
[`cli/cmd/resources/ui.go`](diffhunk://#diff-c286e10d34710a80a59127b2b7951e8a33d9b9554e47d2f2b827fd690f2e53abL294-L297):
Removed the `legacy-ui` service port configuration.
*
[`cli/cmd/ui.go`](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L30):
Removed the `legacyDefaultPort` constant and the `legacy` flag, along
with related logic in the `uiCmd` command and `portForwardWithContext`
function.
[[1]](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L30)
[[2]](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L53-R68)
[[3]](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L105-R98)
[[4]](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L125-R124)
[[5]](diffhunk://#diff-bdc4ded2bf4628241563326d5d7b0443b57d2d37b674014da632b14b78a1c309L166)

Codebase cleanup:

*
[`frontend/endpoints/actions/addclusterinfo.go`](diffhunk://#diff-2511ff6b0207be71c468fe4db60383a73916c601569ffab4a8d8c5fd4239cfe4L1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/deleteattribute.go`](diffhunk://#diff-49a0cab95629d2f31106f0c5c680ba1869a869056891fc1ff3ffa38dcfa24b0aL1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/errorsampler.go`](diffhunk://#diff-f32702baf96e453e785f64f70b4a45ed7737c02ceafda4040857913346535f7dL1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/latencysampler.go`](diffhunk://#diff-2944e5e6b3cef1f8eb014039f84e631d0295261d7a7b58c363853d96f40efd27L1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/piimasking.go`](diffhunk://#diff-5237331aa79450347f690543e17d591f6ceed64ba695ee494923a620fe8a8f69L1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/probabilisticsampler.go`](diffhunk://#diff-fce0eecf69a969d92d0969a4e573aae16a4e6d6e2068d2cd32842fa08a66b077L1-L100):
Removed the entire file, including all related endpoint functions.
*
[`frontend/endpoints/actions/renameattribute.go`](diffhunk://#diff-6f1323b82e4cc29761964dda9d21d8973f564c77fe9bfb64b2258ab9e425ff8cL1-L100):
Removed the entire file, including all related endpoint functions.

Dockerfile update:

*
[`frontend/Dockerfile`](diffhunk://#diff-ea60ef29f6f537c1c83468c00b60de28f86e06edfe4a3d91274723c6f298fdb8L16):
Removed the `COPY --from=builder /webapp/dep-out
frontend/webapp/dep-out` line.

---------

Co-authored-by: alonkeyval <[email protected]>
  • Loading branch information
alonkeyval and alonbraymok authored Jan 9, 2025
1 parent fefc0f1 commit c5409cd
Show file tree
Hide file tree
Showing 139 changed files with 32 additions and 5,372 deletions.
4 changes: 0 additions & 4 deletions cli/cmd/resources/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ func NewUIService(ns string) *corev1.Service {
Name: "ui",
Port: 3000,
},
{
Name: "legacy-ui",
Port: 3001,
},
{
Name: "otlp",
Port: consts.OTLPPort,
Expand Down
22 changes: 7 additions & 15 deletions cli/cmd/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import (
)

const (
defaultPort = 3000
legacyDefaultPort = 3001
defaultPort = 3000
)

// uiCmd represents the ui command
Expand All @@ -50,29 +49,23 @@ var uiCmd = &cobra.Command{
}
}

legacyFlag, _ := cmd.Flags().GetBool("legacy")
localPort := cmd.Flag("port").Value.String()
clusterPort := defaultPort

if legacyFlag {
clusterPort = legacyDefaultPort
}

localAddress := cmd.Flag("address").Value.String()

uiPod, err := findOdigosUIPod(client, ctx, ns)
if err != nil {
fmt.Printf("\033[31mERROR\033[0m Cannot find odigos-ui pod: %s\n", err)
os.Exit(1)
}

if err := portForwardWithContext(ctx, uiPod, client, localPort, localAddress, clusterPort); err != nil {
if err := portForwardWithContext(ctx, uiPod, client, localPort, localAddress); err != nil {
fmt.Printf("\033[31mERROR\033[0m Cannot start port-forward: %s\n", err)
os.Exit(1)
}
},
}

func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube.Client, localPort string, localAddress string, clusterPort int) error {
func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube.Client, localPort string, localAddress string) error {
stopChannel := make(chan struct{}, 1)
readyChannel := make(chan struct{})
signals := make(chan os.Signal, 1)
Expand Down Expand Up @@ -102,7 +95,7 @@ func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube
Name(uiPod.Name).
SubResource("portforward")

return forwardPorts("POST", req.URL(), client.Config, stopChannel, readyChannel, localPort, localAddress, clusterPort)
return forwardPorts("POST", req.URL(), client.Config, stopChannel, readyChannel, localPort, localAddress)
}

func createDialer(method string, url *url.URL, cfg *rest.Config) (httpstream.Dialer, error) {
Expand All @@ -122,13 +115,13 @@ func createDialer(method string, url *url.URL, cfg *rest.Config) (httpstream.Dia
return dialer, nil
}

func forwardPorts(method string, url *url.URL, cfg *rest.Config, stopCh chan struct{}, readyCh chan struct{}, localPort string, localAddress string, clusterPort int) error {
func forwardPorts(method string, url *url.URL, cfg *rest.Config, stopCh chan struct{}, readyCh chan struct{}, localPort string, localAddress string) error {
dialer, err := createDialer(method, url, cfg)
if err != nil {
return err
}

port := fmt.Sprintf("%s:%d", localPort, clusterPort)
port := fmt.Sprintf("%s:%d", localPort, defaultPort)
fw, err := portforward.NewOnAddresses(dialer,
[]string{localAddress},
[]string{port}, stopCh, readyCh, nil, os.Stderr)
Expand Down Expand Up @@ -163,5 +156,4 @@ func init() {
rootCmd.AddCommand(uiCmd)
uiCmd.Flags().Int("port", defaultPort, "Port to listen on")
uiCmd.Flags().String("address", "localhost", "Address to listen on")
uiCmd.Flags().Bool("legacy", false, "Use the legacy UI port")
}
11 changes: 0 additions & 11 deletions docs/quickstart/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,3 @@ odigos ui
```

By default, Odigos UI is available at http://localhost:3000.

## Using the Legacy UI

```bash
odigos ui --legacy
```

<Warning>
The new UI is the default experience. The legacy UI remains available for
users who prefer the previous version.
</Warning>
1 change: 0 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ FROM --platform=$BUILDPLATFORM golang:1.23 AS backend
WORKDIR /app
COPY . .
COPY --from=builder /webapp/out frontend/webapp/out
COPY --from=builder /webapp/dep-out frontend/webapp/dep-out
WORKDIR /app/frontend
ARG TARGETARCH
RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o odigos-ui
Expand Down
100 changes: 0 additions & 100 deletions frontend/endpoints/actions/addclusterinfo.go

This file was deleted.

100 changes: 0 additions & 100 deletions frontend/endpoints/actions/deleteattribute.go

This file was deleted.

Loading

0 comments on commit c5409cd

Please sign in to comment.