{"id":37092508,"url":"https://github.com/vmware-archive/crd-migration-tool","last_synced_at":"2026-01-14T11:15:34.534Z","repository":{"id":64304994,"uuid":"170880125","full_name":"vmware-archive/crd-migration-tool","owner":"vmware-archive","description":"A tool to help you migrate Kubernetes CustomResourceDefinition data across API groups and namespaces","archived":true,"fork":false,"pushed_at":"2022-01-18T12:59:46.000Z","size":4385,"stargazers_count":46,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-19T00:03:51.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmware-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-15T14:46:51.000Z","updated_at":"2023-01-28T03:57:34.000Z","dependencies_parsed_at":"2023-01-15T10:30:53.967Z","dependency_job_id":null,"html_url":"https://github.com/vmware-archive/crd-migration-tool","commit_stats":null,"previous_names":["vmware/crd-migration-tool"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vmware-archive/crd-migration-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fcrd-migration-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fcrd-migration-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fcrd-migration-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fcrd-migration-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmware-archive","download_url":"https://codeload.github.com/vmware-archive/crd-migration-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fcrd-migration-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28418057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T11:15:33.716Z","updated_at":"2026-01-14T11:15:34.526Z","avatar_url":"https://github.com/vmware-archive.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"#VMware has ended active development of this project, this repository will no longer be updated\n\n# Kubernetes CustomResourceDefinition Migration Tool\n\n[![Build Status](https://travis-ci.org/vmware/crd-migration-tool.svg?branch=master)](https://travis-ci.org/vmware/crd-migration-tool)\n\n## Overview\n\nThis tool migrates Kubernetes CustomResourceDefinition (CRD) instances from an \"old\" API group to a\n\"new\" one.\n\n## Getting Started\n\n1. Go to the [latest release](https://github.com/vmware/crd-migration-tool/releases) and download the tarball for your platform.\n\n1. Extract the tarball locally. For example: \n    \n    ```shell\n    tar -xzf crd-migration-tool-v1.0.0-linux-amd64.tar.gz\n    ```\n\n1. Move the `crd-migrator` binary to somewhere within your $PATH. For example:\n    \n    ```shell\n    mv crd-migrator /usr/local/bin\n    ```\n\n## Usage\n\n#### Requirements\n\n- The same CRDs exist in both API groups\n- The CRDs in the new API group do not have `spec.subresources.status` (more details on this below)\n- Your user has RBAC permissions to get `customresourcedefinitions.apiextensions.k8s.io`\n- Your user has RBAC permissions to get instances of all the CRDs in the old API group\n- Your user has RBAC permissions to get and create instances of all the CRDs in the new API group\n- If you are using namespace remapping, the target namespace(s) already exist\n\n#### Example Scenario\n\nYou have an API group called `my.example.com` with CRDs `foos` and `bars`. You want to \"rename\"\n`my.example.com` to `someapp.io`.\n\nBecause you can't rename objects in Kubernetes, including `customresourcedefinitions`, we instead\nessentially have to \"copy and paste\" each CRD instance from the old API group to the new one. We do\nthis by retrieving each instance of a CRD, changing its `apiVersion` from the old API group to the\nnew one, then creating the new instance under the new API group.\n\nGiven the following custom resource `Foo` and `Bar` instances:\n\n```yaml\napiVersion: my.example.com/v1\nkind: Foo\nmetadata:\n  namespace: my-example\n  name: foo1\n  labels:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\n  annotations:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n---\napiVersion: my.example.com/v1\nkind: Foo\nmetadata:\n  namespace: another-namespace\n  name: foo2\n  labels:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\n  annotations:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n---\napiVersion: my.example.com/v1\nkind: Bar\nmetadata:\n  namespace: my-example\n  name: bar1\n  labels:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\n  annotations:\n    my.example.com/color: blue\n    some.other.label: abcd\n    sub.my.example.com/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n```\n\nWhen you run the tool:\n\n```bash\ncrd-migrator --from my.example.com/v1                         \\\n             --to someapp.io/v1                               \\\n             --namespace-mappings my-example:someapp          \\\n             --annotation-mappings my-example.com:someapp.io  \\\n             --label-mappings my-example.com:someapp.io\nINFO[0000] Starting resource migration                   resource=foos\nINFO[0000] Checking if item already exists in new API group  id=someapp/foo1 original-namespace=my-example resource=foos\nINFO[0000] Creating item                                 id=someapp/foo1 original-namespace=my-example resource=foos\nINFO[0000] Checking if item already exists in new API group  id=another-namespace/foo2 resource=foos\nINFO[0000] Creating item                                 id=another-namespace/foo2 resource=foos\nINFO[0000] Completed resource migration                  resource=foos\nINFO[0000] Starting resource migration                   resource=bars\nINFO[0000] Checking if item already exists in new API group  id=someapp/bar1 original-namespace=my-example resource=bars\nINFO[0000] Creating item                                 id=someapp/bar1 original-namespace=my-example resource=bars\nINFO[0000] Completed resource migration                  resource=bars\n```\n\nThe result looks like this:\n\n```yaml\napiVersion: someapp.io/v1\nkind: Foo\nmetadata:\n  namespace: someapp\n  name: foo1\n  labels:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\n  annotations:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n---\napiVersion: someapp.io/v1\nkind: Foo\nmetadata:\n  namespace: another-namespace\n  name: foo2\n  labels:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\n  annotations:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n---\napiVersion: someapp.io/v1\nkind: Bar\nmetadata:\n  namespace: someapp\n  name: bar1\n  labels:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\n  annotations:\n    someapp.io/color: blue\n    some.other.label: abcd\n    sub.someapp.io/shape: circle\nspec:\n  someSpecHere: {}\nstatus:\n  someStatusHere: {}\n```\n\nThe following changes are worth noting:\n\n- The `apiVersion` was changed from `my.example.com/v1` to `someapp.io/v1`\n- All `Foo` and `Bar` instances in the `my-example` namespace were created in the `someapp` namespace\n- All label and annotation keys that referenced `my.example.com` were updated to `someapp.io`\n\n#### CRDs \u0026 the status subresource\n\nNon-CRD API types in Kubernetes typically have a distinction between `status` and non-`status`\nsections. When you create one of these (such as a `Pod` or `Secret`), Kubernetes usually discards\nany `status` details and instead sets these based on whatever logic is appropriate for that type\n(it's important to note that this behavior varies by type). Similarly, when updating an item,\nupdates to `status` are discarded and the current `status` is preserved. If you want to modify the\n`status`, you need to use a special `/status` subresource (and when you use this, any changes\noutside of `status` are ignored). Typically system controllers are allowed to update `status` data,\nbut normal users are not.\n\nKubernetes optionally supports these same `status` and non-`status` distinctions and separations for\nCRD instances. This is currently controlled by the `CustomResourceSubresources` feature gate, which\nis alpha and disabled by default in Kubernetes v1.10 and is beta and enabled by default in\nKubernetes v1.11 and newer.\n\nWhen the `CustomResourceSubresources` feature is enabled, this doesn't mean that all CRD instances\nadopt the `status`/non-`status` behaviors. Instead, each CRD must [opt in to gain this\nfunctionality](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#subresources).\n\n**HOWEVER**: you *must* remove the `spec.subresources.status` entry from your CRDs before you can\nmigrate your CRD instances to the new API group. This will allow the tool to migrate each item's\n`status` data. Otherwise, it would be lost, and that could lead to undesirable behavior (depending\non the CRD type and any logic associated with it).\n\nYou can temporarily remove `spec.subresources.status` from each CRD in the new API group, run the\nmigration tool, and finally restore `spec.subresources.status` when you have finished migrating.\n\n#### Data in the old API group\n\nThis tool does not delete any data in the old API group. If you want to do that, you can use\n`kubectl`, such as:\n\n```bash\nkubectl delete foos.my.example.com --namespace my-example --all\n```\n\nUnfortunately, this must be done per-namespace. If there is a need, we can consider adding support\nto this tool to delete items across all namespaces from the old API group.\n\n## Building From Source\n\n#### Prerequisites\n\n- [Go](https://golang.org/doc/install) installed\n\n#### Instructions\n\n1. Clone this repository to your computer\n\n1. Change your working directory to the root directory of the project\n\n1. Build the binary:\n    ```shell\n    go build ./cmd/crd-migrator\n    ```\n\nYou now have an executable binary, `crd-migrator`, in your working directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmware-archive%2Fcrd-migration-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmware-archive%2Fcrd-migration-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmware-archive%2Fcrd-migration-tool/lists"}