Skip to content

Commit

Permalink
update makefile, hack, build and ci files
Browse files Browse the repository at this point in the history
Signed-off-by: Poorunga <2744323@qq.com>
  • Loading branch information
Poorunga committed Jul 23, 2021
1 parent c2dc762 commit 6bb289f
Show file tree
Hide file tree
Showing 17 changed files with 125 additions and 51 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

build:
runs-on: ubuntu-latest
timeout-minutes: 30
name: Build binary
steps:
- name: Install Go
Expand All @@ -65,6 +66,7 @@ jobs:

docker_build:
runs-on: ubuntu-latest
timeout-minutes: 30
name: Docker image build
steps:
- name: Install Go
Expand All @@ -82,4 +84,4 @@ jobs:
with:
fetch-depth: 0

- run: make images
- run: make agentimage
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@

GOPATH?=$(shell go env GOPATH)

# make binaries
BINARIES=edgemesh
# make all builds both agent and server binaries

BINARIES=edgemesh-agent \
edgemesh-server

COMPONENTS=agent \
server

.EXPORT_ALL_VARIABLES:
OUT_DIR ?= _output/local
Expand All @@ -33,8 +37,8 @@ define ALL_HELP_INFO
# make
# make all
# make all HELP=y
# make all WHAT=edgemesh
# make all WHAT=edgemesh GOLDFLAGS="" GOGCFLAGS="-N -l"
# make all WHAT=edgemesh-agent
# make all WHAT=edgemesh-agent GOLDFLAGS="" GOGCFLAGS="-N -l"
# Note: Specify GOLDFLAGS as an empty string for building unstripped binaries, specify GOGCFLAGS
# to "-N -l" to disable optimizations and inlining, this will be helpful when you want to
# use the debugging tools like delve. When GOLDFLAGS is unspecified, it defaults to "-s -w" which strips
Expand Down Expand Up @@ -111,10 +115,10 @@ clean:
endif


ARCH ?= amd64
IMAGE_TAG ?= $(shell git describe --tags)
GO_LDFLAGS='$(shell hack/make-rules/version.sh)'

.PHONY: images
images:
docker build --build-arg GO_LDFLAGS=${GO_LDFLAGS} -t kubeedge/edgemesh:${IMAGE_TAG} -f build/Dockerfile .

.PHONY: agentimage
agentimage:
docker build --build-arg GO_LDFLAGS=${GO_LDFLAGS} -t kubeedge/edgemesh-agent:${IMAGE_TAG} -f build/agent/Dockerfile .
8 changes: 4 additions & 4 deletions build/Dockerfile → build/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ RUN apk update && apk add gcc && \
WORKDIR /code
COPY . .

RUN CGO_ENABLED=1 go build -v -o /usr/local/bin/edgemesh -ldflags "$GO_LDFLAGS -w -s" \
./cmd/edgemesh/edgemesh.go
RUN CGO_ENABLED=1 go build -v -o /usr/local/bin/edgemesh-agent -ldflags "$GO_LDFLAGS -w -s" \
./agent/cmd/edgemesh-agent/agent.go


FROM alpine:3.11

RUN apk update && apk --no-cache add iptables

COPY --from=builder /usr/local/bin/edgemesh /usr/local/bin/edgemesh
COPY --from=builder /usr/local/bin/edgemesh-agent /usr/local/bin/edgemesh-agent

ENTRYPOINT ["edgemesh"]
ENTRYPOINT ["edgemesh-agent"]
48 changes: 48 additions & 0 deletions build/agent/kubernetes/edgemesh-agent/03-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: edgemesh-agent-cfg
namespace: kubeedge
labels:
k8s-app: kubeedge
kubeedge: edgemesh
data:
edgemesh.yaml: |
apiVersion: agent.edgemesh.config.kubeedge.io/v1alpha1
kind: EdgeMeshAgent
kubeAPIConfig:
burst: 200
contentType: application/vnd.kubernetes.protobuf
kubeConfig: ""
master: "http://127.0.0.1:10550"
qps: 100
goChassisConfig:
protocol:
tcpBufferSize: 8192
tcpClientTimeout: 5
tcpReconnectTimes: 3
loadBalancer:
defaultLBStrategy: RoundRobin
supportLBStrategies:
- RoundRobin
- Random
- ConsistentHash
consistentHash:
partitionCount: 100
replicationFactor: 10
load: 1.25
modules:
edgeDNS:
enable: true
listenInterface: docker0
listenPort: 53
edgeProxy:
enable: true
subNet: 10.10.0.0/16
listenInterface: docker0
listenPort: 40001
edgeGateway:
enable: false
nic: "*"
includeIP: "*"
excludeIP: "*"
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: edgemesh
name: edgemesh-agent
namespace: kubeedge
labels:
k8s-app: kubeedge
kubeedge: edgemesh
kubeedge: edgemesh-agent
spec:
selector:
matchLabels:
k8s-app: kubeedge
kubeedge: edgemesh
kubeedge: edgemesh-agent
template:
metadata:
labels:
k8s-app: kubeedge
kubeedge: edgemesh
kubeedge: edgemesh-agent
spec:
affinity:
nodeAffinity:
Expand All @@ -28,10 +28,10 @@ spec:
operator: Exists
hostNetwork: true
containers:
- name: edgemesh
- name: edgemesh-agent
securityContext:
privileged: true
image: poorunga/edgemesh:0.1
image: kubeedge/edgemesh-agent:latest
imagePullPolicy: IfNotPresent
resources:
limits:
Expand All @@ -48,7 +48,7 @@ spec:
volumes:
- name: conf
configMap:
name: edgemesh-cfg
name: edgemesh-agent-cfg
- name: resolv
hostPath:
path: /etc/resolv.conf
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions build/agent/kubernetes/edgemesh-gateway/03-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: edgemesh-gateway-cfg
namespace: kubeedge
labels:
k8s-app: kubeedge
kubeedge: edgemesh-gateway
data:
edgemesh.yaml: |
apiVersion: agent.edgemesh.config.kubeedge.io/v1alpha1
kind: EdgeMeshAgent
kubeAPIConfig:
burst: 200
contentType: application/vnd.kubernetes.protobuf
kubeConfig: ""
master: "http://127.0.0.1:10550"
qps: 100
goChassisConfig:
protocol:
tcpBufferSize: 8192
tcpClientTimeout: 5
tcpReconnectTimes: 3
loadBalancer:
defaultLBStrategy: RoundRobin
supportLBStrategies:
- RoundRobin
- Random
- ConsistentHash
consistentHash:
partitionCount: 100
replicationFactor: 10
load: 1.25
modules:
edgeDNS:
enable: false
listenInterface: docker0
listenPort: 53
edgeProxy:
enable: false
subNet: 10.10.0.0/16
listenInterface: docker0
listenPort: 40001
edgeGateway:
enable: true
nic: "*"
includeIP: "*"
excludeIP: "*"
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- name: edgemesh-gateway
securityContext:
privileged: true
image: poorunga/edgemesh:0.1
image: kubeedge/edgemesh-agent:latest
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions build/kubernetes/edgemesh-gateway/03-configmap.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions build/kubernetes/edgemesh/03-configmap.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ edgemesh::check::env() {
}

ALL_BINARIES_AND_TARGETS=(
edgemesh:cmd/edgemesh
edgemesh-agent:agent/cmd/edgemesh-agent
# edgemesh-server:server/cmd/edgemesh-server
)

edgemesh::golang::get_target_by_binary() {
Expand Down

0 comments on commit 6bb289f

Please sign in to comment.