CloudSchedulerJob

Property Value
Google Cloud Service Name Cloud Scheduler
Google Cloud Service Documentation /scheduler/docs/
Google Cloud REST Resource Name v1.projects.locations.jobs
Google Cloud REST Resource Documentation /scheduler/docs/reference/rest/v1/projects.locations.jobs
Config Connector Resource Short Names gcpcloudschedulerjob
gcpcloudschedulerjobs
cloudschedulerjob
Config Connector Service Name cloudscheduler.googleapis.com
Config Connector Resource Fully Qualified Name cloudschedulerjobs.cloudscheduler.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

  appEngineHttpTarget:
    appEngineRouting:
      instance: string
      service: string
      version: string
    body: string
    headers:
      string: string
    httpMethod: string
    relativeUri: string
  attemptDeadline: string
  description: string
  httpTarget:
    body: string
    headers:
      string: string
    httpMethod: string
    oauthToken:
      scope: string
      serviceAccountRef:
        external: string
        name: string
        namespace: string
    oidcToken:
      audience: string
      serviceAccountRef:
        external: string
        name: string
        namespace: string
    uri: string
  location: string
  pubsubTarget:
    attributes:
      string: string
    data: string
    topicRef:
      external: string
      name: string
      namespace: string
  resourceID: string
  retryConfig:
    maxBackoffDuration: string
    maxDoublings: integer
    maxRetryDuration: string
    minBackoffDuration: string
    retryCount: integer
  schedule: string
  timeZone: string
Fields

appEngineHttpTarget

Optional

object

Appengine HTTP target.

appEngineHttpTarget.appEngineRouting

Optional

object

Appengine Routing setting for the job.

appEngineHttpTarget.appEngineRouting.instance

Optional

string

App instance. By default, the job is sent to an instance which is available when the job is attempted. Requests can only be sent to a specific instance if manual scaling is used in App Engine Standard. For more information, see App Engine Flex does not support instances. For more information, see App Engine Standard request routing and App Engine Flex request routing.

appEngineHttpTarget.appEngineRouting.service

Optional

string

App service. By default, the job is sent to the service which is the default service when the job is attempted.

appEngineHttpTarget.appEngineRouting.version

Optional

string

App version. By default, the job is sent to the version which is the default version when the job is attempted.

appEngineHttpTarget.body

Optional

string

Body. HTTP request body. A request body is allowed only if the HTTP method is POST or PUT. It will result in invalid argument error to set a body on a job with an incompatible HttpMethod.

appEngineHttpTarget.headers

Optional

map (key: string, value: string)

HTTP request headers. This map contains the header field names and values. Headers can be set when the job is created. Cloud Scheduler sets some headers to default values: * `User-Agent`: By default, this header is `"Appengine-Google; (+http://code.google.com/appengine)"`. This header can be modified, but Cloud Scheduler will append `"Appengine-Google; (+http://code.google.com/appengine)"` to the modified `User-Agent`. * `X-CloudScheduler`: This header will be set to true. The headers below are output only. They cannot be set or overridden: * `X-Google-*`: For Google internal use only. * `X-Appengine-*`: For Google internal use only. In addition, some Appengine headers, which contain job-specific information, are also be sent to the job handler.

appEngineHttpTarget.httpMethod

Optional

string

The HTTP method to use for the request. PATCH and OPTIONS are not permitted. Possible values: HTTP_METHOD_UNSPECIFIED, POST, GET, HEAD, PUT, DELETE, PATCH, OPTIONS

appEngineHttpTarget.relativeUri

Optional

string

The relative URI. The relative URL must begin with "/" and must be a valid HTTP relative URL. It can contain a path, query string arguments, and `#` fragments. If the relative URL is empty, then the root path "/" will be used. No spaces are allowed, and the maximum length allowed is 2083 characters.

attemptDeadline

Optional

string

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig, between 15 seconds and 24 hours.

description

Optional

string

Optionally caller-specified in jobs.create or jobs.patch. A human-readable description for the job. This string must not contain more than 500 characters.

httpTarget

Optional

object

HTTP target.

httpTarget.body

Optional

string

HTTP request body. A request body is allowed only if the HTTP method is POST, PUT, or PATCH. It is an error to set body on a job with an incompatible HttpMethod.

httpTarget.headers

Optional

map (key: string, value: string)

The user can specify HTTP request headers to send with the job's HTTP request. This map contains the header field names and values. Repeated headers are not supported, but a header value can contain commas. These headers represent a subset of the headers that will accompany the job's HTTP request. Some HTTP request headers will be ignored or replaced. A partial list of headers that will be ignored or replaced is below: - Host: This will be computed by Cloud Scheduler and derived from uri. * `Content-Length`: This will be computed by Cloud Scheduler. * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. * `X-Google-*`: Google internal use only. * `X-Appengine-*`: Google internal use only. The total size of headers must be less than 80KB.

httpTarget.httpMethod

Optional

string

Which HTTP method to use for the request. Possible values: HTTP_METHOD_UNSPECIFIED, POST, GET, HEAD, PUT, DELETE, PATCH, OPTIONS

httpTarget.oauthToken

Optional

object

If specified, an (https://developers.google.com/identity/protocols/OAuth2) will be generated and attached as an `Authorization` header in the HTTP request. This type of authorization should generally only be used when calling Google APIs hosted on *.googleapis.com.

httpTarget.oauthToken.scope

Optional

string

OAuth scope to be used for generating OAuth access token. If not specified, "https://www.googleapis.com/auth/cloud-platform" will be used.

httpTarget.oauthToken.serviceAccountRef

Optional

object

httpTarget.oauthToken.serviceAccountRef.external

Optional

string

(https://cloud.google.com/iam/docs/service-accounts) to be used for generating OAuth token. The service account must be within the same project as the job. The caller must have iam.serviceAccounts.actAs permission for the service account.

httpTarget.oauthToken.serviceAccountRef.name

Optional

string

Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

httpTarget.oauthToken.serviceAccountRef.namespace

Optional

string

Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

httpTarget.oidcToken

Optional

object

If specified, an (https://developers.google.com/identity/protocols/OpenIDConnect) token will be generated and attached as an `Authorization` header in the HTTP request. This type of authorization can be used for many scenarios, including calling Cloud Run, or endpoints where you intend to validate the token yourself.

httpTarget.oidcToken.audience

Optional

string

Audience to be used when generating OIDC token. If not specified, the URI specified in target will be used.

httpTarget.oidcToken.serviceAccountRef

Optional

object

httpTarget.oidcToken.serviceAccountRef.external

Optional

string

(https://cloud.google.com/iam/docs/service-accounts) to be used for generating OIDC token. The service account must be within the same project as the job. The caller must have iam.serviceAccounts.actAs permission for the service account.

httpTarget.oidcToken.serviceAccountRef.name

Optional

string

Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

httpTarget.oidcToken.serviceAccountRef.namespace

Optional

string

Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

httpTarget.uri

Required*

string

Required. The full URI path that the request will be sent to. This string must begin with either "http://" or "https://". Some examples of valid values for are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will encode some characters for safety and compatibility. The maximum allowed URL length is 2083 characters after encoding.

location

Required

string

The location for the resource

pubsubTarget

Optional

object

Pub/Sub target.

pubsubTarget.attributes

Optional

map (key: string, value: string)

Attributes for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.

pubsubTarget.data

Optional

string

The message payload for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.

pubsubTarget.topicRef

Required*

object

pubsubTarget.topicRef.external

Optional

string

Required. The name of the Cloud Pub/Sub topic to which messages will be published when a job is delivered. The topic name must be in the same format as required by Pub/Sub's PublishRequest.name, for example `projects/PROJECT_ID/topics/TOPIC_ID`. The topic must be in the same project as the Cloud Scheduler job.

pubsubTarget.topicRef.name

Optional

string

Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

pubsubTarget.topicRef.namespace

Optional

string

Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

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.

retryConfig

Optional

object

Settings that determine the retry behavior.

retryConfig.maxBackoffDuration

Optional

string

The maximum amount of time to wait before retrying a job after it fails. The default value of this field is 1 hour.

retryConfig.maxDoublings

Optional

integer

The time between retries will double `max_doublings` times. A job's retry interval starts at times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... The default value of this field is 5.

retryConfig.maxRetryDuration

Optional

string

The time limit for retrying a failed job, measured from time when an execution was first attempted. If specified with retryCount, the job will be retried until both limits are reached. The default value for max_retry_duration is zero, which means retry duration is unlimited.

retryConfig.minBackoffDuration

Optional

string

The minimum amount of time to wait before retrying a job after it fails. The default value of this field is 5 seconds.

retryConfig.retryCount

Optional

integer

The number of attempts that the system will make to run a job using the exponential backoff procedure described by maxDoublings. The default value of retry_count is zero. If retry_count is zero, a job attempt will *not* be retried if it fails. Instead the Cloud Scheduler system will wait for the next scheduled execution time. If retry_count is set to a non-zero number then Cloud Scheduler will retry failed attempts, using exponential backoff, retry_count times, or until the next scheduled execution time, whichever comes first. Values greater than 5 and negative values are not allowed.

schedule

Optional

string

Required, except when used with times, with exponential backoff, until the next scheduled start time.

timeZone

Optional

string

Specifies the time zone to be used in interpreting (http://en.wikipedia.org/wiki/Tz_database). Note that some time zones include a provision for daylight savings time. The rules for daylight saving time are determined by the chosen tz. For UTC use the string "utc". If a time zone is not specified, the default will be in UTC (also known as GMT).

* Field is required when parent field is specified

Status

Schema

  appEngineHttpTarget:
    appEngineRouting:
      host: string
  conditions:
  - lastTransitionTime: string
    message: string
    reason: string
    status: string
    type: string
  lastAttemptTime: string
  observedGeneration: integer
  scheduleTime: string
  state: string
  status:
    code: integer
    details:
    - typeUrl: string
      value: string
    message: string
  userUpdateTime: string
Fields
appEngineHttpTarget

object

appEngineHttpTarget.appEngineRouting

object

appEngineHttpTarget.appEngineRouting.host

string

Output only. The host that the job is sent to. For more information about how Appengine requests are routed, see (https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). The host is constructed as: * `host = is invalid, then the job will be sent to the default version of the default service when the job is attempted.

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.

lastAttemptTime

string

Output only. The time the last job attempt started.

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.

scheduleTime

string

Output only. The next time the job is scheduled. Note that this may be a retry of a previously failed attempt or the next execution time according to the schedule.

state

string

Output only. State of the job. Possible values: STATE_UNSPECIFIED, ENABLED, PAUSED, DISABLED, UPDATE_FAILED

status

object

Output only. The response from the target for the last attempted execution.

status.code

integer

The status code, which should be an enum value of google.rpc.Code.

status.details

list (object)

A list of messages that carry the error details. There is a common set of message types for APIs to use.

status.details.[]

object

status.details.[].typeUrl

string

A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one "/" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading "." is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.

status.details.[].value

string

Must be a valid serialized protocol buffer of the above specified type.

status.message

string

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the field, or localized by the client.

userUpdateTime

string

Output only. The creation time of the job.

Sample YAML(s)

Scheduler Job Http

  # 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: cloudscheduler.cnrm.cloud.google.com/v1beta1
  kind: CloudSchedulerJob
  metadata:
    name: cloudscheduler-sample-http
  spec:
    description: "scheduler-http-target-job"
    schedule: "*/5 * * * *"
    location: "us-west2"
    timeZone: "EST"
    attemptDeadline: "600s"
    retryConfig:
      retryCount: 3
      maxRetryDuration: "60s"
      maxDoublings: 2
    httpTarget:
      headers:
        app: test
        Content-Type: application/octet-stream
        User-Agent: Google-Cloud-Scheduler
      httpMethod: "POST"
      uri: "https://example.com/ping"
      body: "eyJmb28iOiJiYXIifQo=" # base64 encoded {"foo":"bar"}

Scheduler Job Oauth

  # 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: cloudscheduler.cnrm.cloud.google.com/v1beta1
  kind: CloudSchedulerJob
  metadata:
    name: cloudscheduler-sample-oauth
  spec:
    description: "scheduler-http-target-job"
    schedule: "*/5 * * * *"
    location: "us-west2"
    timeZone: "America/New_York"
    attemptDeadline: "600s"
    retryConfig:
      retryCount: 3
      maxRetryDuration: "60s"
      maxDoublings: 2
    httpTarget:
      httpMethod: "GET"
      uri: "https://cloudscheduler.googleapis.com/v1/projects/my-project-name/locations/us-west1/jobs"
      oauthToken:
        serviceAccountRef:
          name: cloudscheduler-oauth-dep
  ---
  apiVersion: iam.cnrm.cloud.google.com/v1beta1
  kind: IAMServiceAccount
  metadata:
    name: cloudscheduler-oauth-dep
  spec:
    displayName: Example Service Account

Scheduler Job Pubsub

  # 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: cloudscheduler.cnrm.cloud.google.com/v1beta1
  kind: CloudSchedulerJob
  metadata:
    name: cloudscheduler-sample-pubsub
  spec:
    description: "scheduler-pubsub-target-job"
    schedule: "*/2 * * * *"
    location: "us-west2"
    pubsubTarget:
      data: "dGVzdCBtZXNzYWdlCg==" # based64 encode "test message"
      topicRef:
        name: cloudscheduler-sample-pubsub-dep
    timeZone: "EST"
  ---
  apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
  kind: PubSubTopic
  metadata:
    name: cloudscheduler-sample-pubsub-dep