apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: application-field-validation annotations: policies.kyverno.io/title: Application Field Validation policies.kyverno.io/category: Argo policies.kyverno.io/severity: medium policies.kyverno.io/subject: Application kyverno.io/kyverno-version: 1.6.0 policies.kyverno.io/minversion: 1.6.0 kyverno.io/kubernetes-version: "1.23" policies.kyverno.io/description: >- This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both. spec: validationFailureAction: audit failurePolicy: Ignore background: false rules: - name: source-path-chart match: any: - resources: kinds: - Application validate: message: >- `spec.source.path` OR `spec.source.chart` should be specified but never both. anyPattern: - spec: source: path: '?*' X(chart): - spec: source: X(path): chart: '?*' - name: destination-server-name match: any: - resources: kinds: - Application validate: message: >- `spec.destination.server` OR `spec.destination.name` should be specified but never both. anyPattern: - spec: destination: server: '?*' X(name): - spec: destination: X(server): name: '?*'