2020-09-17 08:20:47 +05:30
|
|
|
local chart = import 'chart.jsonnet';
|
|
|
|
|
local common = import 'common.jsonnet';
|
|
|
|
|
local deployment_manifest = import 'deployment_manifest.jsonnet';
|
|
|
|
|
local deployment = deployment_manifest.deployment;
|
2020-09-21 09:43:58 +05:30
|
|
|
local chaos_util = import 'chaos_util.jsonnet';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local env = function(experiment) {
|
|
|
|
|
latencyInjection: [
|
|
|
|
|
{
|
|
|
|
|
name: 'NETWORK_LATENCY',
|
|
|
|
|
value: experiment.details.latency,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
packetLoss: [
|
|
|
|
|
{
|
|
|
|
|
name: 'NETWORK_PACKET_LOSS_PERCENTAGE',
|
|
|
|
|
value: experiment.details.packetLoss,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}[experiment.type];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std.map(function(experiment) {
|
2020-09-17 08:20:47 +05:30
|
|
|
apiVersion: 'litmuschaos.io/v1alpha1',
|
|
|
|
|
kind: 'ChaosEngine',
|
|
|
|
|
metadata: {
|
|
|
|
|
name: '%s-chaos' % deployment.name,
|
|
|
|
|
namespace: deployment.namespace,
|
|
|
|
|
labels: {
|
|
|
|
|
resource_id: '%s-chaos' % deployment.name,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
spec: {
|
|
|
|
|
jobCleanUpPolicy: 'delete',
|
|
|
|
|
annotationCheck: 'true',
|
|
|
|
|
engineState: 'active',
|
|
|
|
|
auxiliaryAppInfo: '',
|
|
|
|
|
monitoring: false,
|
|
|
|
|
appinfo: {
|
|
|
|
|
appns: deployment.namespace,
|
|
|
|
|
applabel: 'release=%s' % deployment.name,
|
|
|
|
|
appkind: 'deployment',
|
|
|
|
|
},
|
2020-09-21 09:43:58 +05:30
|
|
|
chaosServiceAccount: '%s-sa' % chaos_util.experimentName(experiment),
|
2020-09-17 08:20:47 +05:30
|
|
|
components: {
|
|
|
|
|
runner: {
|
|
|
|
|
runnerannotation: {
|
|
|
|
|
'sidecar.istio.io/inject': 'false',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-09-21 09:43:58 +05:30
|
|
|
experiments: [{
|
|
|
|
|
name: chaos_util.experimentName(experiment),
|
2020-09-17 08:20:47 +05:30
|
|
|
spec: {
|
|
|
|
|
components: {
|
|
|
|
|
experimentannotation: {
|
|
|
|
|
'sidecar.istio.io/inject': 'false',
|
|
|
|
|
},
|
|
|
|
|
env: [
|
|
|
|
|
{
|
|
|
|
|
name: 'CHAOS_NAMESPACE',
|
|
|
|
|
value: deployment.namespace,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'APP_NAMESPACE',
|
|
|
|
|
value: deployment.namespace,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'NETWORK_INTERFACE',
|
|
|
|
|
value: 'eth0',
|
|
|
|
|
},
|
2020-09-21 09:43:58 +05:30
|
|
|
{
|
|
|
|
|
name: 'TARGET_CONTAINER',
|
|
|
|
|
value: chart.full_service_name(deployment.name),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'TOTAL_CHAOS_DURATION',
|
|
|
|
|
value: experiment.duration,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'PODS_AFFECTED_PERC',
|
|
|
|
|
value: '100',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'TARGET_HOSTS',
|
|
|
|
|
value: std.join(',', experiment.details.targetHosts),
|
|
|
|
|
},
|
|
|
|
|
] + env(experiment),
|
2020-09-17 08:20:47 +05:30
|
|
|
},
|
|
|
|
|
},
|
2023-10-17 18:10:53 +05:30
|
|
|
}],
|
2020-09-17 08:20:47 +05:30
|
|
|
},
|
2020-09-21 09:43:58 +05:30
|
|
|
}, deployment.faults)
|