diff --git a/charts/gcp/gcp-vm-disk-loss/engine.yaml b/charts/gcp/gcp-vm-disk-loss/engine.yaml new file mode 100644 index 0000000..dfa3acf --- /dev/null +++ b/charts/gcp/gcp-vm-disk-loss/engine.yaml @@ -0,0 +1,42 @@ +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: gcp-disk-chaos + namespace: default +spec: + # It can be active/stop + engineState: 'active' + chaosServiceAccount: gcp-vm-disk-loss-sa + experiments: + - name: gcp-vm-disk-loss + spec: + components: + env: + # set chaos duration (in sec) as desired + - name: TOTAL_CHAOS_DURATION + value: '30' + + # set chaos interval (in sec) as desired + - name: CHAOS_INTERVAL + value: '30' + + # set the GCP project id + - name: GCP_PROJECT_ID + value: '' + + # set the disk volume name(s) as comma seperated values + # eg. volume1,volume2,... + - name: DISK_VOLUME_NAMES + value: '' + + # set the disk zone(s) as comma seperated values in the corresponding + # order of DISK_VOLUME_NAME + # eg. zone1,zone2,... + - name: DISK_ZONES + value: '' + + # set the device name(s) as comma seperated values in the corresponding + # order of DISK_VOLUME_NAME + # eg. device1,device2,... + - name: DEVICE_NAMES + value: '' diff --git a/charts/gcp/gcp-vm-disk-loss/experiment.yaml b/charts/gcp/gcp-vm-disk-loss/experiment.yaml new file mode 100644 index 0000000..d6e0a29 --- /dev/null +++ b/charts/gcp/gcp-vm-disk-loss/experiment.yaml @@ -0,0 +1,93 @@ +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Causes loss of a non-boot storage persistent disk from a GCP VM instance for a specified duration of time +kind: ChaosExperiment +metadata: + name: gcp-vm-disk-loss + labels: + name: gcp-vm-disk-loss + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: chaosexperiment + app.kubernetes.io/version: latest +spec: + definition: + scope: Cluster + permissions: + - apiGroups: + - "" + - "batch" + - "litmuschaos.io" + resources: + - "jobs" + - "pods" + - "pods/log" + - "events" + - "secrets" + - "pods/exec" + - "chaosengines" + - "chaosexperiments" + - "chaosresults" + verbs: + - "create" + - "list" + - "get" + - "patch" + - "update" + - "delete" + - "deletecollection" + image: "litmuschaos/go-runner:ci" + imagePullPolicy: Always + args: + - -c + - ./experiments -name gcp-vm-disk-loss + command: + - /bin/bash + env: + + - name: TOTAL_CHAOS_DURATION + value: '30' + + - name: CHAOS_INTERVAL + value: '30' + + - name: LIB + value: 'litmus' + + # Period to wait before and after injection of chaos in sec + - name: RAMP_TIME + value: '' + + # parallel or serial; determines how chaos is injected + - name: SEQUENCE + value: 'parallel' + + # set the GCP project id + - name: GCP_PROJECT_ID + value: '' + + # set the disk volume name(s) as comma seperated values + # eg. volume1,volume2,... + - name: DISK_VOLUME_NAMES + value: '' + + # set the disk zone(s) as comma seperated values in the corresponding + # order of DISK_VOLUME_NAME + # eg. zone1,zone2,... + - name: DISK_ZONES + value: '' + + # set the device name(s) as comma seperated values in the corresponding + # order of DISK_VOLUME_NAME + # eg. device1,device2,... + - name: DEVICE_NAMES + value: '' + + labels: + name: gcp-vm-disk-loss + 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/gcp/gcp-vm-disk-loss/gcp-vm-disk-loss.chartserviceversion.yaml b/charts/gcp/gcp-vm-disk-loss/gcp-vm-disk-loss.chartserviceversion.yaml new file mode 100644 index 0000000..d7b70e9 --- /dev/null +++ b/charts/gcp/gcp-vm-disk-loss/gcp-vm-disk-loss.chartserviceversion.yaml @@ -0,0 +1,34 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + name: gcp-vm-disk-loss + version: 0.1.0 + annotations: + categories: gcp +spec: + displayName: gcp-vm-disk-loss + categoryDescription: > + Causes loss of a non-boot storage persistent disk from a GCP VM instance for a specified duration of time + keywords: + - "persistent-disks" + - "kubernetes" + - "gcp" + platforms: + - "GCP" + maturity: alpha + maintainers: + - name: neelanjan00 + email: neelanjan@chaosnative.com + minKubeVersion: 1.12.0 + provider: + name: ChaosNative + labels: + app.kubernetes.io/component: chartserviceversion + app.kubernetes.io/version: latest + links: + - name: Documentation + url: https://docs.litmuschaos.io/docs/getstarted/ + icon: + - url: + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/gcp/gcp-vm-disk-loss/experiment.yaml diff --git a/charts/gcp/gcp-vm-disk-loss/rbac.yaml b/charts/gcp/gcp-vm-disk-loss/rbac.yaml new file mode 100644 index 0000000..286fe0e --- /dev/null +++ b/charts/gcp/gcp-vm-disk-loss/rbac.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: gcp-vm-disk-loss-sa + namespace: default + labels: + name: gcp-vm-disk-loss-sa + app.kubernetes.io/part-of: litmus +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: gcp-vm-disk-loss-sa + labels: + name: gcp-vm-disk-loss-sa + app.kubernetes.io/part-of: litmus +rules: +- apiGroups: [""] + resources: ["pods","events","secrets"] + verbs: ["create","list","get","patch","update","delete","deletecollection"] +- apiGroups: [""] + resources: ["pods/exec","pods/log"] + verbs: ["create","list","get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["create","list","get","delete","deletecollection"] +- apiGroups: ["litmuschaos.io"] + resources: ["chaosengines","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: gcp-vm-disk-loss-sa + labels: + name: gcp-vm-disk-loss-sa + app.kubernetes.io/part-of: litmus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: gcp-vm-disk-loss-sa +subjects: +- kind: ServiceAccount + name: gcp-vm-disk-loss-sa + namespace: default \ No newline at end of file diff --git a/charts/gcp/gcp-vm-instance-stop/experiment.yaml b/charts/gcp/gcp-vm-instance-stop/experiment.yaml index 77ff5c3..791c989 100644 --- a/charts/gcp/gcp-vm-instance-stop/experiment.yaml +++ b/charts/gcp/gcp-vm-instance-stop/experiment.yaml @@ -63,7 +63,7 @@ spec: # period to wait before and after injection of chaos in sec - name: RAMP_TIME - value: '0' + value: '' # enable or disable; shall be enabled if the target instance is a part of an auto scaling group. - name: AUTO_SCALING_GROUP diff --git a/charts/gcp/gcp-vm-instance-stop/gcp-vm-instance-stop.chartserviceversion.yaml b/charts/gcp/gcp-vm-instance-stop/gcp-vm-instance-stop.chartserviceversion.yaml index 977aee4..7916c3d 100644 --- a/charts/gcp/gcp-vm-instance-stop/gcp-vm-instance-stop.chartserviceversion.yaml +++ b/charts/gcp/gcp-vm-instance-stop/gcp-vm-instance-stop.chartserviceversion.yaml @@ -14,7 +14,7 @@ spec: - "kubernetes" - "gcp" platforms: - - "GKE" + - "GCP" maturity: alpha maintainers: - name: neelanjan00 diff --git a/charts/gcp/gcp.chartserviceversion.yaml b/charts/gcp/gcp.chartserviceversion.yaml index 7f1909a..9620465 100644 --- a/charts/gcp/gcp.chartserviceversion.yaml +++ b/charts/gcp/gcp.chartserviceversion.yaml @@ -11,10 +11,12 @@ spec: GCP contains chaos to disrupt state of gcp resources running part of the gcp services experiments: - gcp-vm-instance-stop + - gcp-vm-disk-loss keywords: - "pods" - "kubernetes" - - "gcp" + - "disk" + - "gcp" maintainers: - name: neelanjan00 email: neelanjan@chaosnative.com diff --git a/charts/gcp/gcp.package.yaml b/charts/gcp/gcp.package.yaml index 3b93ea9..eea3155 100644 --- a/charts/gcp/gcp.package.yaml +++ b/charts/gcp/gcp.package.yaml @@ -3,3 +3,6 @@ experiments: - name: gcp-vm-instance-stop CSV: gcp-vm-instance-stop.chartserviceversion.yaml desc: "gcp-vm-instance-stop" + - name: gcp-vm-disk-loss + CSV: gcp-vm-disk-loss.chartserviceversion.yaml + desc: "gcp-vm-disk-loss" diff --git a/charts/gcp/icons/gcp-vm-disk-loss.png b/charts/gcp/icons/gcp-vm-disk-loss.png new file mode 100644 index 0000000..1b1b94c Binary files /dev/null and b/charts/gcp/icons/gcp-vm-disk-loss.png differ