Skip to content

Commit

Permalink
feat: allow to override helm values (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 authored Dec 21, 2022
1 parent 88c4632 commit 20aa957
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
generate-doc:
terraform-docs markdown table --output-file README.md --output-mode inject .
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,30 @@ No modules.
| [helm_release.castai_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_cluster_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_evictor](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_sec_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_spot_handler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [azuread_client_config.current](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/client_config) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_agent_values"></a> [agent\_values](#input\_agent\_values) | List of YAML formatted string values for agent helm chart | `list(string)` | `[]` | no |
| <a name="input_aks_cluster_name"></a> [aks\_cluster\_name](#input\_aks\_cluster\_name) | Name of the cluster to be connected to CAST AI. | `string` | n/a | yes |
| <a name="input_aks_cluster_region"></a> [aks\_cluster\_region](#input\_aks\_cluster\_region) | Region of the AKS cluster | `string` | n/a | yes |
| <a name="input_api_url"></a> [api\_url](#input\_api\_url) | URL of alternative CAST AI API to be used during development or testing | `string` | `"https://api.cast.ai"` | no |
| <a name="input_autoscaler_policies_json"></a> [autoscaler\_policies\_json](#input\_autoscaler\_policies\_json) | Optional json object to override CAST AI cluster autoscaler policies | `string` | `""` | no |
| <a name="input_castai_components_labels"></a> [castai\_components\_labels](#input\_castai\_components\_labels) | Optional additional Kubernetes labels for CAST AI pods | `map` | `{}` | no |
| <a name="input_cluster_controller_values"></a> [cluster\_controller\_values](#input\_cluster\_controller\_values) | List of YAML formatted string values for cluster-controller helm chart | `list(string)` | `[]` | no |
| <a name="input_default_node_configuration"></a> [default\_node\_configuration](#input\_default\_node\_configuration) | ID of the default node configuration | `string` | n/a | yes |
| <a name="input_delete_nodes_on_disconnect"></a> [delete\_nodes\_on\_disconnect](#input\_delete\_nodes\_on\_disconnect) | Optionally delete Cast AI created nodes when the cluster is destroyed | `bool` | `false` | no |
| <a name="input_evictor_values"></a> [evictor\_values](#input\_evictor\_values) | List of YAML formatted string values for evictor helm chart | `list(string)` | `[]` | no |
| <a name="input_install_security_agent"></a> [install\_security\_agent](#input\_install\_security\_agent) | Optional flag for installation of security agent (https://docs.cast.ai/product-overview/console/security-insights/) | `bool` | `false` | no |
| <a name="input_node_configurations"></a> [node\_configurations](#input\_node\_configurations) | Map of AKS node configurations to create | `any` | `{}` | no |
| <a name="input_node_resource_group"></a> [node\_resource\_group](#input\_node\_resource\_group) | n/a | `string` | n/a | yes |
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | n/a | `string` | n/a | yes |
| <a name="input_sec_agent_values"></a> [sec\_agent\_values](#input\_sec\_agent\_values) | List of YAML formatted string values for sec-agent helm chart | `list(string)` | `[]` | no |
| <a name="input_spot_handler_values"></a> [spot\_handler\_values](#input\_spot\_handler\_values) | List of YAML formatted string values for spot-handler helm chart | `list(string)` | `[]` | no |
| <a name="input_subscription_id"></a> [subscription\_id](#input\_subscription\_id) | Azure subscription ID | `string` | n/a | yes |
| <a name="input_tenant_id"></a> [tenant\_id](#input\_tenant\_id) | n/a | `string` | n/a | yes |

Expand Down
10 changes: 10 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ resource "helm_release" "castai_agent" {
cleanup_on_fail = true
wait = true

values = var.agent_values

set {
name = "provider"
value = "aks"
Expand Down Expand Up @@ -79,6 +81,8 @@ resource "helm_release" "castai_evictor" {
cleanup_on_fail = true
wait = true

values = var.evictor_values

set {
name = "replicaCount"
value = "0"
Expand Down Expand Up @@ -108,6 +112,8 @@ resource "helm_release" "castai_cluster_controller" {
cleanup_on_fail = true
wait = true

values = var.cluster_controller_values

set {
name = "aks.enabled"
value = "true"
Expand Down Expand Up @@ -155,6 +161,8 @@ resource "helm_release" "castai_spot_handler" {
cleanup_on_fail = true
wait = true

values = var.spot_handler_values

set {
name = "castai.provider"
value = "azure"
Expand Down Expand Up @@ -199,6 +207,8 @@ resource "helm_release" "castai_sec_agent" {
create_namespace = true
cleanup_on_fail = true

values = var.sec_agent_values

set {
name = "castai.apiURL"
value = var.api_url
Expand Down
30 changes: 30 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,33 @@ variable "install_security_agent" {
default = false
description = "Optional flag for installation of security agent (https://docs.cast.ai/product-overview/console/security-insights/)"
}

variable "agent_values" {
description = "List of YAML formatted string values for agent helm chart"
type = list(string)
default = []
}

variable "spot_handler_values" {
description = "List of YAML formatted string values for spot-handler helm chart"
type = list(string)
default = []
}

variable "cluster_controller_values" {
description = "List of YAML formatted string values for cluster-controller helm chart"
type = list(string)
default = []
}

variable "evictor_values" {
description = "List of YAML formatted string values for evictor helm chart"
type = list(string)
default = []
}

variable "sec_agent_values" {
description = "List of YAML formatted string values for sec-agent helm chart"
type = list(string)
default = []
}

0 comments on commit 20aa957

Please sign in to comment.