Skip to content

Commit

Permalink
Cleanup and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
costinm committed Feb 29, 2024
1 parent 789def6 commit 90c9765
Show file tree
Hide file tree
Showing 341 changed files with 11,234 additions and 88,369 deletions.
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:0-1-bullseye",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go"
},
"extensions": [
"k--kato.intellij-idea-keybindings"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/dhoeric/features/k9s:1": {},
"ghcr.io/guiyomh/features/goreleaser:0": {}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 0 additions & 4 deletions .ko.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .run/go-ugate.run.xml

This file was deleted.

14 changes: 7 additions & 7 deletions .run/ugate-alice.run.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ugate-alice" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="dmesh" />
<working_directory value="$PROJECT_DIR$/../ugate/cmd/ugate/testdata/alice" />
<go_parameters value="-tags gvisor" />
<module name="ugate-ws" />
<working_directory value="$PROJECT_DIR$/ugate/testdata/alice" />
<go_parameters value="-tags lwip" />
<envs>
<env name="xGODEBUG" value="http2debug=2" />
<env name="GVISOR" value="dmesh0" />
<env name="GVISOR" value="tuntest" />
</envs>
<kind value="DIRECTORY" />
<package value="github.com/costinm/ugate/cmd/ugate" />
<directory value="$PROJECT_DIR$/../ugate/cmd/ugate/" />
<kind value="PACKAGE" />
<package value="github.com/costinm/ugate/cmd/ugated" />
<directory value="github.com/costinm/ugate/cmd/ugated" />
<filePath value="$PROJECT_DIR$/../ugate/cmd/ugate/ugate.go" />
<method v="2" />
</configuration>
Expand Down
10 changes: 5 additions & 5 deletions .run/ugate-bob.run.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ugate-bob" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="dmesh" />
<working_directory value="$PROJECT_DIR$/../ugate/cmd/ugate/testdata/bob" />
<go_parameters value="-tags lwip" />
<module name="ugate-ws" />
<working_directory value="$PROJECT_DIR$/ugate/testdata/bob" />
<go_parameters value="-tags gvisor" />
<envs>
<env name="xGODEBUG" value="http2debug=2" />
<env name="LWIP" value="dmesh1" />
<env name="GVISOR" value="dmesh0" />
</envs>
<kind value="DIRECTORY" />
<package value="github.com/costinm/ugate/cmd/ugate" />
<directory value="$PROJECT_DIR$/../ugate/cmd/ugate/" />
<directory value="$PROJECT_DIR$/ugate/cmd/ugated" />
<filePath value="$PROJECT_DIR$/../ugate/cmd/ugate/ugate.go" />
<method v="2" />
</configuration>
Expand Down
14 changes: 0 additions & 14 deletions .run/ugate-carol.run.xml

This file was deleted.

1 change: 0 additions & 1 deletion .run/ugate-gate.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ugate-gate" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="dmesh" />
<working_directory value="$PROJECT_DIR$/../ugate/cmd/ugate/testdata/gate" />
<envs>
<env name="xGODEBUG" value="http2debug=2" />
Expand Down
14 changes: 0 additions & 14 deletions .run/ugate-s1.run.xml

This file was deleted.

12 changes: 12 additions & 0 deletions .run/ugate.run.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration />
<configuration default="false" name="ugate" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="ugate-ws" />
<working_directory value="$PROJECT_DIR$/ugate/cmd/ugated" />
<envs>
<env name="XGODEBUG" value="http2debug=2" />
</envs>
<kind value="PACKAGE" />
<package value="github.com/costinm/ugate/cmd/ugated" />
<directory value="github.com/costinm/ugate/cmd/ugated" />
<filePath value="$PROJECT_DIR$/cmd/ugate/ugate.go" />
<method v="2" />
</configuration>
</component>
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "make",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
59 changes: 47 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
OUT=${ROOT_DIR}/out
OUT=${ROOT_DIR}/../out/ugate

#IMAGE ?= gcr.io/dmeshgate/ugate
REPO ?= ghcr.io/costinm/ugate
Expand All @@ -14,21 +14,43 @@ deploy: deploy/cloudrun deploy/helm

deploy/cloudrun: docker push/ugate run/cloudrun


deploy/helm: docker push/ugate run/helm

docker:
docker build -t ${IMAGE}:latest .

docker/dev:
#docker pull golang:latest
docker build -t ${IMAGE}-dev:latest -f tools/dev/Dockerfile tools/dev
docker build -t ${IMAGE}-dev:latest -f tools/dev/Dockerfile.devbase \
tools/dev

docker/dev-istio:
#docker pull gcr.io/istio-testing/build-tools:master-latest
docker build -t ${IMAGE}-dev-istio:latest -f tools/dev/Dockerfile.istio-dev \
tools/dev
docker push ${IMAGE}-dev-istio:latest

push/dev:
docker push ${IMAGE}-dev:latest

run/dev:
docker run -it --entrypoint /bin/bash gcr.io/dmeshgate/ugate-dev:latest

docker/devui:
#docker pull golang:latest
docker build -t ${IMAGE}-dev:cinamon-latest -f tools/dev/Dockerfile.cinamon tools/dev

push/devui:
docker push ${IMAGE}-dev:cinamon-latest

run/devui:
docker run -it \
--entrypoint /bin/bash \
--rm --name dev \
-p 18080:8080 -p 32000:22000 -p 8444:8444 \
-v /x/sync/dmesh-src/ugate-ws:/work \
${IMAGE}-dev:cinamon-latest

run/docker-image:
docker run -P -v /ws/dmesh-src/work/s1:/var/lib/istio \
-v ${ROOT_DIR}:/ws \
Expand Down Expand Up @@ -74,11 +96,11 @@ fw/kiali:
# Build with docker: 26 sec
# Both use skaffold
# Faster than docker.
push/ko:
(cd cmd/ugate && ko publish . --bare)

deps/ko:
go install github.com/google/ko@latest
#push/ko:
# (cd cmd/ugate && ko publish . --bare)
#
#deps/ko:
# go install github.com/google/ko@latest

# Run ugate in cloudrun.
# Storage: Env variables, GCP resources (buckets,secrets,k8s)
Expand Down Expand Up @@ -138,10 +160,6 @@ test/iptables:
iptables-save |grep ISTIO > ${OUT}/iptables_443_5201.out
diff ${OUT}/iptables_443_5201.out cmd/ugate/testdata/iptables/iptables_443_5201.out

okteto:
# curl https://get.okteto.com -sSfL | sh
okteto up

HOSTS=c1 home

## For debug
Expand All @@ -166,15 +184,32 @@ update:

deps:
go install github.com/bufbuild/buf/cmd/buf@latest
go install istio.io/tools/cmd/protoc-gen-docs@latest
go install istio.io/tools/cmd/protoc-gen-crds@latest

go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest
go install github.com/mikefarah/yq/v4@latest

# debug tool for std grpc - need http/tcp equivalent
go install -v github.com/grpc-ecosystem/grpcdebug@latest
# Test tool
go install github.com/bojand/ghz/cmd/ghz@latest
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin

go install github.com/knusbaum/go9p/cmd/mount9p@latest
go install github.com/knusbaum/go9p/cmd/export9p@latest
go install github.com/knusbaum/go9p/cmd/import9p@latest



proto-gen: PATH:=${HOME}/go/bin:${PATH}
proto-gen:
cd proto && buf generate


# Other options:
# GOEXPERIMENT=boringcrypto and "-tags boringcrypto"
Loading

0 comments on commit 90c9765

Please sign in to comment.