Skip to content

Commit

Permalink
chore: added additional syncoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
alekc committed Nov 10, 2022
1 parent d5d16c1 commit 35efac8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| Name | Version |
|------|---------|
| <a name="provider_kubectl"></a> [kubectl](#provider\_kubectl) | 2.0.0 |
| <a name="provider_kubectl"></a> [kubectl](#provider\_kubectl) | >= 2.0.0 |

## Modules

Expand All @@ -27,13 +27,15 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_app_source"></a> [app\_source](#input\_app\_source) | Type of application source (helm, git) | `string` | `"helm"` | no |
| <a name="input_apply_out_of_sync_only"></a> [apply\_out\_of\_sync\_only](#input\_apply\_out\_of\_sync\_only) | Currently when syncing using auto sync Argo CD applies every object in the application. Turning on selective sync option which will sync only out-of-sync resources. | `bool` | `false` | no |
| <a name="input_argocd_namespace"></a> [argocd\_namespace](#input\_argocd\_namespace) | The name of the target ArgoCD Namespace | `string` | `"argocd"` | no |
| <a name="input_automated_prune"></a> [automated\_prune](#input\_automated\_prune) | Specifies if resources should be pruned during auto-syncing | `bool` | `false` | no |
| <a name="input_automated_self_heal"></a> [automated\_self\_heal](#input\_automated\_self\_heal) | Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected | `bool` | `true` | no |
| <a name="input_cascade_delete"></a> [cascade\_delete](#input\_cascade\_delete) | Set to true if this application should cascade delete | `bool` | `true` | no |
| <a name="input_chart"></a> [chart](#input\_chart) | The name of the Helm chart | `string` | `null` | no |
| <a name="input_destination_server"></a> [destination\_server](#input\_destination\_server) | Server specifies the URL of the target cluster and must be set to the Kubernetes control plane API | `string` | `"https://kubernetes.default.svc"` | no |
| <a name="input_destination_server_name"></a> [destination\_server\_name](#input\_destination\_server\_name) | Name is an alternate way of specifying the target cluster by its symbolic name | `string` | `""` | no |
| <a name="input_fail_on_shared_resource"></a> [fail\_on\_shared\_resource](#input\_fail\_on\_shared\_resource) | If true, the Argo CD will fail the sync whenever it finds a resource in the current Application that is already applied in the cluster by another Application. | `bool` | `false` | no |
| <a name="input_helm_parameters"></a> [helm\_parameters](#input\_helm\_parameters) | Parameters that will override helm\_values | <pre>list(object({<br> name : string,<br> value : any,<br> force_string : bool,<br> }))</pre> | `[]` | no |
| <a name="input_helm_values"></a> [helm\_values](#input\_helm\_values) | Helm values as a block of yaml | `any` | `null` | no |
| <a name="input_ignore_differences"></a> [ignore\_differences](#input\_ignore\_differences) | Ignore differences at the specified json pointers | `list(any)` | `[]` | no |
Expand All @@ -43,11 +45,13 @@ No modules.
| <a name="input_path"></a> [path](#input\_path) | n/a | `string` | `""` | no |
| <a name="input_project"></a> [project](#input\_project) | The project that this ArgoCD application will be placed into. | `string` | n/a | yes |
| <a name="input_release_name"></a> [release\_name](#input\_release\_name) | Release name override (defaults to application name) | `string` | `null` | no |
| <a name="input_replace"></a> [replace](#input\_replace) | If true, the Argo CD will use kubectl replace or kubectl create command to apply changes. | `bool` | `false` | no |
| <a name="input_repo_url"></a> [repo\_url](#input\_repo\_url) | Source of the Helm application manifests | `string` | n/a | yes |
| <a name="input_retry_backoff_duration"></a> [retry\_backoff\_duration](#input\_retry\_backoff\_duration) | The amount to back off. Default unit is seconds, but could also be a duration (e.g. `2m`, `1h`) | `string` | `"5s"` | no |
| <a name="input_retry_backoff_factor"></a> [retry\_backoff\_factor](#input\_retry\_backoff\_factor) | A factor to multiply the base duration after each failed retry | `number` | `2` | no |
| <a name="input_retry_backoff_max_duration"></a> [retry\_backoff\_max\_duration](#input\_retry\_backoff\_max\_duration) | The maximum amount of time allowed for the backoff strategy | `string` | `"3m"` | no |
| <a name="input_retry_limit"></a> [retry\_limit](#input\_retry\_limit) | Number of failed sync attempt retries; unlimited number of attempts if less than 0 | `number` | `5` | no |
| <a name="input_server_side_apply"></a> [server\_side\_apply](#input\_server\_side\_apply) | If true, Argo CD will use kubectl apply --server-side command to apply changes. | `bool` | `false` | no |
| <a name="input_skip_crd"></a> [skip\_crd](#input\_skip\_crd) | If set to true, it will skip the deployment of crd entities from the helm chart | `bool` | `false` | no |
| <a name="input_sync_option_create_namespace"></a> [sync\_option\_create\_namespace](#input\_sync\_option\_create\_namespace) | Namespace Auto-Creation ensures that namespace specified as the application destination exists in the destination cluster. | `bool` | `true` | no |
| <a name="input_sync_option_validate"></a> [sync\_option\_validate](#input\_sync\_option\_validate) | disables resource validation (equivalent to 'kubectl apply --validate=true') | `bool` | `false` | no |
Expand Down
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ locals {
prune = var.automated_prune
selfHeal = var.automated_self_heal
}
// https://argo-cd.readthedocs.io/en/latest/user-guide/sync-options/
syncOptions = concat(var.sync_options, [
var.sync_option_validate ? "Validate=true" : "Validate=false",
var.sync_option_create_namespace ? "CreateNamespace=true" : "CreateNamespace=false",
var.server_side_apply ? "ServerSideApply=true" : "ServerSideApply=false",
var.apply_out_of_sync_only ? "ApplyOutOfSyncOnly=true" : "ApplyOutOfSyncOnly=false",
var.replace ? "Replace=true" : "Replace=false",
var.fail_on_shared_resource ? "FailOnSharedResource=true" : "FailOnSharedResource=false",
])
retry = {
limit = var.retry_limit
Expand Down
20 changes: 20 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ variable "automated_self_heal" {
description = "Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected"
default = true
}
variable "server_side_apply" {
type = bool
default = false
description = "If true, Argo CD will use kubectl apply --server-side command to apply changes."
}
variable "apply_out_of_sync_only" {
type = bool
default = false
description = "Currently when syncing using auto sync Argo CD applies every object in the application. Turning on selective sync option which will sync only out-of-sync resources. "
}
variable "replace" {
type = bool
default = false
description = "If true, the Argo CD will use kubectl replace or kubectl create command to apply changes."
}
variable "fail_on_shared_resource" {
type = bool
default = false
description = "If true, the Argo CD will fail the sync whenever it finds a resource in the current Application that is already applied in the cluster by another Application."
}
variable "sync_options" {
type = list(string)
description = "A list of sync options to apply to the application"
Expand Down

0 comments on commit 35efac8

Please sign in to comment.