---
## needs to be patched because of an issue with required properties in order to be able to deploy on k8s 1.18+
## https://github.com/kedacore/keda/issues/927
- op: add
  path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/jobTargetRef/properties/template/properties/spec/properties/containers/items/properties/ports/items/required/-
  value: protocol

- op: add
  path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/jobTargetRef/properties/template/properties/spec/properties/ephemeralContainers/items/properties/ports/items/required/-
  value: protocol

- op: add
  path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/jobTargetRef/properties/template/properties/spec/properties/initContainers/items/properties/ports/items/required/-
  value: protocol

## needs to be patched because of an issue with controller-gen, which is not including anything in metadata from nested contructs
## https://github.com/kedacore/keda/issues/1311
- op: add
  path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/jobTargetRef/properties/template/properties/metadata/x-kubernetes-preserve-unknown-fields
  value: true

## triggers are shared by ScaledObjects and ScaledJobs and therefore generated for both, including all properties.
## since the metricType property is only supported for ScaledObject, removing it from the generated ScaledJob CRD
- op: remove
  path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/triggers/items/properties/metricType
