{
  "description": "Cleaner is the Schema for the cleaners 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": "CleanerSpec defines the desired state of Cleaner",
      "properties": {
        "action": {
          "default": "Delete",
          "description": "Action indicates the action to take on selected object. Default action\nis to delete object. If set to transform, the transform function\nwill be invoked and then object will be updated.",
          "enum": [
            "Delete",
            "Transform",
            "Scan"
          ],
          "type": "string"
        },
        "deleteOptions": {
          "description": "DeleteOption is some configuration that modifies options for a delete request.\nThis will be used only when action is delete",
          "properties": {
            "gracePeriodSeconds": {
              "description": "GracePeriodSeconds is the duration in seconds before the object should be\ndeleted. Value must be non-negative integer. The value zero indicates\ndelete immediately. If this value is nil, the default grace period for the\nspecified type will be used.",
              "format": "int64",
              "type": "integer"
            },
            "propagationPolicy": {
              "description": "PropagationPolicy determined whether and how garbage collection will be\nperformed. Either this field or OrphanDependents may be set, but not both.\nThe default policy is decided by the existing finalizer set in the\nmetadata.finalizers and the resource-specific default policy.\nAcceptable values are: 'Orphan' - orphan the dependents; 'Background' -\nallow the garbage collector to delete the dependents in the background;\n'Foreground' - a cascading policy that deletes all dependents in the\nforeground.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "notifications": {
          "description": "Notification is a list of source of events to evaluate.",
          "items": {
            "properties": {
              "name": {
                "description": "Name of the notification check.\nMust be a DNS_LABEL and unique within the Cleaner.",
                "type": "string"
              },
              "notificationRef": {
                "description": "NotificationRef is a reference to a notification-specific resource that holds\nthe details for the notification.",
                "properties": {
                  "apiVersion": {
                    "description": "API version of the referent.",
                    "type": "string"
                  },
                  "fieldPath": {
                    "description": "If referring to a piece of an object instead of an entire object, this string\nshould contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].\nFor example, if the object reference is to a container within a pod, this would take on a value like:\n\"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered\nthe event) or if no container name is specified \"spec.containers[2]\" (container with\nindex 2 in this pod). This syntax is chosen only to have some well-defined way of\nreferencing a part of an object.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind of the referent.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
                    "type": "string"
                  },
                  "name": {
                    "description": "Name of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                    "type": "string"
                  },
                  "namespace": {
                    "description": "Namespace of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
                    "type": "string"
                  },
                  "resourceVersion": {
                    "description": "Specific resourceVersion to which this reference is made, if any.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
                    "type": "string"
                  },
                  "uid": {
                    "description": "UID of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
                    "type": "string"
                  }
                },
                "type": "object",
                "x-kubernetes-map-type": "atomic",
                "additionalProperties": false
              },
              "type": {
                "description": "NotificationType specifies the type of notification",
                "enum": [
                  "CleanerReport",
                  "Slack",
                  "Webex",
                  "Discord",
                  "Teams",
                  "SMTP",
                  "Telegram",
                  "Event"
                ],
                "type": "string"
              }
            },
            "required": [
              "name",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "name"
          ],
          "x-kubernetes-list-type": "map"
        },
        "resourcePolicySet": {
          "description": "ResourcePolicySet identifies a group of resources",
          "properties": {
            "aggregatedSelection": {
              "description": "This field is optional and can be used to specify a Lua function\nthat will be used to further select a subset of the resources that\nhave already been selected using the ResourceSelector field.\nThe function will receive the array of resources selected by ResourceSelectors.\nIf this field is not specified, all resources selected by the ResourceSelector\nfield will be considered.\nThis field allows to perform more complex filtering or selection operations\non the resources, looking at all resources together.\nThis can be useful for more sophisticated tasks, such as identifying resources\nthat are related to each other or that have similar properties.",
              "type": "string"
            },
            "resourceSelectors": {
              "description": "ResourceSelectors identifies what resources to select",
              "items": {
                "properties": {
                  "evaluate": {
                    "description": "Evaluate contains a function \"evaluate\" in lua language.\nThe function will be passed one of the object selected based on\nabove criteria.\nMust return struct with field \"matching\" representing whether\nobject is a match and an optional \"message\" field.",
                    "type": "string"
                  },
                  "excludeDeleted": {
                    "default": true,
                    "description": "ExcludeDeleted if set (default value), exclude resources marked as\ndeleted. If set to false, k8s-cleaner will consider also resources marked as deleted.",
                    "type": "boolean"
                  },
                  "group": {
                    "description": "Group of the resource deployed in the Cluster.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind of the resource deployed in the Cluster.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "labelFilters": {
                    "description": "LabelFilters allows to filter resources based on current labels.",
                    "items": {
                      "properties": {
                        "key": {
                          "description": "Key is the label key",
                          "type": "string"
                        },
                        "operation": {
                          "description": "Operation is the comparison operation",
                          "enum": [
                            "Equal",
                            "Different",
                            "Has",
                            "DoesNotHave"
                          ],
                          "type": "string"
                        },
                        "value": {
                          "description": "Value is the label value",
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "operation"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "type": "array"
                  },
                  "namespace": {
                    "description": "Namespace of the resource deployed in the  Cluster.\nEmpty for resources scoped at cluster level.",
                    "type": "string"
                  },
                  "namespaceSelector": {
                    "description": "NamespaceSelector is a label selector for namespaces",
                    "type": "string"
                  },
                  "version": {
                    "description": "Version of the resource deployed in the Cluster.",
                    "type": "string"
                  }
                },
                "required": [
                  "group",
                  "kind",
                  "version"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            }
          },
          "required": [
            "resourceSelectors"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "schedule": {
          "description": "Schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
          "type": "string"
        },
        "startingDeadlineSeconds": {
          "description": "Optional deadline in seconds for starting the job if it misses scheduled\ntime for any reason.  Missed jobs executions will be counted as failed ones.",
          "format": "int64",
          "type": "integer"
        },
        "storeResourcePath": {
          "description": "StoreResources will store full resources in this directory.\nMust be a volume where Cleaner can dump all matching resources.",
          "type": "string"
        },
        "transform": {
          "description": "Transform contains a function \"transform\" in lua language.\nWhen Action is set to *Transform*, this function will be invoked\nand be passed one of the object selected based on\nabove criteria.\nMust the new object that will be applied",
          "type": "string"
        }
      },
      "required": [
        "resourcePolicySet",
        "schedule"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "CleanerStatus defines the observed state of Cleaner",
      "properties": {
        "failureMessage": {
          "description": "FailureMessage provides more information about the error, if\nany occurred",
          "type": "string"
        },
        "lastRunTime": {
          "description": "Information when was the last time a snapshot was successfully scheduled.",
          "format": "date-time",
          "type": "string"
        },
        "nextScheduleTime": {
          "description": "Information when next snapshot is scheduled",
          "format": "date-time",
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
