diff --git a/charts/generic/generic.chartserviceversion.yaml b/charts/generic/generic.chartserviceversion.yaml index 11a6d61..7e28324 100644 --- a/charts/generic/generic.chartserviceversion.yaml +++ b/charts/generic/generic.chartserviceversion.yaml @@ -37,6 +37,8 @@ spec: - node-restart - pod-dns-error - pod-dns-spoof + - pod-cpu-hog-exec + - pod-memory-hog-exec keywords: - Kubernetes diff --git a/charts/generic/generic.package.yaml b/charts/generic/generic.package.yaml index 5d6fcec..2e886e7 100644 --- a/charts/generic/generic.package.yaml +++ b/charts/generic/generic.package.yaml @@ -72,3 +72,9 @@ experiments: - name: pod-dns-spoof CSV: pod-dns-spoof.chartserviceversion.yaml desc: "pod-dns-spoof" + - name: pod-cpu-hog-exec + CSV: pod-cpu-hog-exec.chartserviceversion.yaml + desc: "pod-cpu-hog-exec" + - name: pod-memory-hog-exec + CSV: pod-memory-hog-exec.chartserviceversion.yaml + desc: "pod-memory-hog-exec" diff --git a/charts/generic/icons/pod-cpu-hog-exec.png b/charts/generic/icons/pod-cpu-hog-exec.png new file mode 100644 index 0000000..c152ab5 Binary files /dev/null and b/charts/generic/icons/pod-cpu-hog-exec.png differ diff --git a/charts/generic/icons/pod-memory-hog-exec.png b/charts/generic/icons/pod-memory-hog-exec.png new file mode 100644 index 0000000..e49a468 Binary files /dev/null and b/charts/generic/icons/pod-memory-hog-exec.png differ diff --git a/charts/generic/pod-cpu-hog/ansible/engine.yaml b/charts/generic/pod-cpu-hog-exec/engine.yaml similarity index 60% rename from charts/generic/pod-cpu-hog/ansible/engine.yaml rename to charts/generic/pod-cpu-hog-exec/engine.yaml index 12fa239..f710fce 100644 --- a/charts/generic/pod-cpu-hog/ansible/engine.yaml +++ b/charts/generic/pod-cpu-hog-exec/engine.yaml @@ -6,28 +6,20 @@ metadata: spec: # It can be active/stop engineState: 'active' - #ex. values: ns1:name=percona,ns2:run=nginx - auxiliaryAppInfo: '' appinfo: appns: 'default' applabel: 'app=nginx' appkind: 'deployment' - chaosServiceAccount: pod-cpu-hog-sa + chaosServiceAccount: pod-cpu-hog-exec-sa experiments: - - name: pod-cpu-hog + - name: pod-cpu-hog-exec spec: components: env: - # Provide name of target container - # where chaos has to be injected - - name: TARGET_CONTAINER - value: 'nginx' - #number of cpu cores to be consumed #verify the resources the app has been launched with - name: CPU_CORES value: '1' - name: TOTAL_CHAOS_DURATION - value: '60' # in seconds - \ No newline at end of file + value: '60' # in seconds \ No newline at end of file diff --git a/charts/generic/pod-cpu-hog/ansible/experiment.yaml b/charts/generic/pod-cpu-hog-exec/experiment.yaml similarity index 53% rename from charts/generic/pod-cpu-hog/ansible/experiment.yaml rename to charts/generic/pod-cpu-hog-exec/experiment.yaml index 2dc1181..1152988 100644 --- a/charts/generic/pod-cpu-hog/ansible/experiment.yaml +++ b/charts/generic/pod-cpu-hog-exec/experiment.yaml @@ -4,9 +4,9 @@ description: Injects cpu consumption on pods belonging to an app deployment kind: ChaosExperiment metadata: - name: pod-cpu-hog + name: pod-cpu-hog-exec labels: - name: pod-cpu-hog + name: pod-cpu-hog-exec app.kubernetes.io/part-of: litmus app.kubernetes.io/component: chaosexperiment app.kubernetes.io/version: latest @@ -17,12 +17,23 @@ spec: - apiGroups: - "" - "batch" + - "apps" + - "apps.openshift.io" + - "argoproj.io" - "litmuschaos.io" resources: - "jobs" - "pods" - "pods/log" - "events" + - "replicationcontrollers" + - "deployments" + - "statefulsets" + - "daemonsets" + - "replicasets" + - "deploymentconfigs" + - "rollouts" + - "pods/exec" - "chaosengines" - "chaosexperiments" - "chaosresults" @@ -33,37 +44,45 @@ spec: - "patch" - "update" - "delete" - image: "litmuschaos/ansible-runner:latest" + - "deletecollection" + image: "litmuschaos/go-runner:ci" imagePullPolicy: Always args: - -c - - ansible-playbook ./experiments/generic/pod_cpu_hog/pod_cpu_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0 + - ./experiments -name pod-cpu-hog-exec command: - /bin/bash env: - - name: ANSIBLE_STDOUT_CALLBACK - value: 'default' - - - name: TARGET_CONTAINER - value: '' + - name: TOTAL_CHAOS_DURATION + value: '60' + ## Number of CPU cores to stress - name: CPU_CORES value: '1' - - name: TOTAL_CHAOS_DURATION - value: '60' # in seconds + ## Percentage of total pods to target + - name: PODS_AFFECTED_PERC + value: '' - # Period to wait before injection of chaos in sec + ## Period to wait before and after 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' - - name: LIB_IMAGE - value: 'litmuschaos/app-cpu-stress:latest' + - name: TARGET_PODS + value: '' + + ## it defines the sequence of chaos execution for multiple target pods + ## supported values: serial, parallel + - name: SEQUENCE + value: 'parallel' + labels: - name: pod-cpu-hog + name: pod-cpu-hog-exec app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: latest diff --git a/charts/generic/pod-cpu-hog-exec/pod-cpu-hog-exec.chartserviceversion.yaml b/charts/generic/pod-cpu-hog-exec/pod-cpu-hog-exec.chartserviceversion.yaml new file mode 100644 index 0000000..94ee3c9 --- /dev/null +++ b/charts/generic/pod-cpu-hog-exec/pod-cpu-hog-exec.chartserviceversion.yaml @@ -0,0 +1,47 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + createdAt: 2021-06-16T10:28:08Z + name: pod-cpu-hog-exec + version: 0.1.0 + annotations: + categories: Kubernetes + vendor: CNCF + support: https://slack.kubernetes.io/ +spec: + displayName: pod-cpu-hog-exec + categoryDescription: | + pod-cpu-hog-exec contains chaos to consume CPU resouces of specified containers in Kubernetes pods. + - Causes high CPU resource consumption utilizing one or more cores by triggering md5sum commands + - The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos. + keywords: + - Kubernetes + - CPU + platforms: + - GKE + - Packet(Kubeadm) + - Minikube + - EKS + - AKS + - Kind + maturity: alpha + maintainers: + - name: ksatchit + email: karthik@chaosnative.com + minKubeVersion: 1.12.0 + provider: + name: ChaosNative + 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/generic/pod-cpu-hog-exec + - name: Documentation + url: https://docs.litmuschaos.io/docs/pod-cpu-hog-exec/ + - name: Video + url: https://www.youtube.com/watch?v=MBGSPmZKb2I + icon: + - base64data: "" + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/pod-cpu-hog-exec/experiment.yaml diff --git a/charts/generic/pod-cpu-hog-exec/rbac-psp.yaml b/charts/generic/pod-cpu-hog-exec/rbac-psp.yaml new file mode 100644 index 0000000..0a9ae54 --- /dev/null +++ b/charts/generic/pod-cpu-hog-exec/rbac-psp.yaml @@ -0,0 +1,61 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +rules: +- apiGroups: [""] + resources: ["pods","events"] + verbs: ["create","list","get","patch","update","delete","deletecollection"] +- apiGroups: [""] + resources: ["pods/exec","pods/log","replicationcontrollers"] + verbs: ["create","list","get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create","list","get","delete","deletecollection"] +- apiGroups: ["apps"] + resources: ["deployments","statefulsets","daemonsets","replicasets"] + verbs: ["list","get"] +- apiGroups: ["apps.openshift.io"] + resources: ["deploymentconfigs"] + verbs: ["list","get"] +- apiGroups: ["argoproj.io"] + resources: ["rollouts"] + verbs: ["list","get"] +- apiGroups: ["litmuschaos.io"] + resources: ["chaosengines","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update"] +- apiGroups: ["policy"] + resources: ["podsecuritypolicies"] + verbs: ["use"] + resourceNames: ["litmus"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: pod-cpu-hog-exec-sa +subjects: +- kind: ServiceAccount + name: pod-cpu-hog-exec-sa + namespace: default diff --git a/charts/generic/pod-cpu-hog-exec/rbac.yaml b/charts/generic/pod-cpu-hog-exec/rbac.yaml new file mode 100644 index 0000000..7f84c71 --- /dev/null +++ b/charts/generic/pod-cpu-hog-exec/rbac.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +rules: +- apiGroups: [""] + resources: ["pods","events"] + verbs: ["create","list","get","patch","update","delete","deletecollection"] +- apiGroups: [""] + resources: ["pods/exec","pods/log","replicationcontrollers"] + verbs: ["create","list","get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create","list","get","delete","deletecollection"] +- apiGroups: ["apps"] + resources: ["deployments","statefulsets","daemonsets","replicasets"] + verbs: ["list","get"] +- apiGroups: ["apps.openshift.io"] + resources: ["deploymentconfigs"] + verbs: ["list","get"] +- apiGroups: ["argoproj.io"] + resources: ["rollouts"] + verbs: ["list","get"] +- apiGroups: ["litmuschaos.io"] + resources: ["chaosengines","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: pod-cpu-hog-exec-sa + namespace: default + labels: + name: pod-cpu-hog-exec-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: pod-cpu-hog-exec-sa +subjects: +- kind: ServiceAccount + name: pod-cpu-hog-exec-sa + namespace: default diff --git a/charts/generic/pod-cpu-hog/ansible/rbac.yaml b/charts/generic/pod-cpu-hog/ansible/rbac.yaml deleted file mode 100644 index 011a55f..0000000 --- a/charts/generic/pod-cpu-hog/ansible/rbac.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: pod-cpu-hog-sa - namespace: default - labels: - name: pod-cpu-hog-sa - app.kubernetes.io/part-of: litmus ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: pod-cpu-hog-sa - namespace: default - labels: - name: pod-cpu-hog-sa - app.kubernetes.io/part-of: litmus -rules: -- apiGroups: ["","litmuschaos.io","batch"] - resources: ["pods","jobs","events","pods/log","chaosengines","chaosexperiments","chaosresults"] - verbs: ["create","list","get","patch","update","delete"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: pod-cpu-hog-sa - namespace: default - labels: - name: pod-cpu-hog-sa - app.kubernetes.io/part-of: litmus -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: pod-cpu-hog-sa -subjects: -- kind: ServiceAccount - name: pod-cpu-hog-sa - namespace: default diff --git a/charts/generic/pod-cpu-hog/engine.yaml b/charts/generic/pod-cpu-hog/engine.yaml index 0aaf702..4df7272 100644 --- a/charts/generic/pod-cpu-hog/engine.yaml +++ b/charts/generic/pod-cpu-hog/engine.yaml @@ -17,10 +17,8 @@ spec: spec: components: env: - #number of cpu cores to be consumed - #verify the resources the app has been launched with - name: CPU_CORES - value: '1' + value: '1' - name: TOTAL_CHAOS_DURATION - value: '60' # in seconds \ No newline at end of file + value: '60' # in seconds diff --git a/charts/generic/pod-cpu-hog/experiment.yaml b/charts/generic/pod-cpu-hog/experiment.yaml index 563a2d4..b4172dd 100644 --- a/charts/generic/pod-cpu-hog/experiment.yaml +++ b/charts/generic/pod-cpu-hog/experiment.yaml @@ -45,7 +45,7 @@ spec: - "update" - "delete" - "deletecollection" - image: "litmuschaos/go-runner:latest" + image: "litmuschaos/go-runner:ci" imagePullPolicy: Always args: - -c @@ -58,7 +58,7 @@ spec: ## Number of CPU cores to stress - name: CPU_CORES - value: '1' + value: '1' ## Percentage of total pods to target - name: PODS_AFFECTED_PERC @@ -75,11 +75,15 @@ spec: ## It is used in pumba lib only - name: LIB_IMAGE - value: 'litmuschaos/go-runner:latest' + value: 'litmuschaos/go-runner:ci' ## It is used in pumba lib only - name: STRESS_IMAGE - value: 'alexeiled/stress-ng:latest-ubuntu' + value: 'alexeiled/stress-ng:latest-ubuntu' + + ## provide the cluster runtime + - name: CONTAINER_RUNTIME + value: 'docker' # provide the socket file path # it is used in pumba lib diff --git a/charts/generic/pod-cpu-hog/pod-cpu-hog.chartserviceversion.yaml b/charts/generic/pod-cpu-hog/pod-cpu-hog.chartserviceversion.yaml index 68c3b91..7d6c997 100644 --- a/charts/generic/pod-cpu-hog/pod-cpu-hog.chartserviceversion.yaml +++ b/charts/generic/pod-cpu-hog/pod-cpu-hog.chartserviceversion.yaml @@ -1,9 +1,9 @@ apiVersion: litmuchaos.io/v1alpha1 kind: ChartServiceVersion metadata: - createdAt: 2019-01-07T10:28:08Z + createdAt: 2021-06-16T10:28:08Z name: pod-cpu-hog - version: 0.1.8 + version: 0.1.0 annotations: categories: Kubernetes vendor: CNCF @@ -11,8 +11,9 @@ metadata: spec: displayName: pod-cpu-hog categoryDescription: | - Pod-CPU-Hog contains chaos to consume CPU resouces of specified containers in Kubernetes pods. - - Causes high CPU resource consumption utilizing one or more cores by triggering md5sum commands + Pod-CPU-Hog contains chaos to consume CPU resouces of specified containers in Kubernetes pods. + - Causes CPU resource consumption on specified application containers using cgroups and litmus nsutil which consume CPU resources of the given target containers. + - It Can test the application's resilience to potential slowness/unavailability of some replicas due to high CPU load - The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos. keywords: - Kubernetes @@ -27,10 +28,12 @@ spec: maturity: alpha maintainers: - name: ksatchit - email: karthik.s@mayadata.io + email: karthik@chaosnative.com + - name: Udit Gaurav + email: udit@chaosnative.com minKubeVersion: 1.12.0 provider: - name: Mayadata + name: ChaosNative labels: app.kubernetes.io/component: chartserviceversion app.kubernetes.io/version: latest diff --git a/charts/generic/pod-io-stress/experiment.yaml b/charts/generic/pod-io-stress/experiment.yaml index 3ef86fb..66119e2 100644 --- a/charts/generic/pod-io-stress/experiment.yaml +++ b/charts/generic/pod-io-stress/experiment.yaml @@ -46,7 +46,7 @@ spec: - "update" - "delete" - "deletecollection" - image: "litmuschaos/go-runner:latest" + image: "litmuschaos/go-runner:ci" imagePullPolicy: Always args: - -c @@ -88,16 +88,19 @@ spec: value: '' # Provide the LIB here - # Only pumba supported + # support litmus and pumba - name: LIB - value: 'pumba' + value: 'litmus' # provide lib image - name: LIB_IMAGE - value: 'litmuschaos/go-runner:latest' + value: 'litmuschaos/go-runner:ci' + + ## provide the cluster runtime + - name: CONTAINER_RUNTIME + value: 'docker' # provide the socket file path - # it is used in pumba lib - name: SOCKET_PATH value: '/var/run/docker.sock' diff --git a/charts/generic/pod-memory-hog/ansible/engine.yaml b/charts/generic/pod-memory-hog-exec/engine.yaml similarity index 60% rename from charts/generic/pod-memory-hog/ansible/engine.yaml rename to charts/generic/pod-memory-hog-exec/engine.yaml index 9431487..fa6ca86 100644 --- a/charts/generic/pod-memory-hog/ansible/engine.yaml +++ b/charts/generic/pod-memory-hog-exec/engine.yaml @@ -6,28 +6,20 @@ metadata: spec: # It can be active/stop engineState: 'active' - #ex. values: ns1:name=percona,ns2:run=nginx - auxiliaryAppInfo: '' appinfo: appns: 'default' applabel: 'app=nginx' appkind: 'deployment' - chaosServiceAccount: pod-memory-hog-sa + chaosServiceAccount: pod-memory-hog-exec-sa experiments: - - name: pod-memory-hog + - name: pod-memory-hog-exec spec: components: env: - # Provide name of target container - # where chaos has to be injected - - name: TARGET_CONTAINER - value: 'nginx' - # Enter the amount of memory in megabytes to be consumed by the application pod - # default: 500 (Megabytes) - name: MEMORY_CONSUMPTION value: '500' - name: TOTAL_CHAOS_DURATION value: '60' # in seconds - + \ No newline at end of file diff --git a/charts/generic/pod-memory-hog-exec/experiment.yaml b/charts/generic/pod-memory-hog-exec/experiment.yaml new file mode 100644 index 0000000..a2f316f --- /dev/null +++ b/charts/generic/pod-memory-hog-exec/experiment.yaml @@ -0,0 +1,89 @@ +--- +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Injects memory consumption on pods belonging to an app deployment +kind: ChaosExperiment +metadata: + name: pod-memory-hog-exec + labels: + name: pod-memory-hog-exec + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: chaosexperiment + app.kubernetes.io/version: latest +spec: + definition: + scope: Namespaced + permissions: + - apiGroups: + - "" + - "batch" + - "apps" + - "apps.openshift.io" + - "argoproj.io" + - "litmuschaos.io" + resources: + - "jobs" + - "pods" + - "pods/log" + - "replicationcontrollers" + - "deployments" + - "statefulsets" + - "daemonsets" + - "replicasets" + - "deploymentconfigs" + - "rollouts" + - "pods/exec" + - "events" + - "chaosengines" + - "chaosexperiments" + - "chaosresults" + verbs: + - "create" + - "list" + - "get" + - "patch" + - "update" + - "delete" + - "deletecollection" + image: "litmuschaos/go-runner:ci" + imagePullPolicy: Always + args: + - -c + - ./experiments -name pod-memory-hog-exec + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: '60' + + ## enter the amount of memory in megabytes to be consumed by the application pod + - name: MEMORY_CONSUMPTION + value: '500' + + ## percentage of total pods to target + - name: PODS_AFFECTED_PERC + value: '' + + ## Period to wait before and after 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' + + ## it defines the sequence of chaos execution for multiple target pods + ## supported values: serial, parallel + - name: SEQUENCE + value: 'parallel' + + - name: TARGET_PODS + value: '' + + labels: + name: pod-memory-hog-exec + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/version: latest diff --git a/charts/generic/pod-memory-hog-exec/pod-memory-hog-exec.chartserviceversion.yaml b/charts/generic/pod-memory-hog-exec/pod-memory-hog-exec.chartserviceversion.yaml new file mode 100644 index 0000000..d24a730 --- /dev/null +++ b/charts/generic/pod-memory-hog-exec/pod-memory-hog-exec.chartserviceversion.yaml @@ -0,0 +1,47 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + createdAt: 2020-04-10T10:28:08Z + name: pod-memory-hog-exec + version: 0.1.4 + annotations: + categories: Kubernetes + vendor: CNCF + support: https://slack.kubernetes.io/ +spec: + displayName: pod-memory-hog-exec + categoryDescription: | + pod-memory-hog-exec contains chaos to consume Memory resouces of specified containers in Kubernetes pods. + - Consumes the memory specified by executing a dd command against special files /dev/zero(input) and /dev/null(output) + - The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos. + keywords: + - Kubernetes + - Memory + platforms: + - GKE + - Packet(Kubeadm) + - Minikube + - EKS + - AKS + - OpenShift(OKD) + maturity: alpha + maintainers: + - name: Udit Gaurav + email: udit@chaosnative.com + minKubeVersion: 1.12.0 + provider: + name: ChaosNative + 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/generic/pod-memory-hog-exec + - name: Documentation + url: https://docs.litmuschaos.io/docs/pod-memory-hog-exec/ + - name: Video + url: https://www.youtube.com/watch?v=HuAXg8W5Tzo + icon: + - base64data: "" + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/pod-memory-hog-exec/experiment.yaml diff --git a/charts/generic/pod-memory-hog-exec/rbac-psp.yaml b/charts/generic/pod-memory-hog-exec/rbac-psp.yaml new file mode 100644 index 0000000..7dffa9d --- /dev/null +++ b/charts/generic/pod-memory-hog-exec/rbac-psp.yaml @@ -0,0 +1,61 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +rules: +- apiGroups: [""] + resources: ["pods","events"] + verbs: ["create","list","get","patch","update","delete","deletecollection"] +- apiGroups: [""] + resources: ["pods/exec","pods/log","replicationcontrollers"] + verbs: ["create","list","get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create","list","get","delete","deletecollection"] +- apiGroups: ["apps"] + resources: ["deployments","statefulsets","daemonsets","replicasets"] + verbs: ["list","get"] +- apiGroups: ["apps.openshift.io"] + resources: ["deploymentconfigs"] + verbs: ["list","get"] +- apiGroups: ["argoproj.io"] + resources: ["rollouts"] + verbs: ["list","get"] +- apiGroups: ["litmuschaos.io"] + resources: ["chaosengines","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update"] +- apiGroups: ["policy"] + resources: ["podsecuritypolicies"] + verbs: ["use"] + resourceNames: ["litmus"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: pod-memory-hog-exec-sa +subjects: +- kind: ServiceAccount + name: pod-memory-hog-exec-sa + namespace: default diff --git a/charts/generic/pod-memory-hog-exec/rbac.yaml b/charts/generic/pod-memory-hog-exec/rbac.yaml new file mode 100644 index 0000000..4fa73de --- /dev/null +++ b/charts/generic/pod-memory-hog-exec/rbac.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +rules: +- apiGroups: [""] + resources: ["pods","events"] + verbs: ["create","list","get","patch","update","delete","deletecollection"] +- apiGroups: [""] + resources: ["pods/exec","pods/log","replicationcontrollers"] + verbs: ["create","list","get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create","list","get","delete","deletecollection"] +- apiGroups: ["apps"] + resources: ["deployments","statefulsets","daemonsets","replicasets"] + verbs: ["list","get"] +- apiGroups: ["apps.openshift.io"] + resources: ["deploymentconfigs"] + verbs: ["list","get"] +- apiGroups: ["argoproj.io"] + resources: ["rollouts"] + verbs: ["list","get"] +- apiGroups: ["litmuschaos.io"] + resources: ["chaosengines","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: pod-memory-hog-exec-sa + namespace: default + labels: + name: pod-memory-hog-exec-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: pod-memory-hog-exec-sa +subjects: +- kind: ServiceAccount + name: pod-memory-hog-exec-sa + namespace: default diff --git a/charts/generic/pod-memory-hog/ansible/experiment.yaml b/charts/generic/pod-memory-hog/ansible/experiment.yaml deleted file mode 100644 index 7a61889..0000000 --- a/charts/generic/pod-memory-hog/ansible/experiment.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: litmuschaos.io/v1alpha1 -description: - message: | - Injects memory consumption on pods belonging to an app deployment -kind: ChaosExperiment -metadata: - name: pod-memory-hog - labels: - name: pod-memory-hog - app.kubernetes.io/part-of: litmus - app.kubernetes.io/component: chaosexperiment - app.kubernetes.io/version: latest -spec: - definition: - scope: Namespaced - permissions: - - apiGroups: - - "" - - "batch" - - "litmuschaos.io" - resources: - - "jobs" - - "pods" - - "pods/log" - - "events" - - "chaosengines" - - "chaosexperiments" - - "chaosresults" - verbs: - - "create" - - "list" - - "get" - - "patch" - - "update" - - "delete" - image: "litmuschaos/ansible-runner:latest" - imagePullPolicy: Always - args: - - -c - - ansible-playbook ./experiments/generic/pod_memory_hog/pod_memory_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0 - command: - - /bin/bash - env: - - name: ANSIBLE_STDOUT_CALLBACK - value: 'default' - - # Provide name of target container - # where chaos has to be injected - - name: TARGET_CONTAINER - value: '' - - # Enter the amount of memory in megabytes to be consumed by the application pod - # default: 500 (Megabytes) - - name: MEMORY_CONSUMPTION - value: '500' - - - name: TOTAL_CHAOS_DURATION - value: '60' # in seconds - - # Period to wait before and after injection of chaos in sec - - name: RAMP_TIME - value: '' - - - name: LIB - value: 'litmus' - - - name: LIB_IMAGE - value: 'litmuschaos/app-memory-stress:latest' - labels: - name: pod-memory-hog - app.kubernetes.io/part-of: litmus - app.kubernetes.io/component: experiment-job - app.kubernetes.io/version: latest diff --git a/charts/generic/pod-memory-hog/ansible/rbac.yaml b/charts/generic/pod-memory-hog/ansible/rbac.yaml deleted file mode 100644 index b3e5167..0000000 --- a/charts/generic/pod-memory-hog/ansible/rbac.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: pod-memory-hog-sa - namespace: default - labels: - name: pod-memory-hog-sa - app.kubernetes.io/part-of: litmus ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: pod-memory-hog-sa - namespace: default - labels: - name: pod-memory-hog-sa - app.kubernetes.io/part-of: litmus -rules: -- apiGroups: ["","litmuschaos.io","batch"] - resources: ["pods","jobs","events","pods/log","chaosengines","chaosexperiments","chaosresults"] - verbs: ["create","list","get","patch","update","delete"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: pod-memory-hog-sa - namespace: default - labels: - name: pod-memory-hog-sa - app.kubernetes.io/part-of: litmus -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: pod-memory-hog-sa -subjects: -- kind: ServiceAccount - name: pod-memory-hog-sa - namespace: default diff --git a/charts/generic/pod-memory-hog/engine.yaml b/charts/generic/pod-memory-hog/engine.yaml index b146e19..2a96906 100644 --- a/charts/generic/pod-memory-hog/engine.yaml +++ b/charts/generic/pod-memory-hog/engine.yaml @@ -20,6 +20,8 @@ spec: - name: MEMORY_CONSUMPTION value: '500' + - name: NUMBER_OF_WORKERS + value: '1' + - name: TOTAL_CHAOS_DURATION value: '60' # in seconds - \ No newline at end of file diff --git a/charts/generic/pod-memory-hog/experiment.yaml b/charts/generic/pod-memory-hog/experiment.yaml index 2217710..4e04c3d 100644 --- a/charts/generic/pod-memory-hog/experiment.yaml +++ b/charts/generic/pod-memory-hog/experiment.yaml @@ -46,7 +46,7 @@ spec: - "update" - "delete" - "deletecollection" - image: "litmuschaos/go-runner:latest" + image: "litmuschaos/go-runner:ci" imagePullPolicy: Always args: - -c @@ -60,6 +60,10 @@ spec: ## enter the amount of memory in megabytes to be consumed by the application pod - name: MEMORY_CONSUMPTION value: '500' + + ## Number of workers to perform stress + - name: NUMBER_OF_WORKERS + value: '1' ## percentage of total pods to target - name: PODS_AFFECTED_PERC @@ -76,7 +80,7 @@ spec: ## It is used in pumba lib only - name: LIB_IMAGE - value: 'litmuschaos/go-runner:latest' + value: 'litmuschaos/go-runner:ci' ## It is used in pumba lib only - name: STRESS_IMAGE diff --git a/charts/generic/pod-memory-hog/pod-memory-hog.chartserviceversion.yaml b/charts/generic/pod-memory-hog/pod-memory-hog.chartserviceversion.yaml index 46ae6f0..c9fb45a 100644 --- a/charts/generic/pod-memory-hog/pod-memory-hog.chartserviceversion.yaml +++ b/charts/generic/pod-memory-hog/pod-memory-hog.chartserviceversion.yaml @@ -1,9 +1,9 @@ apiVersion: litmuchaos.io/v1alpha1 kind: ChartServiceVersion metadata: - createdAt: 2020-04-10T10:28:08Z + createdAt: 2021-06-16T10:28:08Z name: pod-memory-hog - version: 0.1.4 + version: 0.1.0 annotations: categories: Kubernetes vendor: CNCF @@ -11,8 +11,9 @@ metadata: spec: displayName: pod-memory-hog categoryDescription: | - Pod-Memory-Hog contains chaos to consume Memory resouces of specified containers in Kubernetes pods. - - Consumes the memory specified by executing a dd command against special files /dev/zero(input) and /dev/null(output) + Pod-Memory-Hog contains chaos to consume memory resouces of specified containers in Kubernetes pods. + - Causes memory resource consumption on specified application containers using cgroups and litmus nsutil that consume memory resources of the given target containers. + - It Can test the application's resilience to potential slowness/unavailability of some replicas due to high memory load - The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos. keywords: - Kubernetes @@ -27,10 +28,10 @@ spec: maturity: alpha maintainers: - name: Udit Gaurav - email: udit.gaurav@mayadata.io + email: udit@chaosnative.com minKubeVersion: 1.12.0 provider: - name: Mayadata + name: ChaosNative labels: app.kubernetes.io/component: chartserviceversion app.kubernetes.io/version: latest diff --git a/scripts/combine-all-crs.go b/scripts/combine-all-crs.go index 8781a6c..9df0b2b 100644 --- a/scripts/combine-all-crs.go +++ b/scripts/combine-all-crs.go @@ -50,7 +50,7 @@ func main() { CRName, err := GetCRName(subdirectory + "/experiment.yaml") if err != nil || CRName == "" { - log.Fatalf("unable to extract the CR name, err: %v", err) + log.Fatalf("unable to extract the CR name for %v file, err: %v", subdirectory+"/experiment.yaml", err) } if !Contains(CRName, CRNames) {