I have a appDB controller and I am basically validating the CRDs in the webhook and I pass couple of configmaps and secrets as a field in CRDs. I want to validate the configmap and in some cases secrets as well in the webhook.
For Example
---
apiVersion: app.group.com/v1alpha1
kind: AppDB
metadata:
name: app-sample
namespace: ns1
spec:
name: app1
data:
configmap1: "data1:"
secret1: "secret1"
I can successfully validate the CRD contents in a webhook but I donno how do I validate the contents of configmap1 to make sure it is a valid configmap.
Is there any sample which I can refer to understand how do we handle K8s resources in webhook validation?