Skip to content

Latest commit

 

History

History
1979 lines (1782 loc) · 55.7 KB

PrefectAutomation.md

File metadata and controls

1979 lines (1782 loc) · 55.7 KB

API Reference

Packages:

prefect.io/v1

Resource Types:

PrefectAutomation

↩ Parent

PrefectAutomation is the Schema for the prefectautomations API

Name Type Description Required
apiVersion string prefect.io/v1 true
kind string PrefectAutomation true
metadata object Refer to the Kubernetes API documentation for the fields of the `metadata` field. true
spec object PrefectAutomationSpec defines the desired state of a PrefectAutomation. It mirrors the options of the Prefect Terraform provider's prefect_automation resource so automations can be managed declaratively via the operator.
false
status object PrefectAutomationStatus defines the observed state of a PrefectAutomation.
false

PrefectAutomation.spec

↩ Parent

PrefectAutomationSpec defines the desired state of a PrefectAutomation. It mirrors the options of the Prefect Terraform provider's prefect_automation resource so automations can be managed declaratively via the operator.

Name Type Description Required
name string Name of the automation
true
server object Server configuration for connecting to the Prefect API

Validations:
  • !(has(self.apiKey) && has(self.auth)): set apiKey or auth, not both
  • true
    trigger object Trigger is the criteria for which events this automation covers. Exactly one of event, metric, compound, or sequence must be set.
    true
    actions []object Actions to perform when the automation is triggered
    false
    actionsOnResolve []object ActionsOnResolve are actions executed when the trigger resolves
    false
    actionsOnTrigger []object ActionsOnTrigger are actions executed when the trigger fires
    false
    description string Description is human-readable documentation for the automation
    false
    enabled boolean Enabled activates or deactivates the automation. Defaults to true, matching the server's default for an omitted enabled field.

    Default: true
    false
    interval string Interval is how often to re-check this automation against the Prefect API to correct out-of-band drift (edits or deletes made directly in Prefect). Defaults to the operator's --default-resync-interval when unset. Values below 10s are clamped.
    false

    PrefectAutomation.spec.server

    ↩ Parent

    Server configuration for connecting to the Prefect API

    Name Type Description Required
    accountId string AccountID is the ID of the account to use to connect to Prefect Cloud
    false
    apiKey object APIKey is the API key to use to connect to a remote Prefect Server

    Validations:
  • !(has(self.value) && has(self.valueFrom)): set apiKey.value or apiKey.valueFrom, not both
  • false
    auth object Auth is the auth string to send to a Prefect server that requires one, such as an in-cluster server with spec.auth. The operator sends it as HTTP basic authentication, and only to an API URL that the Secret's prefect.io/allowed-api-urls annotation lists, as for apiKey.valueFrom. A work pool's worker gets it as PREFECT_API_AUTH_STRING.

    Validations:
  • size(self.secretKeyRef.name) > 0: secretKeyRef.name must be set
  • !has(self.secretKeyRef.optional) || !self.secretKeyRef.optional: secretKeyRef.optional must not be true
  • false
    name string Name is the name of the in-cluster Prefect Server in the given namespace. It must be a DNS label: lower case letters, digits and hyphens.
    false
    namespace string Namespace is the namespace where the in-cluster Prefect Server is running. It must be a DNS label: lower case letters, digits and hyphens.
    false
    remoteApiUrl string RemoteAPIURL is the API URL for the remote Prefect Server. Set if using with an external Prefect Server or Prefect Cloud. It must be an http or https URL with a host, and without user information, a query or a fragment.

    Validations:
  • isURL(self) && url(self).getScheme() in ['http', 'https'] && url(self).getHostname() != '' && !self.contains('@') && !self.contains('?') && !self.contains('#'): remoteApiUrl must be an http or https URL with a host, and without user information, a query or a fragment
  • false
    workspaceId string WorkspaceID is the ID of the workspace to use to connect to Prefect Cloud
    false

    PrefectAutomation.spec.server.apiKey

    ↩ Parent

    APIKey is the API key to use to connect to a remote Prefect Server

    Name Type Description Required
    value string Value is the literal value of the API key
    false
    valueFrom object ValueFrom is a reference to a Secret or ConfigMap key holding the API key, in the resource's namespace. The Secret or ConfigMap must have the annotation prefect.io/allowed-api-urls, a comma-separated list of the Prefect API URLs that the key may be used for. The chart's admission policy also requires that you may get the Secret or ConfigMap.
    false

    PrefectAutomation.spec.server.apiKey.valueFrom

    ↩ Parent

    ValueFrom is a reference to a Secret or ConfigMap key holding the API key, in the resource's namespace. The Secret or ConfigMap must have the annotation prefect.io/allowed-api-urls, a comma-separated list of the Prefect API URLs that the key may be used for. The chart's admission policy also requires that you may get the Secret or ConfigMap.

    Name Type Description Required
    configMapKeyRef object Selects a key of a ConfigMap.
    false
    fieldRef object Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
    false
    fileKeyRef object FileKeyRef selects a key of the env file. Requires the EnvFiles feature gate to be enabled.
    false
    resourceFieldRef object Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.
    false
    secretKeyRef object Selects a key of a secret in the pod's namespace
    false

    PrefectAutomation.spec.server.apiKey.valueFrom.configMapKeyRef

    ↩ Parent

    Selects a key of a ConfigMap.

    Name Type Description Required
    key string The key to select from the ConfigMap's Data field. Keys in the BinaryData field are not currently propagated to container env vars.
    true
    name string Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

    Default:
    false
    optional boolean Specify whether the ConfigMap or its key must be defined
    false

    PrefectAutomation.spec.server.apiKey.valueFrom.fieldRef

    ↩ Parent

    Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels['<KEY>'], metadata.annotations['<KEY>'], spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.

    Name Type Description Required
    fieldPath string Path of the field to select in the specified API version.
    true
    apiVersion string Version of the schema the FieldPath is written in terms of, defaults to "v1".
    false

    PrefectAutomation.spec.server.apiKey.valueFrom.fileKeyRef

    ↩ Parent

    FileKeyRef selects a key of the env file. Requires the EnvFiles feature gate to be enabled.

    Name Type Description Required
    key string The key within the env file. An invalid key will prevent the pod from starting. The keys defined within a source may consist of any printable ASCII characters except '='. During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
    true
    path string The path within the volume from which to select the file. Must be relative and may not contain the '..' path or start with '..'.
    true
    volumeName string The name of the volume mount containing the env file.
    true
    optional boolean Specify whether the file or its key must be defined. If the file or key does not exist, then the env var is not published. If optional is set to true and the specified key does not exist, the environment variable will not be set in the Pod's containers.

    If optional is set to false and the specified key does not exist, an error will be returned during Pod creation.

    Default: false

    false

    PrefectAutomation.spec.server.apiKey.valueFrom.resourceFieldRef

    ↩ Parent

    Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.

    Name Type Description Required
    resource string Required: resource to select
    true
    containerName string Container name: required for volumes, optional for env vars
    false
    divisor int or string Specifies the output format of the exposed resources, defaults to "1"
    false

    PrefectAutomation.spec.server.apiKey.valueFrom.secretKeyRef

    ↩ Parent

    Selects a key of a secret in the pod's namespace

    Name Type Description Required
    key string The key of the secret to select from. Must be a valid secret key.
    true
    name string Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

    Default:
    false
    optional boolean Specify whether the Secret or its key must be defined
    false

    PrefectAutomation.spec.server.auth

    ↩ Parent

    Auth is the auth string to send to a Prefect server that requires one, such as an in-cluster server with spec.auth. The operator sends it as HTTP basic authentication, and only to an API URL that the Secret's prefect.io/allowed-api-urls annotation lists, as for apiKey.valueFrom. A work pool's worker gets it as PREFECT_API_AUTH_STRING.

    Name Type Description Required
    secretKeyRef object SecretKeyRef selects a key of a Secret in the resource's namespace. It must not be optional: a pod that uses it does not start without the key.
    true

    PrefectAutomation.spec.server.auth.secretKeyRef

    ↩ Parent

    SecretKeyRef selects a key of a Secret in the resource's namespace. It must not be optional: a pod that uses it does not start without the key.

    Name Type Description Required
    key string The key of the secret to select from. Must be a valid secret key.
    true
    name string Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

    Default:
    false
    optional boolean Specify whether the Secret or its key must be defined
    false

    PrefectAutomation.spec.trigger

    ↩ Parent

    Trigger is the criteria for which events this automation covers. Exactly one of event, metric, compound, or sequence must be set.

    Name Type Description Required
    compound object Compound trigger fires when a number of child triggers fire within a window
    false
    event object Event trigger reacts to (or waits for the absence of) events
    false
    metric object Metric trigger fires when a metric crosses a threshold
    false
    sequence object Sequence trigger fires when child triggers fire in order within a window
    false

    PrefectAutomation.spec.trigger.compound

    ↩ Parent

    Compound trigger fires when a number of child triggers fire within a window

    Name Type Description Required
    require string Require is how many child triggers must fire: "any", "all", or a number
    true
    triggers []object Triggers are the child triggers (event or metric)
    true
    within integer Within is the time window in seconds
    false

    PrefectAutomation.spec.trigger.compound.triggers[index]

    ↩ Parent

    PrefectChildTrigger is a trigger nested inside a compound or sequence trigger. Prefect only allows event or metric triggers as children (not further compound/sequence nesting), which also keeps the CRD schema non-recursive. Exactly one of event or metric must be set.

    Name Type Description Required
    event object Event trigger
    false
    metric object Metric trigger
    false

    PrefectAutomation.spec.trigger.compound.triggers[index].event

    ↩ Parent

    Event trigger

    Name Type Description Required
    posture enum Posture is the trigger posture.

    Enum: Reactive, Proactive
    true
    after []string After is the set of event names that must precede the expected events
    false
    expect []string Expect is the set of event names the trigger expects to see
    false
    forEach []string ForEach groups events by the given resource fields
    false
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false
    threshold integer Threshold is the number of events required to fire the trigger
    false
    within integer Within is the time window in seconds
    false

    PrefectAutomation.spec.trigger.compound.triggers[index].metric

    ↩ Parent

    Metric trigger

    Name Type Description Required
    metric object Metric is the metric query definition
    true
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false

    PrefectAutomation.spec.trigger.compound.triggers[index].metric.metric

    ↩ Parent

    Metric is the metric query definition

    Name Type Description Required
    firingFor integer FiringFor is the duration in seconds the query must breach/resolve continuously
    true
    name string Name is the metric to query
    true
    operator enum Operator is the comparative operator used to evaluate the query result

    Enum: <, <=, >, >=
    true
    range integer Range is the lookback duration in seconds for the metric query
    true
    threshold int or string Threshold is the value the metric is compared against (may be fractional)
    true

    PrefectAutomation.spec.trigger.event

    ↩ Parent

    Event trigger reacts to (or waits for the absence of) events

    Name Type Description Required
    posture enum Posture is the trigger posture.

    Enum: Reactive, Proactive
    true
    after []string After is the set of event names that must precede the expected events
    false
    expect []string Expect is the set of event names the trigger expects to see
    false
    forEach []string ForEach groups events by the given resource fields
    false
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false
    threshold integer Threshold is the number of events required to fire the trigger
    false
    within integer Within is the time window in seconds
    false

    PrefectAutomation.spec.trigger.metric

    ↩ Parent

    Metric trigger fires when a metric crosses a threshold

    Name Type Description Required
    metric object Metric is the metric query definition
    true
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false

    PrefectAutomation.spec.trigger.metric.metric

    ↩ Parent

    Metric is the metric query definition

    Name Type Description Required
    firingFor integer FiringFor is the duration in seconds the query must breach/resolve continuously
    true
    name string Name is the metric to query
    true
    operator enum Operator is the comparative operator used to evaluate the query result

    Enum: <, <=, >, >=
    true
    range integer Range is the lookback duration in seconds for the metric query
    true
    threshold int or string Threshold is the value the metric is compared against (may be fractional)
    true

    PrefectAutomation.spec.trigger.sequence

    ↩ Parent

    Sequence trigger fires when child triggers fire in order within a window

    Name Type Description Required
    triggers []object Triggers are the child triggers, which must fire in order
    true
    within integer Within is the time window in seconds
    false

    PrefectAutomation.spec.trigger.sequence.triggers[index]

    ↩ Parent

    PrefectChildTrigger is a trigger nested inside a compound or sequence trigger. Prefect only allows event or metric triggers as children (not further compound/sequence nesting), which also keeps the CRD schema non-recursive. Exactly one of event or metric must be set.

    Name Type Description Required
    event object Event trigger
    false
    metric object Metric trigger
    false

    PrefectAutomation.spec.trigger.sequence.triggers[index].event

    ↩ Parent

    Event trigger

    Name Type Description Required
    posture enum Posture is the trigger posture.

    Enum: Reactive, Proactive
    true
    after []string After is the set of event names that must precede the expected events
    false
    expect []string Expect is the set of event names the trigger expects to see
    false
    forEach []string ForEach groups events by the given resource fields
    false
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false
    threshold integer Threshold is the number of events required to fire the trigger
    false
    within integer Within is the time window in seconds
    false

    PrefectAutomation.spec.trigger.sequence.triggers[index].metric

    ↩ Parent

    Metric trigger

    Name Type Description Required
    metric object Metric is the metric query definition
    true
    match object Match is a JSON object matching resources by label
    false
    matchRelated object MatchRelated is a JSON object matching related resources by label
    false

    PrefectAutomation.spec.trigger.sequence.triggers[index].metric.metric

    ↩ Parent

    Metric is the metric query definition

    Name Type Description Required
    firingFor integer FiringFor is the duration in seconds the query must breach/resolve continuously
    true
    name string Name is the metric to query
    true
    operator enum Operator is the comparative operator used to evaluate the query result

    Enum: <, <=, >, >=
    true
    range integer Range is the lookback duration in seconds for the metric query
    true
    threshold int or string Threshold is the value the metric is compared against (may be fractional)
    true

    PrefectAutomation.spec.actions[index]

    ↩ Parent

    PrefectAutomationAction matches Prefect's action union. type selects the action; the remaining fields apply to the relevant action types.

    Name Type Description Required
    type enum Type is the action to perform.

    Enum: do-nothing, run-deployment, pause-deployment, resume-deployment, cancel-flow-run, change-flow-run-state, suspend-flow-run, resume-flow-run, pause-work-queue, resume-work-queue, pause-work-pool, resume-work-pool, pause-automation, resume-automation, send-notification, call-webhook, declare-incident, pause-schedule-for-flow-run, resume-schedule-for-flow-run
    true
    automationId string AutomationID targets an automation (pause/resume-automation)
    false
    blockDocumentId string BlockDocumentID targets a block document (send-notification/call-webhook)
    false
    body string Body is the notification body
    false
    deploymentId string DeploymentID targets a deployment (run/pause/resume-deployment) by its Prefect UUID.
    false
    deploymentName string DeploymentName targets a deployment (run/pause/resume-deployment) by its Prefect deployment name; the operator resolves it to a deployment ID at reconcile time (so automations can reference deployments declaratively, without knowing the runtime-assigned UUID). Mutually exclusive with DeploymentID. If the named deployment does not exist yet, reconciliation requeues until it does.
    false
    jobVariables object JobVariables is a JSON object of job variables for run-deployment
    false
    message string Message is the state message (change-flow-run-state) or notification body
    false
    name string Name is the state name for change-flow-run-state
    false
    parameters object Parameters is a JSON object of parameters for run-deployment
    false
    payload string Payload is the webhook payload (call-webhook)
    false
    scheduleId string ScheduleID targets a schedule (pause/resume-schedule-for-flow-run)
    false
    source enum Source selects whether the target is "selected" (explicit ID) or "inferred" from the triggering event.

    Enum: selected, inferred
    false
    state string State is the target state for change-flow-run-state
    false
    subject string Subject is the notification subject
    false
    workPoolId string WorkPoolID targets a work pool (pause/resume-work-pool)
    false
    workQueueId string WorkQueueID targets a work queue (pause/resume-work-queue)
    false

    PrefectAutomation.spec.actionsOnResolve[index]

    ↩ Parent

    PrefectAutomationAction matches Prefect's action union. type selects the action; the remaining fields apply to the relevant action types.

    Name Type Description Required
    type enum Type is the action to perform.

    Enum: do-nothing, run-deployment, pause-deployment, resume-deployment, cancel-flow-run, change-flow-run-state, suspend-flow-run, resume-flow-run, pause-work-queue, resume-work-queue, pause-work-pool, resume-work-pool, pause-automation, resume-automation, send-notification, call-webhook, declare-incident, pause-schedule-for-flow-run, resume-schedule-for-flow-run
    true
    automationId string AutomationID targets an automation (pause/resume-automation)
    false
    blockDocumentId string BlockDocumentID targets a block document (send-notification/call-webhook)
    false
    body string Body is the notification body
    false
    deploymentId string DeploymentID targets a deployment (run/pause/resume-deployment) by its Prefect UUID.
    false
    deploymentName string DeploymentName targets a deployment (run/pause/resume-deployment) by its Prefect deployment name; the operator resolves it to a deployment ID at reconcile time (so automations can reference deployments declaratively, without knowing the runtime-assigned UUID). Mutually exclusive with DeploymentID. If the named deployment does not exist yet, reconciliation requeues until it does.
    false
    jobVariables object JobVariables is a JSON object of job variables for run-deployment
    false
    message string Message is the state message (change-flow-run-state) or notification body
    false
    name string Name is the state name for change-flow-run-state
    false
    parameters object Parameters is a JSON object of parameters for run-deployment
    false
    payload string Payload is the webhook payload (call-webhook)
    false
    scheduleId string ScheduleID targets a schedule (pause/resume-schedule-for-flow-run)
    false
    source enum Source selects whether the target is "selected" (explicit ID) or "inferred" from the triggering event.

    Enum: selected, inferred
    false
    state string State is the target state for change-flow-run-state
    false
    subject string Subject is the notification subject
    false
    workPoolId string WorkPoolID targets a work pool (pause/resume-work-pool)
    false
    workQueueId string WorkQueueID targets a work queue (pause/resume-work-queue)
    false

    PrefectAutomation.spec.actionsOnTrigger[index]

    ↩ Parent

    PrefectAutomationAction matches Prefect's action union. type selects the action; the remaining fields apply to the relevant action types.

    Name Type Description Required
    type enum Type is the action to perform.

    Enum: do-nothing, run-deployment, pause-deployment, resume-deployment, cancel-flow-run, change-flow-run-state, suspend-flow-run, resume-flow-run, pause-work-queue, resume-work-queue, pause-work-pool, resume-work-pool, pause-automation, resume-automation, send-notification, call-webhook, declare-incident, pause-schedule-for-flow-run, resume-schedule-for-flow-run
    true
    automationId string AutomationID targets an automation (pause/resume-automation)
    false
    blockDocumentId string BlockDocumentID targets a block document (send-notification/call-webhook)
    false
    body string Body is the notification body
    false
    deploymentId string DeploymentID targets a deployment (run/pause/resume-deployment) by its Prefect UUID.
    false
    deploymentName string DeploymentName targets a deployment (run/pause/resume-deployment) by its Prefect deployment name; the operator resolves it to a deployment ID at reconcile time (so automations can reference deployments declaratively, without knowing the runtime-assigned UUID). Mutually exclusive with DeploymentID. If the named deployment does not exist yet, reconciliation requeues until it does.
    false
    jobVariables object JobVariables is a JSON object of job variables for run-deployment
    false
    message string Message is the state message (change-flow-run-state) or notification body
    false
    name string Name is the state name for change-flow-run-state
    false
    parameters object Parameters is a JSON object of parameters for run-deployment
    false
    payload string Payload is the webhook payload (call-webhook)
    false
    scheduleId string ScheduleID targets a schedule (pause/resume-schedule-for-flow-run)
    false
    source enum Source selects whether the target is "selected" (explicit ID) or "inferred" from the triggering event.

    Enum: selected, inferred
    false
    state string State is the target state for change-flow-run-state
    false
    subject string Subject is the notification subject
    false
    workPoolId string WorkPoolID targets a work pool (pause/resume-work-pool)
    false
    workQueueId string WorkQueueID targets a work queue (pause/resume-work-queue)
    false

    PrefectAutomation.status

    ↩ Parent

    PrefectAutomationStatus defines the observed state of a PrefectAutomation.

    Name Type Description Required
    ready boolean Ready indicates that the automation exists and is configured correctly
    true
    conditions []object Conditions store the status conditions of the PrefectAutomation instances
    false
    id string Id is the automation ID from Prefect
    false
    lastSyncTime string LastSyncTime is the last time the automation was synced with Prefect

    Format: date-time
    false
    observedGeneration integer ObservedGeneration tracks the last processed generation

    Format: int64
    false
    specHash string SpecHash tracks changes to the spec to minimize API calls
    false

    PrefectAutomation.status.conditions[index]

    ↩ Parent

    Condition contains details for one aspect of the current state of this API Resource.

    Name Type Description Required
    lastTransitionTime string lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.

    Format: date-time
    true
    message string message is a human readable message indicating details about the transition. This may be an empty string.
    true
    reason string reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
    true
    status enum status of the condition, one of True, False, Unknown.

    Enum: True, False, Unknown
    true
    type string type of condition in CamelCase or in foo.example.com/CamelCase.
    true
    observedGeneration integer observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.

    Format: int64
    Minimum: 0
    false