https://garden.io logo
#🌱|help-and-getting-started
Test action types for CRDs and for asserting properties in existing cluster resources
# 🌱|help-and-getting-started
o

orange-ability-1812

12/18/2023, 7:52 PM
Just curious if there is a more clean solution to a use case I've come across. I'm deploying an operator that installs a bunch of CRDs, the main one being
RayJob
which coordinates running a special batch job. The job itself in this case is a test. I can't run this as a Test action because there is no bare
kubernetes
type. That is alright, but would be cool if that could be a feature. As a workaround I'm writing an
exec
Test type with a shell script that pipes kubectl results to jq and some logic to see if the RayJob CRD completed properly. This is not very good because I have to use a local shell. Anyone have a nicer more portable way to do this? The feature request here would be something like a Run/Test type that can query cluster API information. I realize thats kind of a "big" feature, but it would be useful.
f

freezing-pharmacist-34446

12/19/2023, 4:46 PM
Hi @orange-ability-1812 , it is an interesting idea but would be pretty difficult to execute in YAML. A more portable solution could be if you used a Kubernetes client library that queries the Kubernetes api and validates the received objects. You could build a container with garden for this and then use a garden test of type kubernetes-pod which would execute it in the cluster. Of course you need to make sure that your kubernetes-pod has the correct RBAC permissions to query the kubernetes api.