@@ -39,11 +39,24 @@ spec:
3939 command :
4040 - powershell.exe
4141 - -command
42- - $argList=@("/I","AquaAgentWindowsInstaller.msi","/qn","/L AquaAgentWindowsInstaller.install.log");
42+ - $Installation = Get-WmiObject -Class Win32_Product | Where-Object {$_.Vendor -eq "Aqua Security"};
43+ - if ($Installation -ne $null) {
44+ Get-ChildItem -Path "C:\Program Files\AquaSec\log";
45+ Write-Output "Backing up Aqua-Enforcer logs to $Env:TEMP\Aquasec\";
46+ Copy-Item -Path "C:\Program Files\AquaSec\log" -Destination "$Env:TEMP\Aquasec" -Recurse -Force -ErrorAction SilentlyContinue;
47+ Write-Output "Removing $Installation.Name...";
48+ $argList=@("/X",$Installation.IdentifyingNumber,"/qn","/L $Env:TEMP\Aquasec\AquaAgentWindowsInstaller.remove.log","/norestart","MSIRESTARTMANAGERCONTROL=Disable");
49+ $Process=Start-Process -FilePath msiexec.exe -ArgumentList $argList -NoNewWindow -PassThru -Wait;
50+ };
51+ - Write-Output "List $Env:CONTAINER_SANDBOX_MOUNT_POINT";
52+ - Get-ChildItem -Path $Env:CONTAINER_SANDBOX_MOUNT_POINT;
53+ - Copy-Item -Path $(Join-Path -Path "$Env:CONTAINER_SANDBOX_MOUNT_POINT" -ChildPath "\AquaAgentWindowsInstaller.msi") -Destination $(Join-Path -Path "$Env:TEMP" -ChildPath "\AquaAgentWindowsInstaller.msi") -Force;
54+ - $argList=@("/I","$Env:TEMP\AquaAgentWindowsInstaller.msi","/qn","/L*V AquaAgentWindowsInstaller.install.log");
4355 - $sysEnv=@(Get-ChildItem -Path Env:) | ForEach { $argList+=$_.Name+'="'+$_.Value+'"' };
56+ - Write-Output "Running Start-Process -FilePath msiexec.exe -ArgumentList " $argList " -NoNewWindow -PassThru -Wait";
4457 - $Process=Start-Process -FilePath msiexec.exe -ArgumentList $argList -NoNewWindow -PassThru -Wait;
4558 - Get-Content AquaAgentWindowsInstaller.install.log;
46- - While (Get-Service slkd | Where-Object {$_.Status -eq "Running"} ){ Start-Sleep -s 30 }
59+ - While ( $true ){ Start-Sleep -s 30 }
4760 imagePullPolicy : Always
4861# resources:
4962# limits:
@@ -65,15 +78,23 @@ spec:
6578 command :
6679 - powershell.exe
6780 - -c
68- - Get-Service -Name slkd
81+ - Get-Service -Name slkd | Where-Object {$_.Status -eq "Running"}
82+ timeoutSeconds : 5
6983 initialDelaySeconds : 15
7084 periodSeconds : 15
7185 readinessProbe :
7286 exec :
7387 command :
7488 - powershell.exe
7589 - -c
76- - Get-Service -Name slkd | Where-Object {$_.Status -eq "Running"}
90+ - Start-Process -FilePath "C:\Program Files\AquaSec\slk.exe" -ArgumentList @("health","check") -Wait -NoNewWindow -RedirectStandardOutput "$Env:TEMP\aqua-enforcer-health.check";
91+ - $connection = Get-Content -Path "$Env:TEMP\aqua-enforcer-health.check" | Select-String "connection to management server";
92+ - Get-Content -Path "$Env:TEMP\aqua-enforcer-health.check";
93+ - if ($connection | Select-String "PASSED" -Quiet) {
94+ Exit 0;
95+ };
96+ - Exit 1;
97+ timeoutSeconds : 15
7798 initialDelaySeconds : 15
7899 periodSeconds : 15
79100 lifecycle :
@@ -82,8 +103,15 @@ spec:
82103 command :
83104 - powershell.exe
84105 - -command
85- - $argList=@("/X","AquaAgentWindowsInstaller.msi","/qn","/L c:\c\AquaAgentWindowsInstaller.remove.log","/norestart","MSIRESTARTMANAGERCONTROL=Disable");
86- - $Process=Start-Process -FilePath msiexec.exe -ArgumentList $argList -NoNewWindow -PassThru -Wait;
106+ - $Installation = Get-WmiObject -Class Win32_Product | Where-Object {$_.Vendor -eq "Aqua Security"};
107+ - if ($Installation -ne $null) {
108+ Get-ChildItem -Path "C:\Program Files\AquaSec\log";
109+ Write-Output "Backing up Aqua-Enforcer logs to $Env:TEMP\Aquasec\";
110+ Copy-Item -Path "C:\Program Files\AquaSec\log" -Destination "$Env:TEMP\Aquasec\" -Recurse -Force -ErrorAction SilentlyContinue;
111+ Write-Output "Removing $Installation.Name...";
112+ $argList=@("/X",$Installation.IdentifyingNumber,"/qn","/L $Env:TEMP\Aquasec\AquaAgentWindowsInstaller.remove.log","/norestart","MSIRESTARTMANAGERCONTROL=Disable");
113+ $Process=Start-Process -FilePath msiexec.exe -ArgumentList $argList -NoNewWindow -PassThru -Wait;
114+ };
87115 name : aqua-windows-agent
88116 securityContext :
89117 windowsOptions :
0 commit comments