Skip to content

Commit 984ef12

Browse files
Expand period to support up to a month (#1232)
Signed-off-by: Matt Moore <[email protected]> Co-authored-by: octo-sts[bot] <157150467+octo-sts[bot]@users.noreply.github.com>
1 parent 9795194 commit 984ef12

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

modules/github-path-reconciler/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (r *Reconciler) Process(ctx context.Context, req *workqueue.ProcessRequest)
142142
## Reconciliation Triggers
143143

144144
### Periodic (Cron)
145-
- Runs every `resync_period_hours` (1-24 hours)
145+
- Runs every `resync_period_hours` (1-744 hours)
146146
- Fetches complete repository tree at HEAD
147147
- Uses time-bucketed delays to spread load across the period
148148
- Priority: 0 (normal)
@@ -187,7 +187,7 @@ Key variables:
187187
- `github_owner`, `github_repo`: Repository to monitor
188188
- `octo_sts_identity`: Octo STS identity for GitHub authentication
189189
- `broker`: Map of region to CloudEvents broker topic
190-
- `resync_period_hours`: How often to run full reconciliation (1-24)
190+
- `resync_period_hours`: How often to run full reconciliation (1-744)
191191
- `paused`: Pause both cron and push listeners
192192
- `deletion_protection`: Prevent accidental deletion (disable during initial rollout)
193193

@@ -243,7 +243,7 @@ No resources.
243243
| <a name="input_regional-volumes"></a> [regional-volumes](#input\_regional-volumes) | The volumes to make available to the containers in the service for mounting. | <pre>list(object({<br/> name = string<br/> gcs = optional(map(object({<br/> bucket = string<br/> read_only = optional(bool, true)<br/> mount_options = optional(list(string), [])<br/> })), {})<br/> nfs = optional(map(object({<br/> server = string<br/> path = string<br/> read_only = optional(bool, true)<br/> })), {})<br/> }))</pre> | `[]` | no |
244244
| <a name="input_regions"></a> [regions](#input\_regions) | A map from region names to a network and subnetwork. A service will be created in each region configured to egress the specified traffic via the specified subnetwork. | <pre>map(object({<br/> network = string<br/> subnet = string<br/> }))</pre> | n/a | yes |
245245
| <a name="input_request_timeout_seconds"></a> [request\_timeout\_seconds](#input\_request\_timeout\_seconds) | The request timeout for the service in seconds. | `number` | `300` | no |
246-
| <a name="input_resync_period_hours"></a> [resync\_period\_hours](#input\_resync\_period\_hours) | How often to resync all paths (in hours, must be between 1 and 24) | `number` | n/a | yes |
246+
| <a name="input_resync_period_hours"></a> [resync\_period\_hours](#input\_resync\_period\_hours) | How often to resync all paths (in hours, must be between 1 and 744 (31 days), and a multiple of 24 if greater than 24) | `number` | n/a | yes |
247247
| <a name="input_scaling"></a> [scaling](#input\_scaling) | The scaling configuration for the service. | <pre>object({<br/> min_instances = optional(number, 0)<br/> max_instances = optional(number, 100)<br/> max_instance_request_concurrency = optional(number, 1000)<br/> })</pre> | `{}` | no |
248248
| <a name="input_service_account"></a> [service\_account](#input\_service\_account) | The service account as which to run the reconciler service. | `string` | n/a | yes |
249249
| <a name="input_slo"></a> [slo](#input\_slo) | Configuration for setting up SLO for the cloud run service | <pre>object({<br/> enable = optional(bool, false)<br/> enable_alerting = optional(bool, false)<br/> success = optional(object(<br/> {<br/> multi_region_goal = optional(number, 0.999)<br/> per_region_goal = optional(number, 0.999)<br/> }<br/> ), null)<br/> monitor_gclb = optional(bool, false)<br/> })</pre> | `{}` | no |

modules/github-path-reconciler/cron.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ SPDX-License-Identifier: Apache-2.0
44
*/
55

66
locals {
7-
# Construct cron schedule from resync period: "0 */N * * *" for every N hours
8-
cron_schedule = "0 */${var.resync_period_hours} * * *"
7+
# Construct cron schedule from resync period:
8+
# If < 24 hours, use "0 */N * * *" (every N hours)
9+
# If >= 24 hours, use "0 0 */D * * *" (every D days)
10+
cron_schedule = var.resync_period_hours < 24 ? "0 */${var.resync_period_hours} * * *" : "0 0 */${floor(var.resync_period_hours / 24)} * * *"
911
# Period in minutes for time bucketing
1012
period_minutes = var.resync_period_hours * 60
1113
}

modules/github-path-reconciler/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ variable "path_patterns" {
280280
}
281281

282282
variable "resync_period_hours" {
283-
description = "How often to resync all paths (in hours, must be between 1 and 24)"
283+
description = "How often to resync all paths (in hours, must be between 1 and 744 (31 days), and a multiple of 24 if greater than 24)"
284284
type = number
285285
validation {
286-
condition = var.resync_period_hours >= 1 && var.resync_period_hours <= 24
287-
error_message = "resync_period_hours must be between 1 and 24 hours"
286+
condition = var.resync_period_hours >= 1 && var.resync_period_hours <= 744 && (var.resync_period_hours < 24 || var.resync_period_hours % 24 == 0)
287+
error_message = "resync_period_hours must be between 1 and 744 hours, and if greater than 24, must be a multiple of 24."
288288
}
289289
}
290290

0 commit comments

Comments
 (0)