mirror of
https://github.com/openappsec/attachment.git
synced 2025-06-28 16:41:03 +03:00
add all tuning fields
This commit is contained in:
parent
d9fe74c2cd
commit
2752c1a79c
@ -49,18 +49,52 @@ def configure_logging():
|
||||
def get_sidecar_container():
|
||||
app.logger.debug("Entering get_sidecar_container()")
|
||||
token = os.getenv("TOKEN")
|
||||
custom_fog_enabled = os.getenv("CUSTOM_FOG_ENABLED") == "true" # Check if it's set to "true"
|
||||
fog_address = os.getenv("FOG_ADDRESS")
|
||||
appsec_proxy = os.getenv("APPSEC_PROXY")
|
||||
|
||||
# Construct args list based on conditions
|
||||
args = []
|
||||
if token:
|
||||
args.extend(["--token", token])
|
||||
else:
|
||||
args.append("--hybrid-mode")
|
||||
|
||||
if custom_fog_enabled and fog_address:
|
||||
args.extend(["--fog", fog_address])
|
||||
|
||||
if appsec_proxy:
|
||||
args.extend(["--proxy", appsec_proxy])
|
||||
|
||||
optional_env_vars = {
|
||||
"AGENT_TOKEN": os.getenv("AGENT_TOKEN"),
|
||||
"user_email": os.getenv("user_email"),
|
||||
"appsecClassName": os.getenv("appsecClassName"),
|
||||
"SHARED_STORAGE_HOST": os.getenv("SHARED_STORAGE_HOST"),
|
||||
"LEARNING_HOST": os.getenv("LEARNING_HOST"),
|
||||
"TUNING_HOST": os.getenv("TUNING_HOST"),
|
||||
"LOCAL_TUNING_ENABLED": os.getenv("LOCAL_TUNING_ENABLED"),
|
||||
"PLAYGROUND": os.getenv("PLAYGROUND"),
|
||||
"CRDS_SCOPE": os.getenv("CRDS_SCOPE"),
|
||||
}
|
||||
|
||||
# Base environment variables
|
||||
env = [
|
||||
{"name": "registered_server", "value": "ISTIO Server"}
|
||||
]
|
||||
|
||||
# Add optional environment variables if they are set
|
||||
for var_name, var_value in optional_env_vars.items():
|
||||
if var_value is not None: # Only add if the variable is set
|
||||
env.append({"name": var_name, "value": var_value})
|
||||
|
||||
sidecar = {
|
||||
"name": "infinity-next-nano-agent",
|
||||
"image": FULL_AGENT_IMAGE,
|
||||
"imagePullPolicy": "Always",
|
||||
"command": ["/cp-nano-agent"],
|
||||
"args": [
|
||||
"--token",
|
||||
token
|
||||
],
|
||||
"env": [
|
||||
{"name": "registered_server", "value": "NGINX Server"}
|
||||
],
|
||||
"args": args,
|
||||
"env": env,
|
||||
"volumeMounts": [
|
||||
{"name": "envoy-attachment-shared", "mountPath": "/envoy/attachment/shared/"}
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user