diff --git a/charts/generic/generic.chartserviceversion.yaml b/charts/generic/generic.chartserviceversion.yaml index ce089aa..ee617f7 100644 --- a/charts/generic/generic.chartserviceversion.yaml +++ b/charts/generic/generic.chartserviceversion.yaml @@ -29,6 +29,7 @@ spec: - pod-network-duplication - node-taint - docker-service-kill + - pod-autoscaler keywords: - Kubernetes diff --git a/charts/generic/generic.package.yaml b/charts/generic/generic.package.yaml index 5258a6e..35227b5 100644 --- a/charts/generic/generic.package.yaml +++ b/charts/generic/generic.package.yaml @@ -47,4 +47,7 @@ experiments: desc: "node-taint" - name: docker-service-kill CSV: docker-service-kill.chartserviceversion.yaml - desc: "docker-service-kill" \ No newline at end of file + desc: "docker-service-kill" + - name: pod-autoscaler + CSV: pod-autoscaler.chartserviceversion.yaml + desc: "pod-autoscaler" diff --git a/charts/generic/icons/pod-autoscaler.png b/charts/generic/icons/pod-autoscaler.png new file mode 100644 index 0000000..5d13f6b Binary files /dev/null and b/charts/generic/icons/pod-autoscaler.png differ diff --git a/charts/generic/pod-autoscaler/engine.yaml b/charts/generic/pod-autoscaler/engine.yaml new file mode 100644 index 0000000..d43016b --- /dev/null +++ b/charts/generic/pod-autoscaler/engine.yaml @@ -0,0 +1,33 @@ +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: nginx-chaos + namespace: default +spec: + # It can be true/false + annotationCheck: 'false' + # 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-autoscaler-sa + monitoring: false + # It can be delete/retain + jobCleanUpPolicy: 'delete' + experiments: + - name: pod-autoscaler + spec: + components: + env: + # set chaos duration (in sec) as desired + - name: TOTAL_CHAOS_DURATION + value: '60' + + # number of replicas to scale + - name: REPLICA_COUNT + value: '5' + \ No newline at end of file diff --git a/charts/generic/pod-autoscaler/experiment.yaml b/charts/generic/pod-autoscaler/experiment.yaml new file mode 100644 index 0000000..13c6253 --- /dev/null +++ b/charts/generic/pod-autoscaler/experiment.yaml @@ -0,0 +1,67 @@ +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Scale the application replicas and test the node autoscaling on cluster +kind: ChaosExperiment +metadata: + name: pod-autoscaler + version: 0.1.0 +spec: + definition: + scope: Cluster + permissions: + - apiGroups: + - "" + - "batch" + - "apps" + - "litmuschaos.io" + resources: + - "jobs" + - "pods" + - "pods/log" + - "deployments" + - "events" + - "chaosengines" + - "chaosexperiments" + - "chaosresults" + verbs: + - "create" + - "list" + - "get" + - "patch" + - "update" + - "delete" + - apiGroups: + - "" + resources: + - "nodes" + verbs: + - "get" + - "list" + image: "litmuschaos/go-runner:latest" + imagePullPolicy: Always + args: + - -c + - ./experiments/pod-autoscaler + command: + - /bin/bash + env: + + - name: TOTAL_CHAOS_DURATION + value: '60' + + # Period to wait before and after injection of chaos in sec + - name: RAMP_TIME + value: '' + + # Number of replicas to scale + - name: REPLICA_COUNT + value: '5' + + # PROVIDE THE LIB HERE + # ONLY LITMUS SUPPORTED + - name: LIB + value: 'litmus' + + labels: + name: pod-autoscaler diff --git a/charts/generic/pod-autoscaler/pod-autoscaler.chartserviceversion.yaml b/charts/generic/pod-autoscaler/pod-autoscaler.chartserviceversion.yaml new file mode 100644 index 0000000..9e3e77e --- /dev/null +++ b/charts/generic/pod-autoscaler/pod-autoscaler.chartserviceversion.yaml @@ -0,0 +1,44 @@ +apiVersion: litmuchaos.io/v1alpha1 +kind: ChartServiceVersion +metadata: + createdAt: 2020-08-08T10:28:08Z + name: pod-autoscaler + version: 0.1.0 + annotations: + categories: Kubernetes + vendor: CNCF + support: https://slack.kubernetes.io/ +spec: + displayName: pod-autoscaler + categoryDescription: | + The experiment aims to check the ability of nodes to accommodate the number of replicas a given application pod. + This experiment can be used for other scenarios as well, such as for checking the Node auto-scaling feature. For example, check if the pods are successfully rescheduled within a specified period in cases where the existing nodes are already running at the specified limits. + keywords: + - Kubernetes + - Scale + - State + - Node + - Replicas + platforms: + - GKE + - EKS + - Minikube + maturity: alpha + chaosType: infra + maintainers: + - name: Udit Gaurav + email: udit.gaurav@mayadata.io + minKubeVersion: 1.12.0 + provider: + name: Mayadata + links: + - name: Source Code + url: https://github.com/litmuschaos/litmus-go/tree/master/experiments/generic/pod-autoscaler + - name: Documentation + url: https://docs.litmuschaos.io/docs/pod-autoscaler/ + - name: Video + url: + icon: + - url: + mediatype: "" + chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/pod-autoscaler/experiment.yaml diff --git a/charts/generic/pod-autoscaler/rbac.yaml b/charts/generic/pod-autoscaler/rbac.yaml new file mode 100644 index 0000000..5fe99c6 --- /dev/null +++ b/charts/generic/pod-autoscaler/rbac.yaml @@ -0,0 +1,37 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pod-autoscaler-sa + namespace: default + labels: + name: pod-autoscaler-sa +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: pod-autoscaler-sa + labels: + name: pod-autoscaler-sa +rules: +- apiGroups: ["","litmuschaos.io","batch","apps"] + resources: ["pods","deployments","jobs","events","chaosengines","pods/log","chaosexperiments","chaosresults"] + verbs: ["create","list","get","patch","update","delete"] +- apiGroups: [""] + resources: ["nodes"] + verbs: ["get","list"] +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: pod-autoscaler-sa + labels: + name: pod-autoscaler-sa +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: pod-autoscaler-sa +subjects: +- kind: ServiceAccount + name: pod-autoscaler-sa + namespace: default