Skip to content

Commit

Permalink
Remove podman network causing outbound latency (#3865)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennerv authored and tsatam committed Sep 26, 2024
1 parent 44bc3cc commit 2db96a6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 58 deletions.
2 changes: 1 addition & 1 deletion pkg/deploy/assets/gateway-production.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions pkg/deploy/generator/scripts/gatewayVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ main() {
dnf_install_pkgs install_pkgs \
retry_wait_time \
"$pkg_retry_count"

fips_configure

# TODO remove this once MicrosoftCBLMariner:cbl-mariner:cbl-mariner-2-gen2-fips supports automatic updates
Expand All @@ -73,13 +73,6 @@ main() {

pull_container_images aro_images

local -r aro_network="aro"
# shellcheck disable=SC2034
local -rA networks=(
["$aro_network"]="192.168.254.0/24"
)
create_podman_networks networks

# shellcheck disable=SC2034
local -ra enable_ports=(
# RP gateway
Expand Down Expand Up @@ -129,7 +122,6 @@ RPIMAGE='$rpimage'"
["gateway_config"]="aro_gateway_conf_file"
["fluentbit"]="fluentbit_conf_file"
["mdsd"]="mdsd_config_version"
["network"]="aro_network"
)

configure_vmss_aro_services role_gateway \
Expand Down
2 changes: 0 additions & 2 deletions pkg/deploy/generator/scripts/rpVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ main() {
local -rA networks=(
["$aro_network"]="192.168.254.0/24"
)
create_podman_networks networks

# shellcheck disable=SC2034
local -ra enable_ports=(
# RP frontend
Expand Down
29 changes: 6 additions & 23 deletions pkg/deploy/generator/scripts/util-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ enable_services() {
# 1) image - nameref, string; container image
# 2) role - nameref, string; VMSS role
# 3) conf_file - nameref, string; aro gateway environment file
# 4) network - nameref, string; podman network name to be attached
configure_service_aro_gateway() {
local -n image="$1"
local -n role="$2"
local -n conf_file="$3"
local -n network="$4"
log "starting"
log "Configuring aro-gateway service"

Expand Down Expand Up @@ -61,7 +59,6 @@ ExecStart=/usr/bin/podman run \
-e MDM_ACCOUNT \
-e MDM_NAMESPACE \
-m 2g \
--network=$network \
-p 80:8080 \
-p 8081:8081 \
-p 443:8443 \
Expand All @@ -87,12 +84,10 @@ WantedBy=multi-user.target
# 1) image - nameref, string; RP container image
# 2) role - nameref, string; VMSS role
# 3) conf_file - nameref, string; aro rp environment file
# 4) network - nameref, string; podman network name to be attached
configure_service_aro_rp() {
local -n image="$1"
local -n role="$2"
local -n conf_file="$3"
local -n network="$4"
log "starting"
log "Configuring aro-rp service"

Expand Down Expand Up @@ -140,7 +135,6 @@ ExecStart=/usr/bin/podman run \
-e OIDC_AFD_ENDPOINT \
-e OIDC_STORAGE_ACCOUNT_NAME \
-m 2g \
--network=$network \
-p 443:8443 \
-v /etc/aro-rp:/etc/aro-rp \
-v /run/systemd/journal:/run/systemd/journal \
Expand All @@ -162,10 +156,8 @@ WantedBy=multi-user.target"
# configure_service_aro_monitor
# args:
# 1) image - nameref, string; RP container image
# 2) network - nameref, string; podman network name to be attached
configure_service_aro_monitor() {
local -n image="$1"
local -n network="$2"
log "starting"
log "Configuring aro-monitor service"

Expand Down Expand Up @@ -207,7 +199,6 @@ ExecStart=/usr/bin/podman run \
--name %N \
--rm \
--cap-drop net_raw \
--network=$network \
-e AZURE_FP_CLIENT_ID \
-e DOMAIN_NAME \
-e CLUSTER_MDSD_ACCOUNT \
Expand Down Expand Up @@ -240,10 +231,8 @@ WantedBy=multi-user.target"
# configure_service_aro_portal
# args:
# 1) image - nameref, string; RP container image
# 2) network - nameref, string; podman network name to be attached
configure_service_aro_portal() {
local -n image="$1"
local -n network="$2"
log "starting"
log "Configuring aro portal service"

Expand Down Expand Up @@ -278,7 +267,6 @@ ExecStart=/usr/bin/podman run \
--name %N \
--rm \
--cap-drop net_raw \
--network=$network \
-e AZURE_PORTAL_ACCESS_GROUP_IDS \
-e AZURE_PORTAL_CLIENT_ID \
-e AZURE_PORTAL_ELEVATED_GROUP_IDS \
Expand Down Expand Up @@ -355,12 +343,10 @@ export MDSD_MSGPACK_SORT_COLUMNS=\"1\""
# args:
# 1) conf_file - string; fluenbit configuration file
# 2) image - string; fluentbit container image to run
# 3) network - nameref, string; podman network name to be attached
configure_service_fluentbit() {
# shellcheck disable=SC2034
local -n conf_file="$1"
local -n image="$2"
local -n network="$3"
log "starting"
log "Configuring fluentbit service"

Expand Down Expand Up @@ -576,11 +562,9 @@ WantedBy=multi-user.target'
# args:
# 1) role - nameref, string; can be "gateway" or "rp"
# 2) image - nameref, string; mdm container image to run
# 3) network - nameref, string; podman network name to be attached
configure_service_mdm() {
local -n role="$1"
local -n image="$2"
local -n network="$3"
log "starting"
log "Configuring mdm service"

Expand Down Expand Up @@ -614,7 +598,6 @@ ExecStart=/usr/bin/podman run \
--name %N \
--rm \
--cap-drop net_raw \
--network=$network \
-m 2g \
-v /etc/mdm.pem:/etc/mdm.pem \
-v /var/etw:/var/etw:z \
Expand Down Expand Up @@ -652,18 +635,18 @@ configure_vmss_aro_services() {
verify_role "$1"

if [ "$r" == "$role_gateway" ]; then
configure_service_aro_gateway "${images["rp"]}" "$1" "${configs["gateway_config"]}" "${configs["network"]}"
configure_service_aro_gateway "${images["rp"]}" "$1" "${configs["gateway_config"]}"
configure_certs_gateway
elif [ "$r" == "$role_rp" ]; then
configure_service_aro_rp "${images["rp"]}" "$1" "${configs["rp_config"]}" "${configs["network"]}"
configure_service_aro_monitor "${images["rp"]}" "${configs["network"]}"
configure_service_aro_portal "${images["rp"]}" "${configs["network"]}"
configure_service_aro_rp "${images["rp"]}" "$1" "${configs["rp_config"]}"
configure_service_aro_monitor "${images["rp"]}"
configure_service_aro_portal "${images["rp"]}"
configure_certs_rp
fi

configure_service_fluentbit "${configs["fluentbit"]}" "${images["fluentbit"]}" "${configs["network"]}"
configure_service_fluentbit "${configs["fluentbit"]}" "${images["fluentbit"]}"
configure_timers_mdm_mdsd "$1"
configure_service_mdm "$1" "${images["mdm"]}" "${configs["network"]}"
configure_service_mdm "$1" "${images["mdm"]}"
configure_service_mdsd "$1" "${configs["mdsd"]}"
run_azsecd_config_scan
}
Expand Down
26 changes: 4 additions & 22 deletions pkg/deploy/generator/scripts/util-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ configure_sshd() {
# args:
# 1) dropin_files - nameref, associative array, optional; logrotate files to write to /etc/logrotate.d
# Key name dictates filenames written to /etc/logrotate.d.
# Example:
# Example:
# Key dictates the filename written in /etc/logrotate.d
# shellcheck disable=SC2034
# local -rA logrotate_dropins=(
Expand Down Expand Up @@ -165,7 +165,7 @@ pull_container_images() {

# This name is used in the case that az acr login searches for this in it's environment
export REGISTRY_AUTH_FILE="/root/.docker/config.json"

if [ -n "${registry_conf}" ]; then
write_file REGISTRY_AUTH_FILE registry_conf true
fi
Expand Down Expand Up @@ -248,8 +248,8 @@ configure_certs_gateway() {
configure_certs_devproxy() {
log "starting"

verify_role role_devproxy true
verify_role role_devproxy

local -r proxy_certs_basedir="/etc/proxy"
mkdir -p "$proxy_certs_basedir"
base64 -d <<<"$PROXYCERT" > "$proxy_certs_basedir/proxy.crt"
Expand Down Expand Up @@ -316,24 +316,6 @@ create_required_dirs() {
done
}

# create_podman_networks()
# args:
# 1) nets - nameref, associative array; Networks to be created
# Key is the network name, value is the subnet with cidr notation
create_podman_networks() {
local -n nets="$1"
log "starting"

# shellcheck disable=SC2068
for n in ${!nets[@]}; do
log "Creating podman network \"$n\" with subnet \"${nets[$n]}\""
podman network \
create \
--subnet "${nets["$n"]}" \
"$n"
done
}

# firewalld_configure_backend
firewalld_configure_backend() {
log "starting"
Expand Down

0 comments on commit 2db96a6

Please sign in to comment.