Skip to content
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

Separate UI #1469

Merged
merged 9 commits into from Feb 23, 2022
Merged

Separate UI #1469

merged 9 commits into from Feb 23, 2022

Conversation

SamLR
Copy link
Contributor

@SamLR SamLR commented Feb 17, 2022

What changed?

Remove the ui run command and replace with a separate server binary

Why?

  • This reduces the size of the main gitops binary (as it no longer needs to embed the UI).
  • This is a more intuitive configuration, it is clear which portions of code do what.
  • This increases security by removing capabilities from the binary which will be deployed to clusters.
  • This will simplify testing by removing the requirements to work around the CLI when testing the server and visa-versa.

How did you test it?

The binaries build and successfully host the UI/operate on the CLI.

Release notes

This is a breaking change that removes the ui run command (the ui command has been replaced with a placeholder that can be extended to help access the ui).

Main questions/decisions to focus on for review

I've mostly left the Go code intact as I'm not so confident there and it feels like more of that will be wanted by the observability folks.

This means the focus of a lot of this has been around dockerfiles and the makefile. The later especially as the next bit of work I have is to tidy it up further. To that end I have some questions about how comfortable folks are with various usages of makefiles:

  • Am I breaking something by merging the cmd/gitops/ui/run/dist/, cmd/gitops/ui/run/dist/index.html and cmd/gitops/ui/run/dist/index.js targets?
  • Should I use implicit targets (bin/%: cmd/%/main.go) to reduce repetition or are they more overhead than is worth it?
  • Are folks happy with the pattern of using variables to change the behaviour of makefile targets (this:
_docker:
  docker build $(ARGS) -f $(FILE)

docker-gitops: FILE:=gitops.dockerfile
docker-gitops: _docker

docker-gitops-server: FILE:=gitops-server.dockerfile
docker-gitops-server: ARGS:=--build-arg "SOME_FLAG=foo"
docker-gitops-server: _docker

COPY Makefile /app/
COPY tools /app/tools
WORKDIR /app
RUN make dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to add make dependencies here? This is the one that starts using sudo inside your container.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@SamLR SamLR force-pushed the separate-ui branch 3 times, most recently from 92e81ee to 69e7db2 Compare February 18, 2022 17:46
Sam Cook added 8 commits February 21, 2022 12:03
This will be moved to a standalone binary
We want to remove the `ui run` command and create a separate binary
which will run the gitops ui. This (very brutishly) copies the existing
ui run code over the gitops-server code to be used as a separate binary.

The gitops-server is being over-written as it was apparently created as
a convenience for developing the UI. As part of this work that should
become obsolete as a pattern and be replaced by the actual UI binary
To separate out the UI components from the cli tool we need to update
the makefile to generate the dist/ui files in the `gitops-server` rather
than `gitops` directories.

This additionally changes to using a pattern-rule target to generate the
go binaries so that the same command can be used shared.
The `ui` command will display information on how to access the gitops
server and/or establish port-forwarding for it. This placeholder
preserves this extension point
We will need a docker image of the server component in order to deploy
it to k8s. It's less clear that a docker image of the cli component is
needed but is likely useful in some circumstances (e.g. local testing
without installation).

This creates two docker files, one for the cli and another for the
server.
Main change is the removal of browser and isatty becoming indirect.
This may be removed soon but until then it's needed for the cli tool to
run
@SamLR
Copy link
Contributor Author

SamLR commented Feb 22, 2022

@JamWils @katya-makarevich @dlopro not sure who else I should ask to review this

@SamLR SamLR mentioned this pull request Feb 23, 2022
Copy link
Contributor

@luizbafilho luizbafilho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a very minor comment, LGTM

cmd/gitops-server/cmd/cmd.go Outdated Show resolved Hide resolved
@SamLR SamLR marked this pull request as ready for review February 23, 2022 13:17
@SamLR SamLR merged commit 904eb3e into v2 Feb 23, 2022
@SamLR SamLR deleted the separate-ui branch February 23, 2022 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants