Skip to content

Repository files navigation

Densify

This module is the interface between Densify machine learning analytics and Terraform templates. It enables two operations:

  • auto-tagging of cloud instances and containers based on Densify’s optimization analysis (making them “self-aware”)
  • automated optimization of instance families/sizes, and container resource requests/limits (making them “self-optimizing”)

This integration is based on densify.auto.tfvars, which is automatically generated by Densify and contains operational intelligence, analysis findings, and optimization recommendations for each cloud instance or container in scope. This module unpacks data from this structure, making it available to Terraform as variables, enabling precise specification of resources to optimally match the learned patterns of behavior. The result is next-generation resource optimization with the elimination of hard-coded resource specifications.

Requirements

Usage

module"optimization-as-code" {
source="densify-dev/optimization-as-code/null"densify_recommendations="${var.densify_recommendations}"densify_fallback="${var.densify_fallback}"densify_unique_id="${var.name}"
}

Examples

Inputs

NameDescriptionTypeDefaultRequired
densify_recommendationsMap variable containing recommendations from DensifyMap-Yes
densify_fallbackThe map default values used if Densify recommendations are not availableMap-Yes
densify_unique_idThe unique identifier of the system to be updatedString-Yes

Outputs

NameDescription
current_typeCurrent instance size and family.
recommended_typeDensify recommended instance size and family.
savings_estimateThe potential monthly savings from modifying the current instance to the Densify recommended instance.
predicted_uptimeThe predicted percentage of CPU utilization hours over the duration of a month.
implementation_methodThe system configured to allow automated or manual recommendations.
current_cpu_requestThe current CPU request configured for the Kubernetes container.
recommended_cpu_requestThe recommended CPU request for the Kubernetes container.
current_cpu_limitThe current CPU limit configured for the Kubernetes container.
recommended_cpu_limitThe recommended CPU limit for the Kubernetes container.
current_mem_requestThe current memory request configured for the Kubernetes container.
recommended_mem_requestThe recommended memory request for the Kubernetes container.
current_mem_limitThe current memory limit configured for the Kubernetes container.
recommended_mem_limitThe recommended memory limit for the Kubernetes container.
instance_typeThe instance size and family to be implemented, which is either the current size or the Densify recommendation, depending on the automation policy and the approval status (if approval is enabled).
cpu_requestThe CPU request to be implemented, which is either the current CPU request or the Densify recommendation, depending on the automation policy and the approval status (if approval is enabled).
cpu_limitThe CPU limit to be implemented, which is either the current CPU limit or the Densify recommendation, depending on the automation policy and the approval status (if approval is enabled).
mem_requestThe memory request to be implemented, which is either the current memory request or the Densify recommendation, depending on the automation policy and the approval status (if approval is enabled).
mem_limitThe memory limit to be implemented, which is either the current memory limit or the Densify recommendation, depending on the automation policy and the approval status (if approval is enabled).
min_group_currentThe current minimum group size of the ASG.
min_group_recommendedThe recommended minimum group size for the ASG.
max_group_currentThe current maximum group size of the ASG.
max_group_recommendedThe recommended maximum group size for the ASG.
min_groupThe minimum group size to be implemented, which is either the current minimum group size or the Densify recommended minimum group size depending on the automation policy and approval status (if approval is enabled).
max_groupThe maximum group size to be implemented, which is either the current maximum group size or the Densify recommended maximum group size depending on the automation policy and approval status (if approval is enabled).
avg_inst_count_currentThe current average number of instances running in the ASG.
avg_inst_count_recommendedThe predicted average number of instances running in the ASG if the recommendations are implemented.
current_desired_capacityThe current desired number of instances running in the ASG.
desired_capacityThe desired capacity to be implemented, which is either the current desired capacity or the recommended average instance count (rounded down) depending on the automation policy and approval status (if approval is enabled).
display_nameThe display name of the container, which is a combination of the pod\service name and the container name.
clusterThe name of the cluster with the running container.
namespaceThe namespace for the running container.
pod_serviceThe pod or service name that the container is running in. If the container is running in a single pod, then the pod name is displayed. If the container is part of a service, such as a Replication Controller or Replica Set, then the service name is displayed.
containerThe name of the container.
controller_typeThe type of the controller.
current_sizeThe current number of copies of the controller that are running. The value will be 1 for individual pods.
approval_typeThe type of approval for this system (NA, All, Specific size).
recommendation_typeThe type of recommendation (Upsize, Downsize, Resize, Just Right).
effortThe effort rating for implementing the recommendation.
policyThe policy is used by the analysis.
power_stateThe power state of the instance.
defer_recommendationDefer recommending an instance type change until reserved instance coverage for this instance expires.
defer_untilIf deferRecommendation = yes, then the expiry date of the RI providing coverage for the current instance is returned.

License

Apache 2 Licensed. See LICENSE for full details.

About

Module to integrate Terraform with Densify machine learning to enable cloud and container workloads to be self-optimizing

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages