Commit efd47f51 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Add labels to ConfigMap creation in WAF service

- Introduce a label to the ConfigMap for black/white list to enhance identification and management
- Add logging for the ConfigMap name to improve visibility during configuration creation
parent b501b6b5
...@@ -965,9 +965,11 @@ func (s *wafService) createConfigMap(ctx context.Context, req *MatcherExpr, regi ...@@ -965,9 +965,11 @@ func (s *wafService) createConfigMap(ctx context.Context, req *MatcherExpr, regi
return fmt.Errorf("failed to marshal match expression: %v", err) return fmt.Errorf("failed to marshal match expression: %v", err)
} }
name := fmt.Sprintf("waf-black-white-list-%d", req.ID) name := fmt.Sprintf("waf-black-white-list-%d", req.ID)
log.Info().Interface("name", name).Msg("create config map")
_, err = client.Clientset.CoreV1().ConfigMaps(wafSvc[0].Namespace).Create(ctx, &corev1.ConfigMap{ _, err = client.Clientset.CoreV1().ConfigMaps(wafSvc[0].Namespace).Create(ctx, &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Labels: map[string]string{"waf.security.io/black-white-list": "true"},
}, },
Data: map[string]string{ Data: map[string]string{
"match-expression": string(matchExprJson), "match-expression": string(matchExprJson),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment