apiVersion: v1
policies:
  - name: governance_best_practices
    isDefault: true
    rules:
      - identifier: CUSTOM_INGRESS_INCORRECT_HOST_VALUE
        messageOnFailure: ""

customRules:
  - identifier: CUSTOM_INGRESS_INCORRECT_HOST_VALUE
    name: Ensure Ingress only uses approved domain names for hostnames [CUSTOM RULE]
    defaultMessageOnFailure: host value should contain a valid organization name (*.example.com)
    schema:
      if:
        properties:
          kind:
            type: string
            enum:
              - Ingress
      then:
        properties:
          spec:
            properties:
              rules:
                items:
                  properties:
                    host:
                      type: string
                      pattern: (.*example.com)$
                  required:
                    - host