# Mongodb percona operator CRD kustomize incorrectly merging yamls with patchesStrategicMerge

**URL:** <https://forums.percona.com/t/mongodb-percona-operator-crd-kustomize-incorrectly-merging-yamls-with-patchesstrategicmerge/18136>\
**Category:** Percona Operator for MongoDB\
**Created:** [October 21, 2022, 3:45pm UTC](https://forums.percona.com/t/mongodb-percona-operator-crd-kustomize-incorrectly-merging-yamls-with-patchesstrategicmerge/18136 "2022-10-21T15:45:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Recalde](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/alejandro_recalde/32/7241_2.png) [@Alejandro\_Recalde](https://forums.percona.com/u/Alejandro_Recalde)\
**Post date:** [October 21, 2022, 3:45pm UTC](https://forums.percona.com/t/mongodb-percona-operator-crd-kustomize-incorrectly-merging-yamls-with-patchesstrategicmerge/18136/1 "2022-10-21T15:45:54Z")

</div>

**Details** :  
Operator Version 1.13.0 (Deployed with kubectl apply)

Kustomize strategic merge patch omit properties when applied over percona mongofb operator CRD.

For example **base/percona-mongo** :

```auto
apiVersion: psmdb.percona.com/v1
kind: PerconaServerMongoDB
metadata:
  name: db-platform-mongo
spec:
replsets:
    - name: rs0
      size: 1
      affinity:
        antiAffinityTopologyKey: "kubernetes.io/hostname"
      volumeSpec:
        persistentVolumeClaim:
          storageClassName: standard

```

**overlay/qa/percona-mongo** :

```auto
apiVersion: psmdb.percona.com/v1
kind: PerconaServerMongoDB
metadata:
  name: db-platform-mongo
spec:
  replsets:
    - name: rs0
      size: 1
      volumeSpec:
        persistentVolumeClaim:
          storageClassName: rook-cephfs-replica-3

```

kustomization result misses:

```auto
      affinity:
        antiAffinityTopologyKey: "kubernetes.io/hostname"

```

It seems to be caused by kustomize not knowing which openapi schema the operator CRD follows, as described in this article: [https://blog.argoproj.io/argo-crds-and-kustomize-the-problem-of-patching-lists-5cfc43da288c](https://blog.argoproj.io/argo-crds-and-kustomize-the-problem-of-patching-lists-5cfc43da288c).

In this [forum post](https://forums.percona.com/t/updating-to-1-12-0-fails-to-reconcile-in-flux/15598/2) I found a reference to a migration to openapi schema. Would you mind providing me a url to that resource? So I can apply it in a kustomization file like this:

```auto
...
openapi:
  path: https://github.com/argoproj/argo-schema-generator/raw/main/schema/argo_all_k8s_kustomize_schema.json

```

---

<div class="post-metadata">

**Author:** ![Ege\_Gunes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ege_gunes/32/4595_2.png) [@Ege\_Gunes](https://forums.percona.com/u/Ege_Gunes)\
**Post date:** [October 26, 2022, 7:32pm UTC](https://forums.percona.com/t/mongodb-percona-operator-crd-kustomize-incorrectly-merging-yamls-with-patchesstrategicmerge/18136/2 "2022-10-26T19:32:43Z")

</div>

Hi @Alejandro_Recalde,

We generate the OpenAPI schema and include it into our CRD but the blog post you linked explains the need of exporting the schema as json. Currently there’s no URL to provide, unfortunately. I created [[K8SPSMDB-805] Generate OpenAPI schema separately as json - Percona JIRA](https://jira.percona.com/browse/K8SPSMDB-805) to understand the problem and provide the schema if needed.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Recalde](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/alejandro_recalde/32/7241_2.png) [@Alejandro\_Recalde](https://forums.percona.com/u/Alejandro_Recalde)\
**Post date:** [November 2, 2022, 8:23pm UTC](https://forums.percona.com/t/mongodb-percona-operator-crd-kustomize-incorrectly-merging-yamls-with-patchesstrategicmerge/18136/3 "2022-11-02T20:23:05Z")

</div>

Thanks @Ege_Gunes,

As a workaround we decided to use kustomize patchesJson6902 as it is only the storage class that varies between environments. However applying patchesStrategicMerge would prove very convenient when other customizations per environment might be required
