ComputeResourcePolicy


Property Value
Google Cloud Service Name Compute Engine
Google Cloud Service Documentation /compute/docs/
Google Cloud REST Resource Name v1.resourcePolicies
Google Cloud REST Resource Documentation /compute/docs/reference/rest/v1/resourcePolicies
Config Connector Resource Short Name gcpcomputeresourcepolicy
gcpcomputeresourcepolicies
computeresourcepolicy
Config Connector Resource Fully Qualified Name computeresourcepolicies.compute.cnrm.cloud.google.com
Can Be Referenced by IAMPolicy/IAMPolicyMember No
Config Connector Default Average Reconcile Interval In Seconds 600

Custom Resource Definition Properties

Annotations

Fields
cnrm.cloud.google.com/project-id

Spec

Schema

description: string
diskConsistencyGroupPolicy:
  enabled: boolean
groupPlacementPolicy:
  availabilityDomainCount: integer
  collocation: string
  maxDistance: integer
  vmCount: integer
instanceSchedulePolicy:
  expirationTime: string
  startTime: string
  timeZone: string
  vmStartSchedule:
    schedule: string
  vmStopSchedule:
    schedule: string
region: string
resourceID: string
snapshotSchedulePolicy:
  retentionPolicy:
    maxRetentionDays: integer
    onSourceDiskDelete: string
  schedule:
    dailySchedule:
      daysInCycle: integer
      startTime: string
    hourlySchedule:
      hoursInCycle: integer
      startTime: string
    weeklySchedule:
      dayOfWeeks:
      - day: string
        startTime: string
  snapshotProperties:
    chainName: string
    guestFlush: boolean
    labels:
      string: string
    storageLocations:
    - string
Fields

description

Optional

string

Immutable. An optional description of this resource. Provide this property when you create the resource.

diskConsistencyGroupPolicy

Optional

object

Immutable. Replication consistency group for asynchronous disk replication.

diskConsistencyGroupPolicy.enabled

Required*

boolean

Immutable. Enable disk consistency on the resource policy.

groupPlacementPolicy

Optional

object

Immutable. Resource policy for instances used for placement configuration.

groupPlacementPolicy.availabilityDomainCount

Optional

integer

Immutable. The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network.

groupPlacementPolicy.collocation

Optional

string

Immutable. Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network. Specify 'COLLOCATED' to enable collocation. Can only be specified with 'vm_count'. If compute instances are created with a COLLOCATED policy, then exactly 'vm_count' instances must be created at the same time with the resource policy attached. Possible values: ["COLLOCATED"].

groupPlacementPolicy.maxDistance

Optional

integer

Immutable. Specifies the number of max logical switches.

groupPlacementPolicy.vmCount

Optional

integer

Immutable. Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.

instanceSchedulePolicy

Optional

object

Immutable. Resource policy for scheduling instance operations.

instanceSchedulePolicy.expirationTime

Optional

string

Immutable. The expiration time of the schedule. The timestamp is an RFC3339 string.

instanceSchedulePolicy.startTime

Optional

string

Immutable. The start time of the schedule. The timestamp is an RFC3339 string.

instanceSchedulePolicy.timeZone

Required*

string

Immutable. Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

instanceSchedulePolicy.vmStartSchedule

Optional

object

Immutable. Specifies the schedule for starting instances.

instanceSchedulePolicy.vmStartSchedule.schedule

Required*

string

Immutable. Specifies the frequency for the operation, using the unix-cron format.

instanceSchedulePolicy.vmStopSchedule

Optional

object

Immutable. Specifies the schedule for stopping instances.

instanceSchedulePolicy.vmStopSchedule.schedule

Required*

string

Immutable. Specifies the frequency for the operation, using the unix-cron format.

region

Required

string

Immutable. Region where resource policy resides.

resourceID

Optional

string

Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default.

snapshotSchedulePolicy

Optional

object

Immutable. Policy for creating snapshots of persistent disks.

snapshotSchedulePolicy.retentionPolicy

Optional

object

Immutable. Retention policy applied to snapshots created by this resource policy.

snapshotSchedulePolicy.retentionPolicy.maxRetentionDays

Required*

integer

Immutable. Maximum age of the snapshot that is allowed to be kept.

snapshotSchedulePolicy.retentionPolicy.onSourceDiskDelete

Optional

string

Immutable. Specifies the behavior to apply to scheduled snapshots when the source disk is deleted. Default value: "KEEP_AUTO_SNAPSHOTS" Possible values: ["KEEP_AUTO_SNAPSHOTS", "APPLY_RETENTION_POLICY"].

snapshotSchedulePolicy.schedule

Required*

object

Immutable. Contains one of an 'hourlySchedule', 'dailySchedule', or 'weeklySchedule'.

snapshotSchedulePolicy.schedule.dailySchedule

Optional

object

Immutable. The policy will execute every nth day at the specified time.

snapshotSchedulePolicy.schedule.dailySchedule.daysInCycle

Required*

integer

Immutable. Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.

snapshotSchedulePolicy.schedule.dailySchedule.startTime

Required*

string

Immutable. This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.

snapshotSchedulePolicy.schedule.hourlySchedule

Optional

object

Immutable. The policy will execute every nth hour starting at the specified time.

snapshotSchedulePolicy.schedule.hourlySchedule.hoursInCycle

Required*

integer

Immutable. The number of hours between snapshots.

snapshotSchedulePolicy.schedule.hourlySchedule.startTime

Required*

string

Immutable. Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00.

snapshotSchedulePolicy.schedule.weeklySchedule

Optional

object

Immutable. Allows specifying a snapshot time for each day of the week.

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks

Required*

list (object)

Immutable. May contain up to seven (one for each day of the week) snapshot times.

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[]

Required*

object

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[].day

Required*

string

Immutable. The day of the week to create the snapshot. e.g. MONDAY Possible values: ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"].

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[].startTime

Required*

string

Immutable. Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.

snapshotSchedulePolicy.snapshotProperties

Optional

object

Immutable. Properties with which the snapshots are created, such as labels.

snapshotSchedulePolicy.snapshotProperties.chainName

Optional

string

Immutable. Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.

snapshotSchedulePolicy.snapshotProperties.guestFlush

Optional

boolean

Immutable. Whether to perform a 'guest aware' snapshot.

snapshotSchedulePolicy.snapshotProperties.labels

Optional

map (key: string, value: string)

Immutable. A set of key-value pairs.

snapshotSchedulePolicy.snapshotProperties.storageLocations

Optional

list (string)

Immutable. Cloud Storage bucket location to store the auto snapshot (regional or multi-regional).

snapshotSchedulePolicy.snapshotProperties.storageLocations[]

Optional

string

* Field is required when parent field is specified

Status

Schema

conditions:
- lastTransitionTime: string
  message: string
  reason: string
  status: string
  type: string
observedGeneration: integer
selfLink: string
Fields
conditions

list (object)

Conditions represent the latest available observation of the resource's current state.

conditions[]

object

conditions[].lastTransitionTime

string

Last time the condition transitioned from one status to another.

conditions[].message

string

Human-readable message indicating details about last transition.

conditions[].reason

string

Unique, one-word, CamelCase reason for the condition's last transition.

conditions[].status

string

Status is the status of the condition. Can be True, False, Unknown.

conditions[].type

string

Type is the type of the condition.

observedGeneration

integer

ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource.

selfLink

string

Sample YAML(s)

Daily Resource Policy Schedule

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-dailyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      dailySchedule:
        daysInCycle: 1
        startTime: "00:00"
    retentionPolicy:
      maxRetentionDays: 8
      onSourceDiskDelete: KEEP_AUTO_SNAPSHOTS
    snapshotProperties:
      storageLocations:
      - us-central1
      guestFlush: true
      labels:
        autodeleted: "false"
        interval: "daily"

Hourly Resource Policy Schedule

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-hourlyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      hourlySchedule:
        hoursInCycle: 4
        startTime: "13:00"
    retentionPolicy:
      maxRetentionDays: 2
      onSourceDiskDelete: APPLY_RETENTION_POLICY
    snapshotProperties:
      labels:
        autodeleted: "true"
        interval: "hourly"

Weekly Resource Policy Schedule

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-weeklyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      weeklySchedule:
        dayOfWeeks:
        - startTime: "08:00"
          day: MONDAY
        - startTime: "15:00"
          day: WEDNESDAY
        - startTime: "23:00"
          day: FRIDAY
    retentionPolicy:
      maxRetentionDays: 12
    snapshotProperties:
      storageLocations:
      - us
      guestFlush: false
      labels:
        autodeleted: "false"
        interval: "weekly"