Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rollout option to osconfig patch deployment fixes https://github.com/hashicorp/terraform-provider-google/issues/7124 #3919

Merged
merged 4 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions products/osconfig/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,43 @@ objects:
One day of the month. 1-31 indicates the 1st to the 31st day. -1 indicates the last day of the month.
Months without the target day will be skipped. For example, a schedule to run "every month on the 31st"
will not run in February, April, June, etc.
- !ruby/object:Api::Type::NestedObject
name: 'rollout'
description: |
Rollout strategy of the patch job.
properties:
- !ruby/object:Api::Type::Enum
name: 'mode'
cookejames marked this conversation as resolved.
Show resolved Hide resolved
description: |
Mode of the patch rollout.
values:
- :ZONE_BY_ZONE
- :CONCURRENT_ZONES
required: true
- !ruby/object:Api::Type::NestedObject
name: 'disruptionBudget'
cookejames marked this conversation as resolved.
Show resolved Hide resolved
description: |
The maximum number (or percentage) of VMs per zone to disrupt at any given moment. The number of VMs calculated from multiplying the percentage by the total number of VMs in a zone is rounded up.
During patching, a VM is considered disrupted from the time the agent is notified to begin until patching has completed. This disruption time includes the time to complete reboot and any post-patch steps.
A VM contributes to the disruption budget if its patching operation fails either when applying the patches, running pre or post patch steps, or if it fails to respond with a success notification before timing out. VMs that are not running or do not have an active agent do not count toward this disruption budget.
For zone-by-zone rollouts, if the disruption budget in a zone is exceeded, the patch job stops, because continuing to the next zone requires completion of the patch process in the previous zone.
For example, if the disruption budget has a fixed value of 10, and 8 VMs fail to patch in the current zone, the patch job continues to patch 2 VMs at a time until the zone is completed. When that zone is completed successfully, patching begins with 10 VMs at a time in the next zone. If 10 VMs in the next zone fail to patch, the patch job stops.
properties:
- !ruby/object:Api::Type::Integer
name: fixed
description: |
Specifies a fixed value.
exactly_one_of:
- rollout.0.disruption_budget.0.fixed
- rollout.0.disruption_budget.0.percentage
- !ruby/object:Api::Type::Integer
name: percentage
description: |
Specifies the relative value defined as a percentage, which will be multiplied by a reference value.
exactly_one_of:
- rollout.0.disruption_budget.0.fixed
- rollout.0.disruption_budget.0.percentage
required: true
- !ruby/object:Api::Resource
name: 'GuestPolicies'
base_url: "projects/{{project}}/guestPolicies"
Expand Down
6 changes: 6 additions & 0 deletions products/osconfig/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ overrides: !ruby/object:Overrides::ResourceOverrides
function: 'validation.IntBetween(-1,31)'
recurringSchedule.frequency: !ruby/object:Overrides::Terraform::PropertyOverride
exclude: true
rollout.disruptionBudget.percentage: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(0,100)'
rollout.disruptionBudget.fixed: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntAtLeast(1)'
custom_code: !ruby/object:Provider::Terraform::CustomCode
post_create: templates/terraform/post_create/set_computed_name.erb
encoder: templates/terraform/encoders/os_config_patch_deployment.go.erb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,11 @@ resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>"
}
}
}

rollout {
mode = "ZONE_BY_ZONE"
disruption_budget {
fixed = 1
}
}
}