-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2022aff
commit 95fc087
Showing
15 changed files
with
169 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM alpine:3.13.6 | ||
|
||
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories | ||
|
||
RUN set -eux && \ | ||
apk add tcpdump && \ | ||
apk add tzdata && \ | ||
apk add busybox-extras && \ | ||
apk add curl && \ | ||
apk add bash && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai" > /etc/timezone && \ | ||
date | ||
|
||
COPY consumer /root/consumer | ||
|
||
WORKDIR /root | ||
|
||
CMD ["/root/consumer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
global: | ||
serverConnector: | ||
addresses: | ||
- 119.91.66.223:8091 | ||
- 127.0.0.1:8091 | ||
statReporter: | ||
enable: true | ||
chain: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
data: | ||
polaris.yaml: |- | ||
global: | ||
serverConnector: | ||
addresses: | ||
- { PolarisServerIP:GrpcPort } | ||
kind: ConfigMap | ||
metadata: | ||
name: polaris-consumer-config | ||
namespace: examples-go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
data: | ||
polaris.yaml: |- | ||
global: | ||
serverConnector: | ||
addresses: | ||
- { PolarisServerIP:GrpcPort } | ||
kind: ConfigMap | ||
metadata: | ||
name: polaris-provider-config | ||
namespace: examples-go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: consumer | ||
namespace: examples-go | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: consumer | ||
template: | ||
metadata: | ||
labels: | ||
app: consumer | ||
spec: | ||
containers: | ||
- image: polarismesh/examples-go-consumer:latest | ||
imagePullPolicy: Always | ||
name: polaris-consumer | ||
resources: | ||
limits: | ||
cpu: "500m" | ||
memory: 1000Mi | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
volumeMounts: | ||
- mountPath: /root/polaris.yaml | ||
name: polaris-consumer-config | ||
subPath: polaris.yaml | ||
restartPolicy: Always | ||
volumes: | ||
- configMap: | ||
defaultMode: 420 | ||
name: polaris-consumer-config | ||
name: polaris-consumer-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: provider | ||
namespace: examples-go | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: provider | ||
template: | ||
metadata: | ||
labels: | ||
app: provider | ||
spec: | ||
containers: | ||
- image: polarismesh/examples-go-provider:latest | ||
imagePullPolicy: Always | ||
name: polaris-provider | ||
env: | ||
- name: INSTANCE_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP | ||
- name: INSTANCE_PORT | ||
value: "28080" | ||
- name: "INSTANCE_SERVICE" | ||
value: "DiscoverEchoServer" | ||
- name: "INSTANCE_NAMESPACE" | ||
value: "default" | ||
- name: "POLARIS_OPEN_API" | ||
value: "" | ||
- name: "POLARIS_TOKEN" | ||
value: "" | ||
resources: | ||
limits: | ||
cpu: "500m" | ||
memory: 1000Mi | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: ["/bin/bash", "-c", "cd /root; bash ./isolate.sh; sleep 30; exit 0;"] | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
volumeMounts: | ||
- mountPath: /root/polaris.yaml | ||
name: polaris-provider-config | ||
subPath: polaris.yaml | ||
restartPolicy: Always | ||
volumes: | ||
- configMap: | ||
defaultMode: 420 | ||
name: polaris-provider-config | ||
name: polaris-provider-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM alpine:3.13.6 | ||
|
||
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories | ||
|
||
RUN set -eux && \ | ||
apk add tcpdump && \ | ||
apk add tzdata && \ | ||
apk add busybox-extras && \ | ||
apk add curl && \ | ||
apk add bash && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai" > /etc/timezone && \ | ||
date | ||
|
||
COPY provider /root/provider | ||
COPY isolate.sh /root/isolate.sh | ||
|
||
WORKDIR /root | ||
|
||
CMD ["/root/provider", "-port", "28080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
data="[{\"service\":\"${INSTANCE_SERVICE}\",\"namespace\":\"${INSTANCE_NAMESPACE}\",\"host\":\"${INSTANCE_IP}\",\"port\":\"${INSTANCE_PORT}\",\"isolate\":true}]" | ||
echo "${data}" | ||
curl -H "X-Polaris-Token; ${POLARIS_TOKEN}" -H 'Content-Type: application/json' -X PUT -d "${data}" "http://${POLARIS_OPEN_API}/naming/v1/instances" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
global: | ||
serverConnector: | ||
addresses: | ||
- 119.91.66.223:8091 | ||
- 127.0.0.1:8091 | ||
statReporter: | ||
enable: true | ||
chain: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters