adding volume mounts

This commit is contained in:
wiaamm 2025-02-16 21:11:50 +02:00
parent 2752c1a79c
commit 91ce35af1b

View File

@ -52,8 +52,22 @@ def get_sidecar_container():
custom_fog_enabled = os.getenv("CUSTOM_FOG_ENABLED") == "true" # Check if it's set to "true" custom_fog_enabled = os.getenv("CUSTOM_FOG_ENABLED") == "true" # Check if it's set to "true"
fog_address = os.getenv("FOG_ADDRESS") fog_address = os.getenv("FOG_ADDRESS")
appsec_proxy = os.getenv("APPSEC_PROXY") appsec_proxy = os.getenv("APPSEC_PROXY")
config_map_ref = os.getenv("CONFIG_MAP_REF")
secret_ref = os.getenv("SECRET_REF")
persistence_enabled = os.getenv("APPSEC_PERSISTENCE_ENABLED", "false").lower() == "true"
# Prepare the volumeMounts list
volume_mounts = [
{"name": "envoy-attachment-shared", "mountPath": "/envoy/attachment/shared/"},
{"name": "advanced-model", "mountPath": "/advanced-model"}
]
if persistence_enabled:
volume_mounts.extend([
{"name": "appsec-conf", "mountPath": "/etc/cp/conf"},
{"name": "appsec-data", "mountPath": "/etc/cp/data"}
])
# Construct args list based on conditions
args = [] args = []
if token: if token:
args.extend(["--token", token]) args.extend(["--token", token])
@ -95,14 +109,24 @@ def get_sidecar_container():
"command": ["/cp-nano-agent"], "command": ["/cp-nano-agent"],
"args": args, "args": args,
"env": env, "env": env,
"volumeMounts": [ "volumeMounts": volume_mounts,
{"name": "envoy-attachment-shared", "mountPath": "/envoy/attachment/shared/"}
],
"resources": { "resources": {
"requests": { "requests": {
"cpu": "200m" "cpu": "200m"
} }
}, },
"envFrom": [
{
"configMapRef": {
"name": config_map_ref
}
},
{
"secretRef": {
"name": secret_ref
}
}
],
"securityContext": { "securityContext": {
"runAsNonRoot": False, "runAsNonRoot": False,
"runAsUser": 0 "runAsUser": 0