Skip to content

Commit 4e12bed

Browse files
committed
Add script to build code and container
Signed-off-by: Serguei Bezverkhi <[email protected]>
1 parent 71e2378 commit 4e12bed

File tree

4 files changed

+97
-3
lines changed

4 files changed

+97
-3
lines changed

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
REGISTRY_NAME?=docker.io/sbezverk
2+
IMAGE_VERSION?=0.0.0
3+
4+
.PHONY: all jalapeno-gateway container push clean test
5+
6+
ifdef V
7+
TESTARGS = -v -args -alsologtostderr -v 5
8+
else
9+
TESTARGS =
10+
endif
11+
12+
all: jalapeno-gateway
13+
14+
jalapeno-gateway:
15+
mkdir -p bin
16+
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -ldflags '-extldflags "-static"' -o ./bin/jalapeno-gateway ./cmd/gateway.go
17+
18+
container: jalapeno-gateway
19+
docker build -t $(REGISTRY_NAME)/jalapeno-gateway-debug:$(IMAGE_VERSION) -f ./build/Dockerfile.gateway .
20+
21+
push: container
22+
docker push $(REGISTRY_NAME)/jalapeno-gateway-debug:$(IMAGE_VERSION)
23+
24+
clean:
25+
rm -rf bin
26+
27+
test:
28+
GO111MODULE=on go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
29+
GO111MODULE=on go vet `go list ./... | grep -v vendor`

build/Dockerfile.gateway

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM scratch
2+
3+
COPY ./bin/jalapeno-gateway /jalapeno-gateway
4+
ENTRYPOINT ["/jalapeno-gateway"]

deployment/jalapeno-gateway.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
data:
4+
gateway-config.yaml: |
5+
metadata:
6+
name: jalapeno-gateway-config
7+
namespace: default
8+
---
9+
apiVersion: v1
10+
kind: Service
11+
spec:
12+
ports:
13+
- name: jalapeno-gateway
14+
port: 40040
15+
protocol: TCP
16+
targetPort: gateway-port
17+
selector:
18+
app: jalapeno-gateway
19+
type: ClusterIP
20+
externalIPs:
21+
- 192.168.80.104
22+
metadata:
23+
name: jalapeno-gateway
24+
namespace: default
25+
---
26+
apiVersion: apps/v1
27+
kind: Deployment
28+
metadata:
29+
name: jalapeno-gateway
30+
spec:
31+
replicas: 2
32+
selector:
33+
matchLabels:
34+
app: jalapeno-gateway
35+
template:
36+
metadata:
37+
labels:
38+
app: jalapeno-gateway
39+
spec:
40+
containers:
41+
- name: jalapeno-gateway
42+
image: 192.168.80.240:4000/jalapeno-gateway/jalapeno-gateway-debug:v0.0.0
43+
imagePullPolicy: Always
44+
ports:
45+
- containerPort: 40040
46+
name: gateway-port
47+
protocol: TCP
48+
volumeMounts:
49+
- name: config-volume
50+
mountPath: /config
51+
env:
52+
- name: GATEWAY_PORT
53+
value: "40040"
54+
55+
volumes:
56+
- name: config-volume
57+
configMap:
58+
name: jalapeno-gateway-config
59+
metadata:
60+
name: jalapeno-gateway
61+
namespace: default

pkg/dbclient/mock/dbmock.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ var (
1717
)
1818

1919
type dbMock struct {
20-
mu sync.Mutex
21-
qoe map[int32]*pbapi.Qoe
22-
vpnRD2AS map[uint32][]uint32
20+
mu sync.Mutex
21+
qoe map[int32]*pbapi.Qoe
22+
vpn map[pbapi.RouteDistinguisherType]map[uint32][]uint32
2323
}
2424

2525
// GetQoE is required method by DB interface, it takes requested QoE and searches through

0 commit comments

Comments
 (0)