added workload image as scenario parameter (#854)
Some checks failed
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 8m58s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped

* added workload image as scenario parameter

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

* renamed workload_image to image

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>

---------

Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
This commit is contained in:
Tullio Sebastiani
2025-06-25 17:08:59 +02:00
committed by GitHub
parent bddbd42f8c
commit f04f1f1101
4 changed files with 13 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ class NetworkChaosScenarioType(Enum):
Node = 1
Pod = 2
@dataclass
class BaseNetworkChaosConfig:
supported_execution = ["serial", "parallel"]
@@ -20,13 +21,18 @@ class BaseNetworkChaosConfig:
def validate(self) -> list[str]:
errors = []
if self.execution is None:
errors.append(f"execution cannot be None, supported values are: {','.join(self.supported_execution)}")
errors.append(
f"execution cannot be None, supported values are: {','.join(self.supported_execution)}"
)
if self.execution not in self.supported_execution:
errors.append(f"{self.execution} is not in supported execution mod: {','.join(self.supported_execution)}")
errors.append(
f"{self.execution} is not in supported execution mod: {','.join(self.supported_execution)}"
)
if self.label_selector is None:
errors.append("label_selector cannot be None")
return errors
@dataclass
class NetworkFilterConfig(BaseNetworkChaosConfig):
ingress: bool
@@ -34,6 +40,7 @@ class NetworkFilterConfig(BaseNetworkChaosConfig):
interfaces: list[str]
target: str
ports: list[int]
image: str
def validate(self) -> list[str]:
errors = super().validate()

View File

@@ -41,6 +41,7 @@ class NodeNetworkFilterModule(AbstractNetworkChaosModule):
namespace=self.config.namespace,
host_network=True,
target=target,
workload_image=self.config.image,
)
)
self.log_info(

View File

@@ -12,6 +12,6 @@ spec:
containers:
- name: fedora
imagePullPolicy: Always
image: quay.io/krkn-chaos/krkn-network-chaos:latest
image: {{workload_image}}
securityContext:
privileged: true

View File

@@ -1,7 +1,8 @@
- id: node_network_filter
image: "quay.io/krkn-chaos/krkn-network-chaos:latest"
wait_duration: 300
test_duration: 100
label_selector: "kubernetes.io/hostname=ip-10-0-39-182.us-east-2.compute.internal"
label_selector: "kubernetes.io/hostname=minikube"
namespace: 'default'
instance_count: 1
execution: parallel