{
  "description": "DatadogPodAutoscaler is the Schema for the datadogpodautoscalers API",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "DatadogPodAutoscalerSpec defines the desired state of DatadogPodAutoscaler",
      "properties": {
        "constraints": {
          "description": "Constraints defines constraints that should always be respected.",
          "properties": {
            "containers": {
              "description": "Containers defines constraints for the containers.",
              "items": {
                "description": "DatadogPodAutoscalerContainerConstraints defines constraints that should always be respected for a container.\nIf no constraints are set, it enables resource scaling for all containers without any constraints.",
                "properties": {
                  "enabled": {
                    "description": "Enabled, if false, allows one to disable resource autoscaling for the container. Defaults to true.",
                    "type": "boolean"
                  },
                  "name": {
                    "description": "Name is the name of the container. Can be \"*\" to apply to all containers.",
                    "type": "string"
                  },
                  "requests": {
                    "description": "Requests defines the constraints for the requests of the container.",
                    "properties": {
                      "maxAllowed": {
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "string"
                            }
                          ],
                          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                          "x-kubernetes-int-or-string": true
                        },
                        "description": "MaxAllowed is the upper limit for the requests of the container.",
                        "type": "object"
                      },
                      "minAllowed": {
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "string"
                            }
                          ],
                          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                          "x-kubernetes-int-or-string": true
                        },
                        "description": "MinAllowed is the lower limit for the requests of the container.",
                        "type": "object"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "maxReplicas": {
              "description": "MaxReplicas is the upper limit for the number of POD replicas. Needs to be >= minReplicas.",
              "format": "int32",
              "type": "integer"
            },
            "minReplicas": {
              "description": "MinReplicas is the lower limit for the number of pod replicas. Needs to be >= 1. Defaults to 1.",
              "format": "int32",
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "maxReplicas"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "owner": {
          "description": "Owner defines the source of truth for this object (local or remote)\nValue needs to be set when a DatadogPodAutoscaler object is created.",
          "enum": [
            "Local",
            "Remote"
          ],
          "type": "string"
        },
        "policy": {
          "default": {},
          "description": "Policy defines how recommendations should be applied.",
          "properties": {
            "applyMode": {
              "default": "All",
              "description": "ApplyMode determines recommendations that should be applied by the controller:\n- All: Apply all recommendations (regular and manual).\n- Manual: Apply only manual recommendations (recommendations manually validated by user in the Datadog app).\n- None: Prevent the controller to apply any recommendations.\nIt's also possible to selectively deactivate upscale, downscale or update actions thanks to the `Upscale`, `Downscale` and `Update` fields.",
              "enum": [
                "All",
                "Manual",
                "None"
              ],
              "type": "string"
            },
            "downscale": {
              "description": "Downscale defines the policy to scale down the target resource.",
              "properties": {
                "rules": {
                  "description": "Rules is a list of potential scaling polices which can be used during scaling.\nAt least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid",
                  "items": {
                    "description": "DatadogPodAutoscalerScalingRule defines rules for horizontal scaling that should be true for a certain amount of time.",
                    "properties": {
                      "periodSeconds": {
                        "description": "PeriodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).",
                        "format": "int32",
                        "maximum": 1800,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "type": {
                        "description": "Type is used to specify the scaling policy.",
                        "enum": [
                          "Pods",
                          "Percent"
                        ],
                        "type": "string"
                      },
                      "value": {
                        "description": "Value contains the amount of change which is permitted by the policy.\nSetting it to 0 will prevent any scaling in this direction.",
                        "format": "int32",
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "periodSeconds",
                      "type",
                      "value"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  },
                  "type": "array",
                  "x-kubernetes-list-type": "atomic"
                },
                "stabilizationWindowSeconds": {
                  "description": "StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations\nbefore deciding to apply a new one. Defaults to 0.",
                  "format": "int32",
                  "maximum": 1800,
                  "minimum": 0,
                  "type": "integer"
                },
                "strategy": {
                  "description": "Strategy is used to specify which policy should be used.\nIf not set, the default value Max is used.",
                  "enum": [
                    "Max",
                    "Min",
                    "Disabled"
                  ],
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "update": {
              "description": "Update defines the policy to update target resource.",
              "properties": {
                "strategy": {
                  "description": "Strategy defines the mode of the update policy.",
                  "enum": [
                    "Auto",
                    "Disabled"
                  ],
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "upscale": {
              "description": "Upscale defines the policy to scale up the target resource.",
              "properties": {
                "rules": {
                  "description": "Rules is a list of potential scaling polices which can be used during scaling.\nAt least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid",
                  "items": {
                    "description": "DatadogPodAutoscalerScalingRule defines rules for horizontal scaling that should be true for a certain amount of time.",
                    "properties": {
                      "periodSeconds": {
                        "description": "PeriodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).",
                        "format": "int32",
                        "maximum": 1800,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "type": {
                        "description": "Type is used to specify the scaling policy.",
                        "enum": [
                          "Pods",
                          "Percent"
                        ],
                        "type": "string"
                      },
                      "value": {
                        "description": "Value contains the amount of change which is permitted by the policy.\nSetting it to 0 will prevent any scaling in this direction.",
                        "format": "int32",
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "periodSeconds",
                      "type",
                      "value"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  },
                  "type": "array",
                  "x-kubernetes-list-type": "atomic"
                },
                "stabilizationWindowSeconds": {
                  "description": "StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations\nbefore deciding to apply a new one. Defaults to 0.",
                  "format": "int32",
                  "maximum": 1800,
                  "minimum": 0,
                  "type": "integer"
                },
                "strategy": {
                  "description": "Strategy is used to specify which policy should be used.\nIf not set, the default value Max is used.",
                  "enum": [
                    "Max",
                    "Min",
                    "Disabled"
                  ],
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "remoteVersion": {
          "description": "RemoteVersion is the version of the .Spec currently store in this object.\nOnly set if the owner is Remote.",
          "format": "int64",
          "type": "integer"
        },
        "targetRef": {
          "description": "TargetRef is the reference to the resource to scale.",
          "properties": {
            "apiVersion": {
              "description": "apiVersion is the API version of the referent",
              "type": "string"
            },
            "kind": {
              "description": "kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
              "type": "string"
            },
            "name": {
              "description": "name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
              "type": "string"
            }
          },
          "required": [
            "kind",
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "targets": {
          "description": "Targets are objectives to reach and maintain for the target resource.\nDefault to a single target to maintain 80% POD CPU utilization.",
          "items": {
            "description": "DatadogPodAutoscalerObjective defines the objectives to reach and maintain for the target workload.",
            "properties": {
              "containerResource": {
                "description": "ContainerResource allows to set a container-level resource objective.",
                "properties": {
                  "container": {
                    "description": "Container is the name of the container.",
                    "type": "string"
                  },
                  "name": {
                    "description": "Name is the name of the resource.",
                    "enum": [
                      "cpu"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "description": "Value is the value of the objective",
                    "properties": {
                      "type": {
                        "description": "Type specifies how the value is expressed (possible values: Utilization).",
                        "type": "string"
                      },
                      "utilization": {
                        "description": "Utilization defines a percentage of the target compared to requested workload",
                        "format": "int32",
                        "maximum": 100,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "container",
                  "name",
                  "value"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "podResource": {
                "description": "PodResource allows to set a pod-level resource objective.",
                "properties": {
                  "name": {
                    "description": "Name is the name of the resource.",
                    "enum": [
                      "cpu"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "description": "Value is the value of the objective.",
                    "properties": {
                      "type": {
                        "description": "Type specifies how the value is expressed (possible values: Utilization).",
                        "type": "string"
                      },
                      "utilization": {
                        "description": "Utilization defines a percentage of the target compared to requested workload",
                        "format": "int32",
                        "maximum": 100,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "value"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": {
                "description": "Type sets the type of the objective.",
                "enum": [
                  "PodResource",
                  "ContainerResource"
                ],
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        }
      },
      "required": [
        "owner",
        "targetRef"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "DatadogPodAutoscalerStatus defines the observed state of DatadogPodAutoscaler",
      "properties": {
        "conditions": {
          "description": "Conditions describe the current state of the DatadogPodAutoscaler operations.",
          "items": {
            "description": "DatadogPodAutoscalerCondition describes the state of DatadogPodAutoscaler.",
            "properties": {
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "A human readable message indicating details about the transition.",
                "type": "string"
              },
              "reason": {
                "description": "The reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status of the condition, one of True, False, Unknown.",
                "type": "string"
              },
              "type": {
                "description": "DatadogPodAutoscalerConditionType is the type of DatadogPodAutoscaler condition.",
                "type": "string"
              }
            },
            "required": [
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "currentReplicas": {
          "description": "CurrentReplicas is the current number of pods for the targetRef observed by the controller.",
          "format": "int32",
          "type": "integer"
        },
        "horizontal": {
          "description": "Horizontal is the status of the horizontal scaling, if activated.",
          "properties": {
            "lastActions": {
              "description": "LastActions are the last successful actions done by the controller",
              "items": {
                "description": "DatadogPodAutoscalerHorizontalAction represents a horizontal action done by the controller",
                "properties": {
                  "limitedReason": {
                    "description": "LimitedReason is the reason why the action was limited (that is ToReplicas != RecommendedReplicas)",
                    "type": "string"
                  },
                  "recommendedReplicas": {
                    "description": "RecommendedReplicas is the original number of replicas recommended by Datadog",
                    "format": "int32",
                    "type": "integer"
                  },
                  "replicas": {
                    "description": "FromReplicas is the number of replicas before the action",
                    "format": "int32",
                    "type": "integer"
                  },
                  "time": {
                    "description": "Time is the timestamp of the action",
                    "format": "date-time",
                    "type": "string"
                  },
                  "toReplicas": {
                    "description": "ToReplicas is the effective number of replicas after the action",
                    "format": "int32",
                    "type": "integer"
                  }
                },
                "required": [
                  "replicas",
                  "time",
                  "toReplicas"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "target": {
              "description": "Target is the current target of the horizontal scaling",
              "properties": {
                "desiredReplicas": {
                  "description": "Replicas is the desired number of replicas for the workload",
                  "format": "int32",
                  "type": "integer"
                },
                "generatedAt": {
                  "description": "GeneratedAt is the timestamp at which the recommendation was generated",
                  "format": "date-time",
                  "type": "string"
                },
                "source": {
                  "description": "Source is the source of the value used to scale the target workload",
                  "type": "string"
                }
              },
              "required": [
                "desiredReplicas",
                "source"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "vertical": {
          "description": "Vertical is the status of the vertical scaling, if activated.",
          "properties": {
            "lastAction": {
              "description": "LastAction is the last successful action done by the controller",
              "properties": {
                "time": {
                  "description": "Time is the timestamp of the action",
                  "format": "date-time",
                  "type": "string"
                },
                "type": {
                  "description": "Type is the type of action",
                  "type": "string"
                },
                "version": {
                  "description": "Version is the version of the recommendation used for the action",
                  "type": "string"
                }
              },
              "required": [
                "time",
                "type",
                "version"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "target": {
              "description": "Target is the current target of the vertical scaling",
              "properties": {
                "desiredResources": {
                  "description": "DesiredResources is the desired resources for containers",
                  "items": {
                    "properties": {
                      "limits": {
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "string"
                            }
                          ],
                          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                          "x-kubernetes-int-or-string": true
                        },
                        "description": "Limits describes the maximum amount of compute resources allowed.",
                        "type": "object"
                      },
                      "name": {
                        "description": "Name is the name of the container",
                        "type": "string"
                      },
                      "requests": {
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "string"
                            }
                          ],
                          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                          "x-kubernetes-int-or-string": true
                        },
                        "description": "Requests describes the requested amount of compute resources.",
                        "type": "object"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  },
                  "type": "array"
                },
                "generatedAt": {
                  "description": "GeneratedAt is the timestamp at which the recommendation was generated",
                  "format": "date-time",
                  "type": "string"
                },
                "podCPURequest": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "PodCPURequest is the sum of CPU requests for all containers (used for display)",
                  "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                  "x-kubernetes-int-or-string": true
                },
                "podMemoryRequest": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "PodMemoryRequest is the sum of memory requests for all containers (used for display)",
                  "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                  "x-kubernetes-int-or-string": true
                },
                "scaled": {
                  "description": "Scaled is the current number of pods having desired resources",
                  "format": "int32",
                  "type": "integer"
                },
                "source": {
                  "description": "Source is the source of the value used to scale the target resource",
                  "type": "string"
                },
                "version": {
                  "description": "Version is the current version of the received recommendation",
                  "type": "string"
                }
              },
              "required": [
                "desiredResources",
                "podCPURequest",
                "podMemoryRequest",
                "source",
                "version"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
