diff --git a/products/osconfig/api.yaml b/products/osconfig/api.yaml index 83b7b26bf8aa..43fbe585b201 100644 --- a/products/osconfig/api.yaml +++ b/products/osconfig/api.yaml @@ -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' + description: | + Mode of the patch rollout. + values: + - :ZONE_BY_ZONE + - :CONCURRENT_ZONES + required: true + - !ruby/object:Api::Type::NestedObject + name: 'disruptionBudget' + 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" diff --git a/products/osconfig/terraform.yaml b/products/osconfig/terraform.yaml index 913b88b85bd9..049ac9c91110 100644 --- a/products/osconfig/terraform.yaml +++ b/products/osconfig/terraform.yaml @@ -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 diff --git a/templates/terraform/examples/os_config_patch_deployment_full.tf.erb b/templates/terraform/examples/os_config_patch_deployment_full.tf.erb index 4eba717f73d8..53030f0d1ba4 100644 --- a/templates/terraform/examples/os_config_patch_deployment_full.tf.erb +++ b/templates/terraform/examples/os_config_patch_deployment_full.tf.erb @@ -94,4 +94,11 @@ resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" } } } + + rollout { + mode = "ZONE_BY_ZONE" + disruption_budget { + fixed = 1 + } + } }