From 2674e094076bae129241629b811c692f17ce4be1 Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Tue, 12 Oct 2021 16:33:53 -0400 Subject: [PATCH] Ignore validation for network policy creation This commit helps the cases where targeting application pods in a namespace using pod-selector to create an outage fails because of not being able to validate the selector. Error message for reference: error validating data: ValidationError(NetworkPolicy.spec.podSelector): unknown field "app=dittybopper" in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector --- kraken/application_outage/actions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kraken/application_outage/actions.py b/kraken/application_outage/actions.py index 717af97a..e48a0d26 100644 --- a/kraken/application_outage/actions.py +++ b/kraken/application_outage/actions.py @@ -38,7 +38,9 @@ spec: f.write(rendered_spec) # Block the traffic by creating network policy logging.info("Creating the network policy") - runcommand.invoke("kubectl create -f %s -n %s" % ("kraken_network_policy.yaml", namespace)) + runcommand.invoke( + "kubectl create -f %s -n %s --validate=false" % ("kraken_network_policy.yaml", namespace) + ) # wait for the specified duration logging.info("Waiting for the specified duration in the config: %s" % (duration))