Skip to content

Commit f67800b

Browse files
committed
reduce image size
Signed-off-by: Lei Wang <[email protected]>
1 parent 4b00884 commit f67800b

File tree

4 files changed

+112
-58
lines changed

4 files changed

+112
-58
lines changed

charts/gart/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ coordinator:
210210
tag: latest
211211
pullPolicy: IfNotPresent
212212
resources: {}
213-
containerPort: 8080
214-
port: 8080
213+
containerPort: 18080
214+
port: 18080
215215

216216
#gie frontend config
217217
gie_frontend:

coordinator/flex/server/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def main():
1212
arguments={'title': 'GraphScope FLEX HTTP SERVICE API'},
1313
pythonic_params=True)
1414

15-
app.run(port=8080)
15+
app.run(port=18080)
1616

1717

1818
if __name__ == '__main__':

k8s/dockerfiles/interactive.Dockerfile

Lines changed: 45 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ ENV PATH=$PATH:$GRAPHSCOPE_HOME/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GRAPHSCOPE
3131

3232
USER root
3333

34-
RUN apt-get update -y && \
35-
apt-get install -y sudo default-jdk tzdata python3-pip && \
36-
apt-get clean -y && \
37-
rm -rf /var/lib/apt/lists/*
38-
39-
RUN apt-get update -y && \
40-
apt-get install -y git build-essential cmake curl maven libssl-dev libclang-dev openmpi-bin libopenmpi-dev libprotobuf-dev protobuf-compiler-grpc && \
41-
apt-get clean -y && \
34+
RUN apt-get update && \
35+
apt-get install -y --no-install-recommends \
36+
sudo default-jdk tzdata python3-pip \
37+
git build-essential cmake curl maven \
38+
libssl-dev libclang-dev openmpi-bin libopenmpi-dev libprotobuf-dev protobuf-compiler-grpc \
39+
libgrpc-dev libgrpc++-dev libboost-all-dev && \
40+
apt-get clean && \
4241
rm -rf /var/lib/apt/lists/*
4342

44-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
4543
ENV PATH=/root/.cargo/bin:$PATH
4644

4745
RUN python3 -m pip install --no-cache-dir vineyard vineyard-io etcd3 --user
@@ -52,15 +50,6 @@ RUN mkdir -p /var/log/graphscope \
5250
&& chown -R graphscope:graphscope /var/log/graphscope
5351
RUN chmod a+wrx /tmp
5452

55-
# Install dependencies for etcd3
56-
RUN apt-get update && apt-get install -y \
57-
libgrpc-dev \
58-
libgrpc++-dev \
59-
libprotobuf-dev \
60-
protobuf-compiler-grpc \
61-
libboost-all-dev libssl-dev \
62-
&& rm -rf /var/lib/apt/lists/*
63-
6453
RUN git clone https://github.com/microsoft/cpprestsdk.git \
6554
&& cd cpprestsdk \
6655
&& mkdir -p build \
@@ -69,19 +58,17 @@ RUN git clone https://github.com/microsoft/cpprestsdk.git \
6958
&& make -j \
7059
&& make install \
7160
&& cd ../.. \
72-
&& rm -rf cpprestsdk
73-
74-
RUN git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
61+
&& rm -rf cpprestsdk \
62+
&& git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
7563
&& cd etcd-cpp-apiv3 \
7664
&& mkdir -p build \
7765
&& cd build \
7866
&& cmake .. \
7967
&& make -j \
8068
&& make install \
8169
&& cd ../.. \
82-
&& rm -rf etcd-cpp-apiv3
83-
84-
RUN git clone https://github.com/GraphScope/GART.git \
70+
&& rm -rf etcd-cpp-apiv3 \
71+
&& git clone https://github.com/GraphScope/GART.git \
8572
&& cd GART \
8673
&& git submodule update --init \
8774
&& cd interfaces/grin \
@@ -93,9 +80,19 @@ RUN git clone https://github.com/GraphScope/GART.git \
9380
&& rm -rf /home/graphscope/GART
9481

9582
WORKDIR /home/graphscope
96-
RUN git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope
97-
RUN cd /home/graphscope/GraphScope/interactive_engine/compiler && \
98-
make build
83+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
84+
&& git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope \
85+
&& cd /home/graphscope/GraphScope/interactive_engine/compiler \
86+
&& make build \
87+
&& rm -rf /home/graphscope/GraphScope/.git \
88+
&& rm -rf /home/graphscope/GraphScope/docs \
89+
&& rustup self uninstall -y \
90+
&& rm -rf /root/.rustup \
91+
&& rm -rf /root/.cargo \
92+
&& rm -rf /root/.m2 \
93+
&& rm -rf /usr/local/cargo/registry /usr/local/cargo/git \
94+
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/v6d/ \
95+
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/ir/target/release/deps
9996

10097
WORKDIR /home/graphscope
10198
RUN git clone https://github.com/GraphScope/GART.git
@@ -108,16 +105,11 @@ USER root
108105
ENV RUST_BACKTRACE=1
109106

110107
RUN apt-get update -y && \
111-
apt-get install -y python3-pip curl && \
112-
apt-get clean -y && \
113-
rm -rf /var/lib/apt/lists/*
108+
apt-get install -y python3-pip curl git \
109+
build-essential cmake libssl-dev libclang-dev openmpi-bin libopenmpi-dev \
110+
libgrpc-dev libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc libboost-all-dev && \
111+
apt-get clean -y && rm -rf /var/lib/apt/lists/*
114112

115-
RUN apt-get update -y && \
116-
apt-get install -y git build-essential cmake libssl-dev libclang-dev openmpi-bin libopenmpi-dev && \
117-
apt-get clean -y && \
118-
rm -rf /var/lib/apt/lists/*
119-
120-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
121113
ENV PATH=/root/.cargo/bin:$PATH
122114

123115
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
@@ -131,17 +123,7 @@ RUN chmod a+wrx /tmp /var/tmp
131123

132124
RUN python3 -m pip install --no-cache-dir vineyard vineyard-io flask --user
133125

134-
135-
136126
WORKDIR /home/graphscope
137-
# Install dependencies for etcd3
138-
RUN apt-get update && apt-get install -y \
139-
libgrpc-dev \
140-
libgrpc++-dev \
141-
libprotobuf-dev \
142-
protobuf-compiler-grpc \
143-
libboost-all-dev libssl-dev \
144-
&& rm -rf /var/lib/apt/lists/*
145127

146128
RUN git clone https://github.com/microsoft/cpprestsdk.git \
147129
&& cd cpprestsdk \
@@ -151,19 +133,17 @@ RUN git clone https://github.com/microsoft/cpprestsdk.git \
151133
&& make -j \
152134
&& make install \
153135
&& cd ../.. \
154-
&& rm -rf cpprestsdk
155-
156-
RUN git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
136+
&& rm -rf cpprestsdk \
137+
&& git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
157138
&& cd etcd-cpp-apiv3 \
158139
&& mkdir -p build \
159140
&& cd build \
160141
&& cmake .. \
161142
&& make -j \
162143
&& make install \
163144
&& cd ../.. \
164-
&& rm -rf etcd-cpp-apiv3
165-
166-
RUN git clone https://github.com/GraphScope/GART.git \
145+
&& rm -rf etcd-cpp-apiv3 \
146+
&& git clone https://github.com/GraphScope/GART.git \
167147
&& cd GART \
168148
&& git submodule update --init \
169149
&& cd interfaces/grin \
@@ -174,9 +154,19 @@ RUN git clone https://github.com/GraphScope/GART.git \
174154
&& cp ./libgart_grin.so /usr/local/lib/ \
175155
&& rm -rf /home/graphscope/GART
176156

177-
RUN git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope
178-
RUN cd /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart && \
179-
cargo build --release
157+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
158+
&& git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope \
159+
&& cd /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart \
160+
&& cargo build --release \
161+
&& rm -rf /home/graphscope/GraphScope/.git \
162+
&& rm -rf /home/graphscope/GraphScope/docs \
163+
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart/target/release/deps \
164+
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart/target/release/build \
165+
&& rustup self uninstall -y \
166+
&& rm -rf /root/.rustup \
167+
&& rm -rf /root/.cargo \
168+
&& rm -rf /root/.m2 \
169+
&& rm -rf /usr/local/cargo/registry /usr/local/cargo/git
180170

181171
WORKDIR /home/graphscope
182172
RUN git clone https://github.com/GraphScope/GART.git

scripts/update_ip_tables.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
# Function to get the node port for a service
4+
get_node_port() {
5+
kubectl get service "$1" -o=jsonpath='{.spec.ports[0].nodePort}' -n "$2"
6+
}
7+
8+
# Function to get the Kubernetes API server IP
9+
get_kubernetes_api_ip() {
10+
kubectl get endpoints kubernetes -o jsonpath='{.subsets[0].addresses[0].ip}'
11+
}
12+
13+
# Function to clean up existing iptables rules
14+
cleanup_iptables() {
15+
echo "Killing existing socat processes..."
16+
sudo pkill socat
17+
}
18+
19+
# Function to update iptables rules for a service
20+
update_iptables() {
21+
SERVICE_NAME="$1"
22+
SOURCE_IP="$2"
23+
SOURCE_PORT="$3"
24+
NAME_SPACE="$4"
25+
K8S_API_IP="$5"
26+
27+
echo "Updating iptables rules for $SERVICE_NAME (Source IP: $SOURCE_IP, Port: $SOURCE_PORT)"
28+
29+
NODE_PORT=$(get_node_port "$SERVICE_NAME" "$NAME_SPACE")
30+
31+
if [ -z "$NODE_PORT" ]; then
32+
echo "Error: Could not get node port for service $SERVICE_NAME"
33+
return 1
34+
fi
35+
36+
sudo socat TCP-LISTEN:${SOURCE_PORT},bind=${SOURCE_IP},fork TCP:${K8S_API_IP}:${NODE_PORT} &
37+
38+
echo "Updated iptables rules for $SERVICE_NAME (Node Port: $NODE_PORT)"
39+
}
40+
41+
# Main execution
42+
echo "Starting iptables update process..."
43+
44+
K8S_API_IP=$(get_kubernetes_api_ip)
45+
if [ -z "$K8S_API_IP" ]; then
46+
echo "Error: Could not determine Kubernetes API server IP"
47+
exit 1
48+
fi
49+
echo "Kubernetes API server IP: $K8S_API_IP"
50+
51+
cleanup_iptables
52+
53+
# Update rules for each service
54+
if ! update_iptables gart-release-coordinator-service 0.0.0.0 18080 gart "$K8S_API_IP"; then
55+
echo "Failed to update iptables for gart-release-coordinator-service"
56+
fi
57+
58+
if ! update_iptables gart-release-gie-frontend-service 0.0.0.0 8182 gart "$K8S_API_IP"; then
59+
echo "Failed to update iptables for gart-release-gie-frontend-service"
60+
fi
61+
62+
echo "iptables update process completed."
63+
64+
echo "Script execution completed."

0 commit comments

Comments
 (0)