diff --git a/charts/spring-boot/experiments.yaml b/charts/spring-boot/experiments.yaml new file mode 100644 index 000000000..df10dd909 --- /dev/null +++ b/charts/spring-boot/experiments.yaml @@ -0,0 +1,166 @@ +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Injects spring boot chaos monkey assault on pods belonging to an app deployment +kind: ChaosExperiment +metadata: + name: spring-boot-chaos + labels: + name: spring-boot-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: chaosexperiment + app.kubernetes.io/version: latest +spec: + definition: + scope: Namespaced + permissions: + # Create and monitor the experiment & helper pods + - apiGroups: [ "" ] + resources: [ "pods" ] + verbs: [ "create","delete","get","list","patch","update", "deletecollection" ] + # Performs CRUD operations on the events inside chaosengine and chaosresult + - apiGroups: [ "" ] + resources: [ "events" ] + verbs: [ "create","get","list","patch","update" ] + # Fetch configmaps details and mount it to the experiment pod (if specified) + - apiGroups: [ "" ] + resources: [ "configmaps" ] + verbs: [ "get","list", ] + # Track and get the runner, experiment, and helper pods log + - apiGroups: [ "" ] + resources: [ "pods/log" ] + verbs: [ "get","list","watch" ] + # for creating and managing to execute comands inside target container + - apiGroups: [ "" ] + resources: [ "pods/exec" ] + verbs: [ "get","list","create" ] + # deriving the parent/owner details of the pod(if parent is anyof {deployment, statefulset, daemonsets}) + - apiGroups: [ "apps" ] + resources: [ "deployments","statefulsets","replicasets", "daemonsets" ] + verbs: [ "list","get" ] + # deriving the parent/owner details of the pod(if parent is deploymentConfig) + - apiGroups: [ "apps.openshift.io" ] + resources: [ "deploymentconfigs" ] + verbs: [ "list","get" ] + # deriving the parent/owner details of the pod(if parent is deploymentConfig) + - apiGroups: [ "" ] + resources: [ "replicationcontrollers" ] + verbs: [ "get","list" ] + # deriving the parent/owner details of the pod(if parent is argo-rollouts) + - apiGroups: [ "argoproj.io" ] + resources: [ "rollouts" ] + verbs: [ "list","get" ] + # for configuring and monitor the experiment job by the chaos-runner pod + - apiGroups: [ "batch" ] + resources: [ "jobs" ] + verbs: [ "create","list","get","delete","deletecollection" ] + # for creation, status polling and deletion of litmus chaos resources used within a chaos workflow + - apiGroups: [ "litmuschaos.io" ] + resources: [ "chaosengines","chaosexperiments","chaosresults" ] + verbs: [ "create","list","get","patch","update","delete" ] + image: "litmuschaos/go-runner:latest" + imagePullPolicy: Always + args: + - -c + - ./experiments -name spring-boot-chaos + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: '15' + + ## Period to wait before injection of chaos in sec + - name: RAMP_TIME + value: '' + + ## env var that describes the library used to execute the chaos + ## default: litmus. Supported values: litmus + - name: LIB + value: 'litmus' + + # Chaos Monkey Spring Boot configuration + # Level determines at which frequency the assault happens on the application. For a value N, the assaults happens every N requests + - name: CM_LEVEL + value: '1' + + # Whether the level should be used as a deterministic value (attack every x requests) or a chance (on average, 1 in x requests will be attacked) + - name: CM_DETERMINISTIC + value: 'true' + + + # Comma separated list of watched Java services. Ex: com.example.application.controller.HelloController.sayHello + - name: CM_WATCHED_CUSTOM_SERVICES + value: '' + + # Comma separated list of watchers. Possible values: controller, restController, service, repository, component, restTemplate, webClient, actuatorHealth + - name: CM_WATCHERS + value: 'restController' + + # AppKiller assault active + - name: CM_KILL_APPLICATIONS_ACTIVE + value: 'false' + # Memory cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey AppKiller assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_KILL_APPLICATION_CRON + value: '' + + # Latency assault active + - name: CM_LATENCY_ACTIVE + value: 'false' + # Minimum latency (ms) + - name: CM_LATENCY_RANGE_START + value: '500' + # Maxiumu latency (ms) + - name: CM_LATENCY_RANGE_END + value: '500' + + # Exception assault active + - name: CM_EXCEPTIONS_ACTIVE + value: 'false' + # Type of raised exception + - name: CM_EXCEPTIONS_TYPE + value: 'java.lang.IllegalArgumentException' + # Argument of raised exception + - name: CM_EXCEPTIONS_ARGUMENTS + value: 'java.lang.String:custom illegal argument exception' + + # Memory assault active + - name: CM_MEMORY_ACTIVE + value: 'false' + # Duration to assault memory when requested fill amount is reached in ms. + - name: CM_MEMORY_MS_HOLD_FILLED_MEM + value: '90000' + # Time in ms between increases of memory usage. + - name: CM_MEMORY_MS_NEXT_INCREASE + value: '10000' + # Fraction of one individual memory increase iteration. 1.0 equals 100 %. + - name: CM_MEMORY_FILL_INC_FRACTION + value: '1.0' + # Final fraction of used memory by assault. 0.95 equals 95 %. + - name: CM_MEMORY_FILL_TARGET_FRACTION + value: '0.95' + # Memory cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey memory assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_MEMORY_CRON + value: '' + + # CPU assault active + - name: CM_CPU_ACTIVE + value: 'false' + # Duration to assault cpu when requested load is reached in ms. + - name: CM_CPU_MS_HOLD_LOAD + value: '90000' + # Final fraction of used cpu by assault. 0.95 equals 95 %. + - name: CM_CPU_LOAD_TARGET_FRACTION + value: '0.9' + # CPU cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey cpu assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_CPU_CRON + value: '' + + labels: + name: spring-boot-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/runtime-api-usage: "true" + app.kubernetes.io/version: latest diff --git a/charts/spring-boot/icons/spring-boot-chaos.png b/charts/spring-boot/icons/spring-boot-chaos.png new file mode 100644 index 000000000..afd8837a6 Binary files /dev/null and b/charts/spring-boot/icons/spring-boot-chaos.png differ diff --git a/charts/spring-boot/icons/spring-boot.png b/charts/spring-boot/icons/spring-boot.png new file mode 100644 index 000000000..afd8837a6 Binary files /dev/null and b/charts/spring-boot/icons/spring-boot.png differ diff --git a/charts/spring-boot/spring-boot-chaos/engine.yaml b/charts/spring-boot/spring-boot-chaos/engine.yaml new file mode 100644 index 000000000..72cb53a9d --- /dev/null +++ b/charts/spring-boot/spring-boot-chaos/engine.yaml @@ -0,0 +1,45 @@ +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: spring-boot-app-chaos + namespace: default +spec: + appinfo: + appns: 'default' + applabel: 'app=springboot' + appkind: 'deployment' + # It can be active/stop + engineState: 'active' + chaosServiceAccount: spring-boot-chaos-sa + experiments: + - name: spring-boot-chaos + spec: + components: + env: + - name: TOTAL_CHAOS_DURATION + value: '15' + + ## Period to wait before injection of chaos in sec + - name: RAMP_TIME + value: '' + # Latency assault active + - name: CM_LATENCY_ACTIVE + value: 'false' + # Memory assault active + - name: CM_MEMORY_ACTIVE + value: 'false' + # Memory assault active + - name: CM_CPU_ACTIVE + value: 'false' + # Memory assault active + - name: CM_EXCEPTION_ACTIVE + value: 'false' + # AppKiller assault active + - name: CM_KILL_APPLICATIONS_ACTIVE + value: 'false' + # Comma separated list of watchers. Possible values: controller, restController, service, repository, component, restTemplate, webClient, actuatorHealth + - name: CM_WATCHERS + value: 'restController' + # Level determines at which frequency the assault happens on the application. For a value N, the assaults happens every N requests + - name: CM_LEVEL + value: '1' diff --git a/charts/spring-boot/spring-boot-chaos/experiment.yaml b/charts/spring-boot/spring-boot-chaos/experiment.yaml new file mode 100644 index 000000000..df10dd909 --- /dev/null +++ b/charts/spring-boot/spring-boot-chaos/experiment.yaml @@ -0,0 +1,166 @@ +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Injects spring boot chaos monkey assault on pods belonging to an app deployment +kind: ChaosExperiment +metadata: + name: spring-boot-chaos + labels: + name: spring-boot-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: chaosexperiment + app.kubernetes.io/version: latest +spec: + definition: + scope: Namespaced + permissions: + # Create and monitor the experiment & helper pods + - apiGroups: [ "" ] + resources: [ "pods" ] + verbs: [ "create","delete","get","list","patch","update", "deletecollection" ] + # Performs CRUD operations on the events inside chaosengine and chaosresult + - apiGroups: [ "" ] + resources: [ "events" ] + verbs: [ "create","get","list","patch","update" ] + # Fetch configmaps details and mount it to the experiment pod (if specified) + - apiGroups: [ "" ] + resources: [ "configmaps" ] + verbs: [ "get","list", ] + # Track and get the runner, experiment, and helper pods log + - apiGroups: [ "" ] + resources: [ "pods/log" ] + verbs: [ "get","list","watch" ] + # for creating and managing to execute comands inside target container + - apiGroups: [ "" ] + resources: [ "pods/exec" ] + verbs: [ "get","list","create" ] + # deriving the parent/owner details of the pod(if parent is anyof {deployment, statefulset, daemonsets}) + - apiGroups: [ "apps" ] + resources: [ "deployments","statefulsets","replicasets", "daemonsets" ] + verbs: [ "list","get" ] + # deriving the parent/owner details of the pod(if parent is deploymentConfig) + - apiGroups: [ "apps.openshift.io" ] + resources: [ "deploymentconfigs" ] + verbs: [ "list","get" ] + # deriving the parent/owner details of the pod(if parent is deploymentConfig) + - apiGroups: [ "" ] + resources: [ "replicationcontrollers" ] + verbs: [ "get","list" ] + # deriving the parent/owner details of the pod(if parent is argo-rollouts) + - apiGroups: [ "argoproj.io" ] + resources: [ "rollouts" ] + verbs: [ "list","get" ] + # for configuring and monitor the experiment job by the chaos-runner pod + - apiGroups: [ "batch" ] + resources: [ "jobs" ] + verbs: [ "create","list","get","delete","deletecollection" ] + # for creation, status polling and deletion of litmus chaos resources used within a chaos workflow + - apiGroups: [ "litmuschaos.io" ] + resources: [ "chaosengines","chaosexperiments","chaosresults" ] + verbs: [ "create","list","get","patch","update","delete" ] + image: "litmuschaos/go-runner:latest" + imagePullPolicy: Always + args: + - -c + - ./experiments -name spring-boot-chaos + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: '15' + + ## Period to wait before injection of chaos in sec + - name: RAMP_TIME + value: '' + + ## env var that describes the library used to execute the chaos + ## default: litmus. Supported values: litmus + - name: LIB + value: 'litmus' + + # Chaos Monkey Spring Boot configuration + # Level determines at which frequency the assault happens on the application. For a value N, the assaults happens every N requests + - name: CM_LEVEL + value: '1' + + # Whether the level should be used as a deterministic value (attack every x requests) or a chance (on average, 1 in x requests will be attacked) + - name: CM_DETERMINISTIC + value: 'true' + + + # Comma separated list of watched Java services. Ex: com.example.application.controller.HelloController.sayHello + - name: CM_WATCHED_CUSTOM_SERVICES + value: '' + + # Comma separated list of watchers. Possible values: controller, restController, service, repository, component, restTemplate, webClient, actuatorHealth + - name: CM_WATCHERS + value: 'restController' + + # AppKiller assault active + - name: CM_KILL_APPLICATIONS_ACTIVE + value: 'false' + # Memory cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey AppKiller assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_KILL_APPLICATION_CRON + value: '' + + # Latency assault active + - name: CM_LATENCY_ACTIVE + value: 'false' + # Minimum latency (ms) + - name: CM_LATENCY_RANGE_START + value: '500' + # Maxiumu latency (ms) + - name: CM_LATENCY_RANGE_END + value: '500' + + # Exception assault active + - name: CM_EXCEPTIONS_ACTIVE + value: 'false' + # Type of raised exception + - name: CM_EXCEPTIONS_TYPE + value: 'java.lang.IllegalArgumentException' + # Argument of raised exception + - name: CM_EXCEPTIONS_ARGUMENTS + value: 'java.lang.String:custom illegal argument exception' + + # Memory assault active + - name: CM_MEMORY_ACTIVE + value: 'false' + # Duration to assault memory when requested fill amount is reached in ms. + - name: CM_MEMORY_MS_HOLD_FILLED_MEM + value: '90000' + # Time in ms between increases of memory usage. + - name: CM_MEMORY_MS_NEXT_INCREASE + value: '10000' + # Fraction of one individual memory increase iteration. 1.0 equals 100 %. + - name: CM_MEMORY_FILL_INC_FRACTION + value: '1.0' + # Final fraction of used memory by assault. 0.95 equals 95 %. + - name: CM_MEMORY_FILL_TARGET_FRACTION + value: '0.95' + # Memory cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey memory assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_MEMORY_CRON + value: '' + + # CPU assault active + - name: CM_CPU_ACTIVE + value: 'false' + # Duration to assault cpu when requested load is reached in ms. + - name: CM_CPU_MS_HOLD_LOAD + value: '90000' + # Final fraction of used cpu by assault. 0.95 equals 95 %. + - name: CM_CPU_LOAD_TARGET_FRACTION + value: '0.9' + # CPU cron. Cron expression like */1 * * * * ? can be set to enable chaos monkey cpu assault on a schedule + # Warning: if disabled, leave empty (do not use "OFF" value like in chaos monkey for spring documentation) + - name: CM_CPU_CRON + value: '' + + labels: + name: spring-boot-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/runtime-api-usage: "true" + app.kubernetes.io/version: latest diff --git a/charts/spring-boot/spring-boot-chaos/spring-boot-chaos.chartserviceversion.yaml b/charts/spring-boot/spring-boot-chaos/spring-boot-chaos.chartserviceversion.yaml new file mode 100644 index 000000000..9cc5b8422 --- /dev/null +++ b/charts/spring-boot/spring-boot-chaos/spring-boot-chaos.chartserviceversion.yaml @@ -0,0 +1,50 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + createdAt: 2022-03-31T15:50:08Z + name: spring-boot-chaos + version: 0.1.0 + annotations: + categories: SpringBoot + chartDescription: Injects chaos on spring boot applications running on Kubernetes +spec: + displayName: spring-boot-chaos + categoryDescription: | + Spring Boot Chaos contains chaos to inject assaults on Spring Boot applications running on kubernetes. Experiments can inject assault on random pod against specified application. + - Causes application faulty behavior: exception, latency, cpu/memory consumption. + - Tests system resiliency against faulty micro-services. + + keywords: + - Kubernetes + - K8S + - Pod + - SpringBoot + platforms: + - GKE + - Konvoy + - Packet(Kubeadm) + - Minikube + - EKS + - AKS + - Kind + - Rancher + - OpenShift(OKD) + maturity: alpha + maintainers: + - name: Stephane Cazeaux + email: stephane.cazeaux@orange.com + minKubeVersion: 1.12.0 + provider: + name: Stephane Cazeaux + labels: + app.kubernetes.io/component: chartserviceversion + app.kubernetes.io/version: latest + links: + - name: Source Code + url: https://github.com/litmuschaos/litmus-go/tree/master/experiments/spring-boot/spring-boot-chaos + - name: Chaos Monkey for Spring Boot + url: https://codecentric.github.io/chaos-monkey-spring-boot/ + icon: + - url: + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/spring-boot/spring-boot-chaos/experiment.yaml diff --git a/charts/spring-boot/spring-boot.chartserviceversion.yaml b/charts/spring-boot/spring-boot.chartserviceversion.yaml new file mode 100644 index 000000000..b71ba84fe --- /dev/null +++ b/charts/spring-boot/spring-boot.chartserviceversion.yaml @@ -0,0 +1,34 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + createdAt: 2022-03-31T15:50:08Z + name: spring-boot + version: 0.1.0 + annotations: + categories: SpringBoot + chartDescription: Injects chaos on spring boot applications running on Kubernetes +spec: + displayName: Spring Boot + categoryDescription: > + Inject chaos on Spring Boot applications. + + experiments: + - spring-boot-chaos + keywords: + - Kubernetes + - K8S + - Pod + - SpringBoot + maintainers: + - name: stephane cazeaux + email: stephane.cazeaux@orange.com + minKubeVersion: 1.12.0 + provider: + name: Stephane Cazeaux + links: + - name: Spring Boot + url: https://spring.io/projects/spring-boot + icon: + - url: + mediatype: + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/spring-boot/experiments.yaml diff --git a/charts/spring-boot/spring-boot.package.yaml b/charts/spring-boot/spring-boot.package.yaml new file mode 100644 index 000000000..fd38a5b56 --- /dev/null +++ b/charts/spring-boot/spring-boot.package.yaml @@ -0,0 +1,5 @@ +packageName: spring-boot +experiments: + - name: spring-boot-chaos + CSV: spring-boot-chaos.chartserviceversion.yaml + desc: "spring-boot-chaos"