Skip to content

Commit 15c3aaa

Browse files
authored
feat: Support modifying mesh config files in all-in-one images (#157)
1 parent a77773c commit 15c3aaa

3 files changed

Lines changed: 53 additions & 8 deletions

File tree

all-in-one/Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,17 @@ COPY --from=grafana /usr/share/grafana /usr/share/grafana
6464
COPY --from=grafana /run.sh /usr/local/bin/grafana.sh
6565

6666
# Install supervisord, logrotate, cron and initialize related folders
67-
RUN apt-get update --allow-unauthenticated && \
67+
RUN arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
68+
apt-get update --allow-unauthenticated; \
6869
apt-get install --no-install-recommends -y --allow-unauthenticated \
69-
supervisor logrotate cron \
70-
&& apt-get upgrade -y --allow-unauthenticated \
71-
&& apt-get clean \
72-
&& rm -rf /var/log/*log /var/lib/apt/lists/* /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old \
73-
&& mkdir -p /var/log/higress \
74-
&& mkdir /data
70+
wget supervisor logrotate cron; \
71+
apt-get upgrade -y --allow-unauthenticated; \
72+
apt-get clean; \
73+
rm -rf /var/log/*log /var/lib/apt/lists/* /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old; \
74+
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$arch -O /usr/local/bin/yq && chmod +x /usr/local/bin/yq; \
75+
mkdir -p /var/log/higress; \
76+
mkdir /data;
77+
7578
COPY ./supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
7679

7780
# Initialize configurations

all-in-one/config/configmaps/higress-config.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,30 @@ data:
1818
routeTimeout: 0
1919
upstream:
2020
connectionBufferLimits: 10485760
21-
idleTimeout: 10
21+
idleTimeout: 10
22+
mesh: |-
23+
accessLogEncoding: TEXT
24+
accessLogFile: /dev/stdout
25+
accessLogFormat: |
26+
{"ai_log":"%FILTER_STATE(wasm.ai_log:PLAIN)%","authority":"%REQ(X-ENVOY-ORIGINAL-HOST?:AUTHORITY)%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","downstream_local_address":"%DOWNSTREAM_LOCAL_ADDRESS%","downstream_remote_address":"%DOWNSTREAM_REMOTE_ADDRESS%","duration":"%DURATION%","istio_policy_status":"%DYNAMIC_METADATA(istio.mixer:status)%","method":"%REQ(:METHOD)%","path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","protocol":"%PROTOCOL%","request_id":"%REQ(X-REQUEST-ID)%","requested_server_name":"%REQUESTED_SERVER_NAME%","response_code":"%RESPONSE_CODE%","response_flags":"%RESPONSE_FLAGS%","route_name":"%ROUTE_NAME%","start_time":"%START_TIME%","trace_id":"%REQ(X-B3-TRACEID)%","upstream_cluster":"%UPSTREAM_CLUSTER%","upstream_host":"%UPSTREAM_HOST%","upstream_local_address":"%UPSTREAM_LOCAL_ADDRESS%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_transport_failure_reason":"%UPSTREAM_TRANSPORT_FAILURE_REASON%","user_agent":"%REQ(USER-AGENT)%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","response_code_details":"%RESPONSE_CODE_DETAILS%"}
27+
configSources:
28+
- address: xds://127.0.0.1:15051
29+
- address: k8s://
30+
defaultConfig:
31+
disableAlpnH2: true
32+
discoveryAddress: 127.0.0.1:15012
33+
controlPlaneAuthPolicy: MUTUAL_TLS
34+
proxyStatsMatcher:
35+
inclusionRegexps:
36+
- .*
37+
dnsRefreshRate: 200s
38+
enableAutoMtls: false
39+
enablePrometheusMerge: true
40+
ingressControllerMode: "OFF"
41+
mseIngressGlobalConfig:
42+
enableH3: false
43+
enableProxyProtocol: false
44+
protocolDetectionTimeout: 100ms
45+
rootNamespace: higress-system
46+
trustDomain: cluster.local
47+
meshNetworks: 'networks: {}'

all-in-one/scripts/start-apiserver.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,20 @@ if [ -n "$CONFIG_TEMPLATE" ]; then
2222
fi
2323
fi
2424

25+
MESH_CONFIG_DIR='/etc/istio/config'
26+
mkdir -p $MESH_CONFIG_DIR
27+
HIGRESS_CONFIG_FILE="/data/configmaps/higress-config.yaml"
28+
MESH_CONFIG_FILES=$(yq '.data | keys | .[]' "$HIGRESS_CONFIG_FILE")
29+
if [ -z "$MESH_CONFIG_FILES" ]; then
30+
echo " Missing required files in higress-config ConfigMap."
31+
exit -1
32+
fi
33+
IFS=$'\n'
34+
for MESH_CONFIG_FILE in $MESH_CONFIG_FILES; do
35+
if [ -z "$MESH_CONFIG_FILE" -o "$MESH_CONFIG_FILE" == "higress" ]; then
36+
continue
37+
fi
38+
yq ".data.$MESH_CONFIG_FILE" "$HIGRESS_CONFIG_FILE" > "$MESH_CONFIG_DIR/$MESH_CONFIG_FILE"
39+
done
40+
2541
apiserver --bind-address 127.0.0.1 --secure-port 18443 --storage file --file-root-dir /data --cert-dir /tmp

0 commit comments

Comments
 (0)