apiVersion : kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: query1
spec:
  rules:
    - name: Max one service of type LoadBalancer in namespace test
      match:
        resources:
          kinds:
          - Service
          namespaces: 
          - test
      query:
        query: "length([?spec.type=='LoadBalancer'])"
        expectedResult: "<=1"