@@ -1229,35 +1229,43 @@ func UpdateRecommendedPolicyConfig(config *opv1.KubeArmorConfigSpec) bool {
1229
1229
1230
1230
func UpdateConfigMapData (config * opv1.KubeArmorConfigSpec ) bool {
1231
1231
updated := false
1232
+ configMapData := ""
1233
+
1232
1234
if config .DefaultFilePosture != "" {
1233
1235
if common .ConfigMapData [common .ConfigDefaultFilePosture ] != string (config .DefaultFilePosture ) {
1234
1236
common .ConfigMapData [common .ConfigDefaultFilePosture ] = string (config .DefaultFilePosture )
1235
1237
updated = true
1236
1238
}
1239
+ configMapData += fmt .Sprintf ("defaultFilePosture: %s\n " , config .DefaultFilePosture )
1237
1240
}
1238
1241
if config .DefaultCapabilitiesPosture != "" {
1239
1242
if common .ConfigMapData [common .ConfigDefaultCapabilitiesPosture ] != string (config .DefaultCapabilitiesPosture ) {
1240
1243
common .ConfigMapData [common .ConfigDefaultCapabilitiesPosture ] = string (config .DefaultCapabilitiesPosture )
1241
1244
updated = true
1242
1245
}
1246
+ configMapData += fmt .Sprintf ("defaultCapabilitiesPosture: %s\n " , config .DefaultCapabilitiesPosture )
1243
1247
}
1244
1248
if config .DefaultNetworkPosture != "" {
1245
1249
if common .ConfigMapData [common .ConfigDefaultNetworkPosture ] != string (config .DefaultNetworkPosture ) {
1246
1250
common .ConfigMapData [common .ConfigDefaultNetworkPosture ] = string (config .DefaultNetworkPosture )
1247
1251
updated = true
1248
1252
}
1253
+ configMapData += fmt .Sprintf ("defaultNetworkPosture: %s\n " , config .DefaultNetworkPosture )
1249
1254
}
1250
1255
if config .DefaultVisibility != "" {
1251
1256
if common .ConfigMapData [common .ConfigVisibility ] != config .DefaultVisibility {
1252
1257
common .ConfigMapData [common .ConfigVisibility ] = config .DefaultVisibility
1253
1258
updated = true
1254
1259
}
1260
+ configMapData += fmt .Sprintf ("defaultVisibility: %s\n " , config .DefaultVisibility )
1255
1261
}
1256
1262
AlertThrottlingEnabled := strconv .FormatBool (config .AlertThrottling )
1257
1263
if common .ConfigMapData [common .ConfigAlertThrottling ] != AlertThrottlingEnabled {
1258
1264
common .ConfigMapData [common .ConfigAlertThrottling ] = AlertThrottlingEnabled
1259
1265
updated = true
1260
1266
}
1267
+ configMapData += fmt .Sprintf ("alertThrottling: %t\n " , config .AlertThrottling )
1268
+
1261
1269
MaxAlertPerSec := strconv .FormatInt (int64 (config .MaxAlertPerSec ), 10 )
1262
1270
if config .MaxAlertPerSec == 0 {
1263
1271
MaxAlertPerSec = common .DefaultMaxAlertPerSec
@@ -1266,6 +1274,7 @@ func UpdateConfigMapData(config *opv1.KubeArmorConfigSpec) bool {
1266
1274
common .ConfigMapData [common .ConfigMaxAlertPerSec ] = MaxAlertPerSec
1267
1275
updated = true
1268
1276
}
1277
+ configMapData += fmt .Sprintf ("maxAlertPerSec: %s\n " , MaxAlertPerSec )
1269
1278
1270
1279
ThrottleSec := strconv .FormatInt (int64 (config .ThrottleSec ), 10 )
1271
1280
if config .ThrottleSec == 0 {
@@ -1275,6 +1284,10 @@ func UpdateConfigMapData(config *opv1.KubeArmorConfigSpec) bool {
1275
1284
common .ConfigMapData [common .ConfigThrottleSec ] = ThrottleSec
1276
1285
updated = true
1277
1286
}
1287
+ configMapData += fmt .Sprintf ("throttleSec: %s\n " , ThrottleSec )
1288
+
1289
+ common .ConfigMapData [common .KubeArmorConfigFileName ] = configMapData
1290
+
1278
1291
return updated
1279
1292
}
1280
1293
0 commit comments