Update and Delete Inspection Tasks

Users can adjust the configuration of inspection tasks to meet business needs by updating or deleting the inspection tasks during use.

Procedure

Update Inspection Tasks

Updating an inspection task is similar to updating other K8S resources. The configuration of the inspection task can be updated using the kubectl edit command.

$ kubectl edit iotedgeinspection <inspection_name>

===
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: middleware.alauda.io/v1
kind: Inspection
metadata:
  annotations:
    cpaas.io/creator: admin
    cpaas.io/display-name: ""
    cpaas.io/updated-at: "2025-02-24T05:57:46Z"
  creationTimestamp: "2025-02-24T05:57:46Z"
  generation: 1
  labels:
    inspection.middleware.io/cluster: business-1
    inspection.middleware.io/component: mysqlcluster
    inspection.middleware.io/namespace: tongrds-1
    inspection.middleware.io/project: tongrds
    inspection.middleware.io/trigger: Schedule
  name: ins1
  namespace: tongrds-1
  resourceVersion: "58781609"
  uid: 530410bc-8d12-476c-b82c-034c9ac4d3ae
spec:
  component: mysqlcluster
  instances:
  - name: '*'
  jobsHistoryLimit: 1
  schedule: 30 18 25 12 *
  trigger: Schedule
status:
  lastJobStatus: ""
  message: ""
INFO

It is important to note that users can only update fields within the spec structure; fields in the status and metadata structures are read-only.

Delete Inspection Tasks

Deleting an inspection task is similar to deleting other K8S resources. The inspection task can be deleted using the kubectl delete command.

kubectl delete -n <namespace> inspection <inspection_name>
INFO

It is important to note that, by design, inspectionjob corresponds one-to-one with inspection. Therefore, when an inspection is deleted, the corresponding inspectionjob will be automatically deleted.