From fc95d63abb1f3011a709aa41f5909fcbb4f8fa9c Mon Sep 17 00:00:00 2001 From: OUM NIVRATHI KALE Date: Tue, 14 Jun 2022 15:32:16 +0530 Subject: [PATCH] AWS-AZ - Adding experiment charts for aws az (#542) Signed-off-by: oumkale --- charts/generic/experiments.yaml | 1 - .../aws-az-chaos.chartserviceversion.yaml | 35 ++++++++ charts/kube-aws/aws-az-chaos/engine.yaml | 27 ++++++ charts/kube-aws/aws-az-chaos/experiment.yaml | 76 +++++++++++++++++ charts/kube-aws/aws-az-chaos/rbac.yaml | 60 ++++++++++++++ charts/kube-aws/experiments.yaml | 78 ++++++++++++++++++ charts/kube-aws/icons/aws-az-chaos.png | Bin 0 -> 3152 bytes .../kube-aws.chartserviceversion.yaml | 10 ++- charts/kube-aws/kube-aws.package.yaml | 5 +- 9 files changed, 287 insertions(+), 5 deletions(-) create mode 100755 charts/kube-aws/aws-az-chaos/aws-az-chaos.chartserviceversion.yaml create mode 100755 charts/kube-aws/aws-az-chaos/engine.yaml create mode 100755 charts/kube-aws/aws-az-chaos/experiment.yaml create mode 100755 charts/kube-aws/aws-az-chaos/rbac.yaml create mode 100644 charts/kube-aws/icons/aws-az-chaos.png diff --git a/charts/generic/experiments.yaml b/charts/generic/experiments.yaml index b669e86..8b9903e 100644 --- a/charts/generic/experiments.yaml +++ b/charts/generic/experiments.yaml @@ -2813,7 +2813,6 @@ spec: # Period to wait before and after injection of chaos in sec - name: RAMP_TIME value: '' - labels: name: node-drain app.kubernetes.io/part-of: litmus diff --git a/charts/kube-aws/aws-az-chaos/aws-az-chaos.chartserviceversion.yaml b/charts/kube-aws/aws-az-chaos/aws-az-chaos.chartserviceversion.yaml new file mode 100755 index 0000000..1632138 --- /dev/null +++ b/charts/kube-aws/aws-az-chaos/aws-az-chaos.chartserviceversion.yaml @@ -0,0 +1,35 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + name: aws-az-chaos + version: 0.1.0 + annotations: + categories: Kubernetes + vendor: CNCF + support: https://slack.kubernetes.io/ +spec: + displayName: aws-az-chaos + categoryDescription: > + Execute aws-az chaos to detach the target zones from the load balancer + keywords: + - "zone" + - "load-balancer" + - "aws" + platforms: + - "AWS" + maturity: alpha + maintainers: + - name: oumkale + email: imkaleoum@gmail.com + labels: + app.kubernetes.io/component: chartserviceversion + app.kubernetes.io/version: latest + links: + - name: Source Code + url: https://github.com/litmuschaos/litmus-python/tree/master/experiments/aws_az + - name: Documentation + url: https://litmuschaos.github.io/litmus/experiments/categories/aws/aws-az-chaos/ + icon: + - url: + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/kube-aws/aws-az-chaos/experiment.yaml diff --git a/charts/kube-aws/aws-az-chaos/engine.yaml b/charts/kube-aws/aws-az-chaos/engine.yaml new file mode 100755 index 0000000..a7afbbc --- /dev/null +++ b/charts/kube-aws/aws-az-chaos/engine.yaml @@ -0,0 +1,27 @@ +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: aws-az-chaos +spec: + # It can be active/stop + engineState: 'active' + chaosServiceAccount: aws-az-chaos-sa + experiments: + - name: aws-az-chaos + spec: + components: + env: + - name: TOTAL_CHAOS_DURATION + value: '30' + - name: CHAOS_INTERVAL + value: '30' + #LOAD_BALANCER_NAME name of the load balancer + - name: LOAD_BALANCER_NAME + value: "" + #LOAD_BALANCER_ZONES can be multiple, provide it by comma separated + - name: LOAD_BALANCER_ZONES + value: "" + - name: LOAD_BALANCERNAME_ARN + value: "na" + - name: AWS_SHARED_CREDENTIALS_FILE + value: "/tmp/cloud_config.yml" diff --git a/charts/kube-aws/aws-az-chaos/experiment.yaml b/charts/kube-aws/aws-az-chaos/experiment.yaml new file mode 100755 index 0000000..921723b --- /dev/null +++ b/charts/kube-aws/aws-az-chaos/experiment.yaml @@ -0,0 +1,76 @@ +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Execute aws-az chaos to detach the target zones from the load balancer +kind: ChaosExperiment +metadata: + name: aws-az-chaos + labels: + name: aws-az-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 & secrets details and mount it to the experiment pod (if specified) + - apiGroups: [""] + resources: ["secrets","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"] + # 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/py-runner:latest" + imagePullPolicy: Always + args: + - -c + - python3 -u experiment -name aws-az-chaos + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: '30' + - name: CHAOS_INTERVAL + value: '30' + - name: LIB + value: 'litmus' + - name: LOAD_BALANCER_NAME + value: '' + - name: LOAD_BALANCER_ZONES + value: '' + - name: LOAD_BALANCERNAME_ARN + value: 'na' + - name: AWS_SHARED_CREDENTIALS_FILE + value: "/tmp/cloud_config.yml" + - name: RAMP_TIME + value: '' + labels: + name: aws-az-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/version: latest + secrets: + - name: cloud-secret + mountPath: /tmp/ diff --git a/charts/kube-aws/aws-az-chaos/rbac.yaml b/charts/kube-aws/aws-az-chaos/rbac.yaml new file mode 100755 index 0000000..3d2284c --- /dev/null +++ b/charts/kube-aws/aws-az-chaos/rbac.yaml @@ -0,0 +1,60 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: aws-az-chaos-sa + namespace: default + labels: + name: aws-az-chaos-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + name: aws-az-chaos-sa + namespace: default + labels: + name: aws-az-chaos-sa + app.kubernetes.io/part-of: litmus +rules: +# 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 & secrets details and mount it to the experiment pod (if specified) +- apiGroups: [""] + resources: ["secrets","configmaps"] + verbs: ["get","list",] +# Track and get the runner, experiment, and helper pods log +- apiGroups: [""] + resources: ["pods/log"] + verbs: ["get","list","watch"] +# 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"] +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: aws-az-chaos-sa + namespace: default + labels: + name: aws-az-chaos-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: aws-az-chaos-sa +subjects: +- kind: ServiceAccount + name: aws-az-chaos-sa + namespace: default \ No newline at end of file diff --git a/charts/kube-aws/experiments.yaml b/charts/kube-aws/experiments.yaml index 62215f9..91ca0fb 100644 --- a/charts/kube-aws/experiments.yaml +++ b/charts/kube-aws/experiments.yaml @@ -382,3 +382,81 @@ spec: mountPath: /tmp/ --- +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Execute aws-az chaos to detach the target zones from the load balancer +kind: ChaosExperiment +metadata: + name: aws-az-chaos + labels: + name: aws-az-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 & secrets details and mount it to the experiment pod (if specified) + - apiGroups: [""] + resources: ["secrets","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"] + # 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/py-runner:latest" + imagePullPolicy: Always + args: + - -c + - python3 -u experiment -name aws-az-chaos + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: '30' + - name: CHAOS_INTERVAL + value: '30' + - name: LIB + value: 'litmus' + - name: LOAD_BALANCER_NAME + value: '' + - name: LOAD_BALANCER_ZONES + value: '' + - name: LOAD_BALANCERNAME_ARN + value: 'na' + - name: AWS_SHARED_CREDENTIALS_FILE + value: "/tmp/cloud_config.yml" + - name: RAMP_TIME + value: '' + labels: + name: aws-az-chaos + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/version: latest + secrets: + - name: cloud-secret + mountPath: /tmp/ + +--- \ No newline at end of file diff --git a/charts/kube-aws/icons/aws-az-chaos.png b/charts/kube-aws/icons/aws-az-chaos.png new file mode 100644 index 0000000000000000000000000000000000000000..fd09e34f6cd5c49336db1bb357ebf14d82201274 GIT binary patch literal 3152 zcmV-W46pNvP)jCR+=d*`L+4czA#!(zllHgrc<0?fHf|Fh(o*wV0m%zf(KebGfH6AH;z62kK%;Gf<*SG zoGeJ~@lM*YtwDKSy0m~MPs<_;@+d6u7+I+Ma^dhOG9ovHN|#Nbc@N}~g=m6+x5)zN z2`6JUA!9D!{tqtDj;)P!sjV-h^Qhb7YH$^~Q=fv+S;nj3mF#S29^m+Ka_bzGE~=})MkhY&Cb#>R&+FCy z8XTS2$0jR*1)Cla()K`#lG1n*b+wSSHJwakiwP(X!C(mx&>yh4>O-A$_-Gdei<60s z4OaR1ck}#OB!Gypx{5c>47T+|rxN+iUMy|+WL=E1h8t@TuZ@pdSfVuARDn;X>v+P#f-xo-|w4Z10; z#?6jZY`>`4U6YcAP(JIXb>091kjmh=^PF#BfF%OQ>?|c}?`Qk?T&J^dpqtAA!UrN_ zNE>GS@=Xy??!Fj;@y2Cl+(9`xLzSSwtp;Mq;vrr6)*>4dFU9K<2L(hT?U<9LoDac7 z>jF4dclMeRfH=i>4~mA!n?GT=>PJS(GjnbZ8O4+?jK+xAgmk|Zdz zPXR$|{?_eQ7kn~=;a4~!@){v`1K1bQ^R@W}!<3wmgSLk{nI&ULKsgoAoBWoeXlD8y zs{L6k544X7zD5Vplas=0IudFT6c&tNXe8n=h+L?pq1q5`@!^gVl#DDdZ z=SaeHN`L@^p&hTxAc!EL77MKK<>4+~GEG1+eR*$JYe2t-Zib6OL{3-Ink1#Fa?(%N zh8T~t)CGxl7qhN*RzPTO=~ERFWbhiqRMH)9u>xXMe{fN_maEYh@aQM)s(qvgKpA%3 z_KXlRyuxI9(+zQ$h4-P5AkO(ZTl}XK5Ch^VLX7nc?a*CC@Oh{wwxWE-qCd{T_oJ*f z*w%Eara=J_R037c^$6brCI45o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