generated from clouddrove/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: 🚀 Prepared addon for Keda (#32)
* feat: added keda addon * fix: fmt in main.tf * fix- removed the variable which were not in used * fix- removed the eks_cluster_name attribute * feat: added keda in basic example * fix- changed the version in readme file * feat- added keda outputs * feat- added strategy example --------- Co-authored-by: Anmol Nagpal <[email protected]>
- Loading branch information
1 parent
431e1a9
commit 3c989cb
Showing
21 changed files
with
1,097 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ jobs: | |
- name: Generate TF Docs | ||
uses: terraform-docs/[email protected] | ||
with: | ||
working-dir: addons/aws-ebs-csi-driver,addons/aws-efs-csi-driver,addons/aws-load-balancer-controller,addons/aws-node-termination-handler,addons/calico-tigera,addons/cluster-autoscaler,addons/external-secrets,addons/fluent-bit,addons/helm,addons/ingress-nginx,addons/istio-ingress,addons/karpenter,addons/kiali-server,addons/kubeclarity,addons/metrics-server,addons/nri-bundle,addons/velero,addons/kube-state-metrics | ||
working-dir: addons/aws-ebs-csi-driver,addons/aws-efs-csi-driver,addons/aws-load-balancer-controller,addons/aws-node-termination-handler,addons/calico-tigera,addons/cluster-autoscaler,addons/external-secrets,addons/fluent-bit,addons/helm,addons/ingress-nginx,addons/istio-ingress,addons/karpenter,addons/kiali-server,addons/kubeclarity,addons/metrics-server,addons/nri-bundle,addons/velero,addons/kube-state-metrics,addons/keda | ||
git-push: true | ||
template: |- | ||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: "eks.amazonaws.com/nodegroup" | ||
operator: In | ||
values: | ||
- "critical" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: nginx-deployment | ||
namespace: nginx | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 # Optional. Default: apps/v1 | ||
kind: Deployment # Optional. Default: Deployment | ||
name: nginx # Mandatory. Must be in the same namespace as the ScaledObject | ||
pollingInterval: 5 # Optional. Default: 5 seconds | ||
cooldownPeriod: 20 # Optional. Default: 300 seconds | ||
minReplicaCount: 1 # Optional. Default: 0 | ||
maxReplicaCount: 10 # Optional. Default: 100 | ||
fallback: # Optional. Section to specify fallback options | ||
failureThreshold: 3 # Mandatory if fallback section is included | ||
replicas: 1 # Mandatory if fallback section is included | ||
advanced: # Optional. Section to specify advanced options | ||
restoreToOriginalReplicaCount: true # Optional. Default: false | ||
horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options | ||
name: keda-hpa-nginx # Optional. Default: keda-hpa-{scaled-object-name} | ||
behavior: # Optional. Use to modify HPA's scaling behavior | ||
scaleDown: | ||
stabilizationWindowSeconds: 60 | ||
policies: | ||
- type: Percent | ||
value: 100 | ||
periodSeconds: 15 | ||
triggers: | ||
- type: cron | ||
metadata: | ||
# Required | ||
timezone: Asia/Kolkata # The acceptable values would be a value from the IANA Time Zone Database. | ||
start: "12 00 * * *" | ||
end: "15 00 * * *" | ||
desiredReplicas: "5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: "eks.amazonaws.com/nodegroup" | ||
operator: In | ||
values: | ||
- "critical" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: nginx-deployment | ||
namespace: nginx | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 # Optional. Default: apps/v1 | ||
kind: Deployment # Optional. Default: Deployment | ||
name: nginx # Mandatory. Must be in the same namespace as the ScaledObject | ||
pollingInterval: 5 # Optional. Default: 5 seconds | ||
cooldownPeriod: 20 # Optional. Default: 300 seconds | ||
minReplicaCount: 1 # Optional. Default: 0 | ||
maxReplicaCount: 10 # Optional. Default: 100 | ||
fallback: # Optional. Section to specify fallback options | ||
failureThreshold: 3 # Mandatory if fallback section is included | ||
replicas: 1 # Mandatory if fallback section is included | ||
advanced: # Optional. Section to specify advanced options | ||
restoreToOriginalReplicaCount: true # Optional. Default: false | ||
horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options | ||
name: keda-hpa-nginx # Optional. Default: keda-hpa-{scaled-object-name} | ||
behavior: # Optional. Use to modify HPA's scaling behavior | ||
scaleDown: | ||
stabilizationWindowSeconds: 60 | ||
policies: | ||
- type: Percent | ||
value: 100 | ||
periodSeconds: 15 | ||
triggers: | ||
- type: cron | ||
metadata: | ||
# Required | ||
timezone: Asia/Kolkata # The acceptable values would be a value from the IANA Time Zone Database. | ||
start: "12 00 * * *" | ||
end: "15 00 * * *" | ||
desiredReplicas: "5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Keda Helm Chart | ||
|
||
KEDA allows for fine grained autoscaling (including to/from zero) for event driven Kubernetes workloads. | ||
|
||
## Installation | ||
Below terraform script shows how to use Keda Terraform Addon, A complete example is also given [here](https://github.com/clouddrove/terraform-helm-eks-addons/blob/master/_examples/complete/main.tf). | ||
```bash | ||
module "addons" { | ||
source = "clouddrove/eks-addons/aws" | ||
version = "0.0.9" | ||
|
||
depends_on = [module.eks.cluster_id] | ||
eks_cluster_name = module.eks.cluster_name | ||
|
||
keda = true | ||
} | ||
``` | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72 | | ||
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.10 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.72 | | ||
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.10 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_helm_addon"></a> [helm\_addon](#module\_helm\_addon) | ../helm | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_iam_policy.policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | ||
| [kubernetes_namespace_v1.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace_v1) | resource | | ||
| [aws_eks_cluster.eks_cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | n/a | `string` | `""` | no | | ||
| <a name="input_addon_context"></a> [addon\_context](#input\_addon\_context) | Input configuration for the addon | <pre>object({<br> aws_caller_identity_account_id = string<br> aws_caller_identity_arn = string<br> aws_eks_cluster_endpoint = string<br> aws_partition_id = string<br> aws_region_name = string<br> eks_cluster_id = string<br> eks_oidc_issuer_url = string<br> eks_oidc_provider_arn = string<br> tags = map(string)<br> })</pre> | n/a | yes | | ||
| <a name="input_keda_extra_configs"></a> [aws\_load\_balancer\_controller\_extra\_configs](#input\_keda\_configs) | Override attributes of helm\_release terraform resource | `any` | `{}` | no | | ||
| <a name="input_eks_cluster_name"></a> [eks\_cluster\_name](#input\_eks\_cluster\_name) | n/a | `string` | `""` | no | | ||
| <a name="input_helm_config"></a> [helm\_config](#input\_helm\_config) | Helm provider config for Keda | `any` | `{}` | no | | ||
| <a name="input_iampolicy_json_content"></a> [iampolicy\_json\_content](#input\_iampolicy\_json\_content) | Custom IAM Policy for Keda IRSA | `string` | `null` | no | | ||
| <a name="input_manage_via_gitops"></a> [manage\_via\_gitops](#input\_manage\_via\_gitops) | Determines if the add-on should be managed via GitOps | `bool` | `false` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_chart_version"></a> [chart\_version](#output\_chart\_version) | n/a | | ||
| <a name="output_iam_policy"></a> [iam\_policy](#output\_iam\_policy) | n/a | | ||
| <a name="output_namespace"></a> [namespace](#output\_namespace) | n/a | | ||
| <a name="output_repository"></a> [repository](#output\_repository) | n/a | | ||
| <a name="output_service_account"></a> [service\_account](#output\_service\_account) | n/a | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Oops, something went wrong.