# Unable to replace the crd perconaservermongodbs.psmdb.percona.com on v1.17.0

**URL:** <https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862>\
**Category:** Percona Operator for MongoDB\
**Tags:** psmdb-operator\
**Created:** [November 7, 2024, 8:54pm UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862 "2024-11-07T20:54:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![raj28](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@raj28](https://forums.percona.com/u/raj28)\
**Post date:** [November 7, 2024, 8:54pm UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/1 "2024-11-07T20:54:42Z")

</div>

## Description:

We upgraded the mongodb from version 6 to 7 and I’m unable to apply the crd [perconaservermongodbs.psmdb.percona.com](http://perconaservermongodbs.psmdb.percona.com) from tag v.1.17.0

## Steps to Reproduce:

```auto
k replace -f psmdb.percona.com_perconaservermongodbs.yaml
The CustomResourceDefinition "perconaservermongodbs.psmdb.percona.com" is invalid: status.storedVersions[0]: Invalid value: "v1-12-0": must appear in spec.versions

```

## Version:

1.17.0

---

<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:** [November 8, 2024, 9:00am UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/2 "2024-11-08T09:00:19Z")

</div>

Hi @raj28, could you please try with `kubectl apply` rather than `kubectl replace`?

You probably will need to add `--server-side` flag too, so command will look like:

```auto
kubectl apply --server-side -f psmdb.percona.com_perconaservermongodbs.yaml

```

---

<div class="post-metadata">

**Author:** ![raj28](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@raj28](https://forums.percona.com/u/raj28)\
**Post date:** [November 8, 2024, 4:44pm UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/3 "2024-11-08T16:44:53Z")

</div>

> [@Ege\_Gunes](#):
>
> `kubectl apply --server-side -f psmdb.percona.com_perconaservermongodbs.yaml`

@Ege_Gunes Same error.

```auto
kubectl apply --server-side -f psmdb.percona.com_perconaservermongodbs.yaml
The CustomResourceDefinition "perconaservermongodbs.psmdb.percona.com" is invalid: status.storedVersions[0]: Invalid value: "v1-12-0": must appear in spec.versions

```

---

<div class="post-metadata">

**Author:** ![raj28](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@raj28](https://forums.percona.com/u/raj28)\
**Post date:** [November 11, 2024, 8:06pm UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/4 "2024-11-11T20:06:02Z")

</div>

@Ege_Gunes Any ideas on how I can resolve this ?

---

<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:** [November 12, 2024, 10:19am UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/5 "2024-11-12T10:19:30Z")

</div>

Hi @raj28, normally this shouldn’t happen because we didn’t remove `v1-12-0` from our CRD in v1.17.0. Could you please send me the `status` section from this command’s output?

```auto
kubectl get crd perconaservermongodbs.psmdb.percona.com -o yaml

```

---

<div class="post-metadata">

**Author:** ![raj28](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@raj28](https://forums.percona.com/u/raj28)\
**Post date:** [November 12, 2024, 4:19pm UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/6 "2024-11-12T16:19:36Z")

</div>

@Ege_Gunes Please find the attached. I changed the extension from yaml to txt for attachment.  
[perconaservermongodbs.psmdb.percona.com.txt](https://forums.percona.com/uploads/short-url/t97WCF8nXhbL9Z50dKWZGN2AeSD.txt) (771.0 KB)

```auto
status:
  acceptedNames:
    kind: PerconaServerMongoDB
    listKind: PerconaServerMongoDBList
    plural: perconaservermongodbs
    shortNames:
    - psmdb
    singular: perconaservermongodb
  conditions:
  - lastTransitionTime: "2022-05-20T17:59:24Z"
    message: no conflicts found
    reason: NoConflicts
    status: "True"
    type: NamesAccepted
  - lastTransitionTime: "2022-05-20T17:59:25Z"
    message: the initial names have been accepted
    reason: InitialNamesAccepted
    status: "True"
    type: Established
  storedVersions:
  - v1-12-0
  - v1

```

---

<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:** [November 13, 2024, 9:29am UTC](https://forums.percona.com/t/unable-to-replace-the-crd-perconaservermongodbs-psmdb-percona-com-on-v1-17-0/34862/7 "2024-11-13T09:29:44Z")

</div>

@raj28 you can fix the issue by running the following commands:

```auto
$ kubectl proxy & 
$ curl \
	--header "Content-Type: application/json-patch+json" \
	--request PATCH \
	--data '[{"op": "replace", "path": "/status/storedVersions", "value":["v1"]}]' \	http://localhost:8001/apis/apiextensions.k8s.io/v1/customresourcedefinitions/perconaservermongodbs.psmdb.percona.com/status

```

this will remove `v1-12-0` from your CRD status. but, again, it’s strange that you have this problem since we still have [v1-12-0](https://github.com/percona/percona-server-mongodb-operator/blob/v1.17.0/deploy/crd.yaml#L677) in v1.17.0 CRD.
