From f3bbc85dd56f06bb7a05977d296653e564b2dd1a Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Fri, 29 Oct 2021 09:59:10 -0400 Subject: [PATCH] Fix issue with matching labels This commit fixes the issue with application outages scenario where the pod-selector is not being mapped properly. --- docs/application_outages.md | 2 +- kraken/application_outage/actions.py | 3 ++- scenarios/app_outage.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/application_outages.md b/docs/application_outages.md index 9f460ae4..f2ad9348 100644 --- a/docs/application_outages.md +++ b/docs/application_outages.md @@ -6,7 +6,7 @@ Scenario to block the traffic ( Ingress/Egress ) of an application matching the application_outage: # Scenario to create an outage of an application by blocking traffic duration: 600 # Duration in seconds after which the routes will be accessible namespace: # Namespace to target - all application routes will go inaccessible if pod selector is empty - pod_selector: {app=foo} # Pods to target + pod_selector: {app: foo} # Pods to target block: [Ingress, Egress] # It can be Ingress or Egress or Ingress, Egress ``` diff --git a/kraken/application_outage/actions.py b/kraken/application_outage/actions.py index e48a0d26..6c82f8d8 100644 --- a/kraken/application_outage/actions.py +++ b/kraken/application_outage/actions.py @@ -28,7 +28,8 @@ kind: NetworkPolicy metadata: name: kraken-deny spec: - podSelector: {{ pod_selector }} + podSelector: + matchLabels: {{ pod_selector }} policyTypes: {{ traffic_type }} """ t = Template(network_policy_template) diff --git a/scenarios/app_outage.yaml b/scenarios/app_outage.yaml index 4a5d39ea..6459727d 100644 --- a/scenarios/app_outage.yaml +++ b/scenarios/app_outage.yaml @@ -1,5 +1,5 @@ application_outage: # Scenario to create an outage of an application by blocking traffic duration: 600 # Duration in seconds after which the routes will be accessible namespace: # Namespace to target - all application routes will go inaccessible if pod selector is empty - pod_selector: {app=foo} # Pods to target + pod_selector: {app: foo} # Pods to target block: [Ingress, Egress] # It can be Ingress or Egress or Ingress, Egress