testkube icon indicating copy to clipboard operation
testkube copied to clipboard

Triggering test based on cluster events

Open exu opened this issue 1 year ago • 5 comments

DoD:

Run test / test suites when resource change

We decided to go with TestTrigger CRD

apiVersion: tests.testkube.io/v1
kind: TestTrigger
metadata:
  name: deployment-test-trigger
spec:
  testName: someLoadTest
  # or
  #testSuiteName: someLoadTest
  labels:
    app: my-deployment
  event: update
  • watch based on labels on given event
  • reconcile triggers in operator/watcher
  • watcher should be put it into Testkube API

----------- EDIT ----------

we was also considering labels, but they are no flexible enough.

Resource should have testkube.io/v1 annotation

Option one: e.g.

labels: 
     testkube.io/v1/trigger-test/name: test-name
     testkube.io/v1/trigger-test/variables: key=value,key2=value2

exu avatar Aug 23 '22 13:08 exu

Should we integrate Mario's work https://github.com/lreimer/testkube-watch-controller?

vsukhin avatar Aug 24 '22 05:08 vsukhin

This is one of the features I was trying to achieve with ArgoCD, enabling this will be a lifesaver.

abhipsnl avatar Aug 24 '22 10:08 abhipsnl

Should we integrate Mario's work https://github.com/lreimer/testkube-watch-controller? Always happy to help on the integration work.

I prefer option 1) using labels, because it allows for more flexibility. Option 2) using the CRDs feels a bit rigid. Maybe have a dedicated CRD such as TestTrigger would allow for more flexibility?

apiVersion: tests.testkube.io/v1
kind: TestTrigger
metadata:
  name: deployment-test-trigger
spec:
  testName: someLoadTest
  labels:
    app: my-deployment
  event: update

lreimer avatar Aug 24 '22 11:08 lreimer

I like this idea of doing separate resources, labels feels limited a little bit

exu avatar Aug 24 '22 11:08 exu

Are there any thoughts of enabling this with ArgoCD plugin?

abhipsnl avatar Sep 06 '22 12:09 abhipsnl

This is finally implemented with this PR: https://github.com/kubeshop/testkube/pull/2445

dejanzele avatar Oct 03 '22 10:10 dejanzele