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

Custom Resource Definition Properties

Annotations

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

Spec

Schema

groupPlacementPolicy:
  availabilityDomainCount: integer
  collocation: string
  vmCount: integer
region: 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:
    guestFlush: boolean
    labels:
      string: string
    storageLocations:
    - string
Fields

groupPlacementPolicy

Optional

object

Policy for creating snapshots of persistent disks.

groupPlacementPolicy.availabilityDomainCount

Optional

integer

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

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.vmCount

Optional

integer

Number of vms in this placement group.

region

Required

string

Region where resource policy resides.

snapshotSchedulePolicy

Optional

object

Policy for creating snapshots of persistent disks.

snapshotSchedulePolicy.retentionPolicy

Optional

object

Retention policy applied to snapshots created by this resource policy.

snapshotSchedulePolicy.retentionPolicy.maxRetentionDays

Required*

integer

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

snapshotSchedulePolicy.retentionPolicy.onSourceDiskDelete

Optional

string

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

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

snapshotSchedulePolicy.schedule.dailySchedule

Optional

object

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

snapshotSchedulePolicy.schedule.dailySchedule.daysInCycle

Required*

integer

The number of days between snapshots.

snapshotSchedulePolicy.schedule.dailySchedule.startTime

Required*

string

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

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

snapshotSchedulePolicy.schedule.hourlySchedule.hoursInCycle

Required*

integer

The number of hours between snapshots.

snapshotSchedulePolicy.schedule.hourlySchedule.startTime

Required*

string

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

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

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks

Required*

list (object)

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks.[]

Required*

object

snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks.[].day

Required*

string

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

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

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

snapshotSchedulePolicy.snapshotProperties.guestFlush

Optional

boolean

Whether to perform a 'guest aware' snapshot.

snapshotSchedulePolicy.snapshotProperties.labels

Optional

map (key: string, value: string)

A set of key-value pairs.

snapshotSchedulePolicy.snapshotProperties.storageLocations

Optional

list (string)

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
selfLink: string
Fields
conditions

list (object)

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.

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"