Skip to content

Commit

Permalink
Merge pull request #13 from clouddrove/feat/keda
Browse files Browse the repository at this point in the history
feat: Modified keda addon
  • Loading branch information
AshutoshAM2002 authored Jan 18, 2024
2 parents 504e457 + 6ad3018 commit ff9da57
Show file tree
Hide file tree
Showing 17 changed files with 939 additions and 51 deletions.
9 changes: 5 additions & 4 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ module "addons" {
environment = local.environment
region = local.region

cluster_autoscaler = true
reloader = true
ingress_nginx = true
certification_manager = true
cluster_autoscaler = false
reloader = false
ingress_nginx = false
certification_manager = false
keda = true
}
9 changes: 9 additions & 0 deletions _examples/complete/config/keda/override-keda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "cloud.google.com/gke-nodepool"
operator: In
values:
- "critical"
36 changes: 36 additions & 0 deletions _examples/complete/config/keda/strategy_example.yaml
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"
11 changes: 7 additions & 4 deletions _examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,23 @@ module "addons" {
environment = local.environment
region = local.region

cluster_autoscaler = true
reloader = true
ingress_nginx = true
certification_manager = true
cluster_autoscaler = false
reloader = false
ingress_nginx = false
certification_manager = false
keda = true

# -- Path of override-values.yaml file
cluster_autoscaler_helm_config = { values = [file("./config/override-cluster-autoscaler.yaml")] }
reloader_helm_config = { values = [file("./config/reloader/override-reloader.yaml")] }
ingress_nginx_helm_config = { values = [file("./config/override-ingress-nginx.yaml")] }
certification_manager_helm_config = { values = [file("./config/override-certification-manager.yaml")] }
keda_helm_config = { values = [file("./config/keda/override-keda.yaml")] }

# -- Override Helm Release attributes
cluster_autoscaler_extra_configs = var.cluster_autoscaler_extra_configs
reloader_extra_configs = var.reloader_extra_configs
ingress_nginx_extra_configs = var.ingress_nginx_extra_configs
certification_manager_extra_configs = var.certification_manager_extra_configs
keda_extra_configs = var.keda_extra_configs
}
6 changes: 6 additions & 0 deletions _examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ variable "reloader_extra_configs" {
type = any
default = {}
}

# ------------------ KEDA -----------------------------------------------------
variable "keda_extra_configs" {
type = any
default = {}
}
12 changes: 3 additions & 9 deletions addons/cert-manager/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ variable "certification_manager_extra_configs" {
default = {}
}

variable "iampolicy_json_content" {
description = "Custom IAM Policy for ClusterAutoscaler IRSA"
type = string
default = null
}

variable "addon_context" {
description = "Input configuration for the addon"
type = object({
Expand All @@ -30,7 +24,7 @@ variable "addon_context" {
})
}

variable "irsa_config" {
variable "workload_identity_config" {
description = "Input configuration for IRSA module"
type = any
default = {}
Expand All @@ -55,11 +49,11 @@ variable "environment" {
variable "GCP_GSA_NAME" {
description = "Google Cloud Service Account name"
type = string
default = "keda"
default = "cert-manager"
}

variable "GCP_KSA_NAME" {
description = "Google Kubernetes Service Account name"
type = string
default = "keda-operator"
default = "cert-manager"
}
Loading

0 comments on commit ff9da57

Please sign in to comment.