{"id":27951213,"url":"https://github.com/mirantis/rekustomize","last_synced_at":"2025-05-07T16:16:49.077Z","repository":{"id":283628695,"uuid":"856400329","full_name":"Mirantis/rekustomize","owner":"Mirantis","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-04T23:21:34.000Z","size":356,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T16:16:39.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mirantis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-12T14:14:46.000Z","updated_at":"2025-05-04T23:21:38.000Z","dependencies_parsed_at":"2025-03-21T08:46:27.639Z","dependency_job_id":"9d839549-1318-47ab-b9c0-7f781810bd6f","html_url":"https://github.com/Mirantis/rekustomize","commit_stats":null,"previous_names":["mirantis/rekustomize"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mirantis%2Frekustomize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mirantis%2Frekustomize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mirantis%2Frekustomize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mirantis%2Frekustomize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mirantis","download_url":"https://codeload.github.com/Mirantis/rekustomize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912937,"owners_count":21824068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-05-07T16:16:43.984Z","updated_at":"2025-05-07T16:16:49.059Z","avatar_url":"https://github.com/Mirantis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rekustomize (Technical Preview / Aplha)\n\n`rekustomize` lets you generate\n[`kustomize`](https://github.com/kubernetes-sigs/kustomize) manifests. With\n`rekustomize` you can:\n\n- [x] **Export** resource manifests from live cluster using supported formats:\n  - [x] **kustomize components**\n    ([example](examples/export-components/rekustomization.yaml))\n  - [x] **helm charts** ([example](examples/export-helm/rekustomization.yaml))\n- [x] **Filter** exported resources or attributes based on customizable rules\n  ([example](examples/export-simple-filtered/rekustomization.yaml))\n- [x] **Deduplicate** manifests to ensure\n  [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) principle\n- [ ] **Re-format** existing manifests to follow customizable styles and to\n  optimize duplicated manifests\n- [ ] **Convert** existing manifests between formats, e.g. from **helm chart**\n  to **kustomize components**\n\n## Deduplication of resources and attributes\n\n`rekustomize` truly shines when it's used to generate manifests for multiple\nclusters at once. It will group correlad resources together and will also\nefficiently handle multiple versions of the same resource.\n\n### Helm template\n\nThis [template](examples/export-helm/charts/simple-app/templates/simple-app-deployment.yaml)\nshows how `rekustomize` can handle multiple versions of the same resource:\n\n```\nspec:\n  {{- if index .Values.global \"simple-app/Deployment/simple-app.spec.replicas\" }}\n  replicas: {{ index .Values.global \"simple-app/Deployment/simple-app.spec.replicas\" }}\n  {{- end }} # simple-app/Deployment/simple-app.spec.replicas\n  template:\n    spec:\n      containers:\n      - image: {{ index .Values.global \"simple-app/Deployment/simple-app.spec.template.spec.containers.[name=simple-app].image\" }}\n        name: simple-app\n```\n\n[values.yaml](examples/export-helm/charts/simple-app/values.yaml)\ndefines presets to group values from different resources:\n\n```\npreset_values:\n  prod:\n    simple-app/ConfigMap/simple-app-env.data.ENV_VAR2: prod-value\n    simple-app/Deployment/simple-app.spec.replicas: 5\n  prod_test:\n    simple-app/Deployment/simple-app.spec.template.spec.containers.[name=simple-app].image: example.com/simple-app:v1.2.345\n  test:\n    simple-app/ConfigMap/simple-app-env.data.ENV_VAR2: test-value\n    simple-app/Deployment/simple-app.spec.replicas: 3\n```\n\nThe generated **presets** are then assigned to each corresponding cluster:\n- [test-cluster-a](examples/export-helm/overlays/test-cluster-a/kustomization.yaml):\n\n```\n  valuesInline:\n    presets:\n    - prod_test\n    - test\n```\n\n- [prod-cluster-b](examples/export-helm/overlays/prod-cluster-b/kustomization.yaml):\n\n```\n  valuesInline:\n    presets:\n    - prod\n    - prod_test\n```\n\nValues, that are unique to a cluster are also supported:\n- [prod-cluster-a](examples/export-helm/overlays/prod-cluster-a/kustomization.yaml):\n```\n  valuesInline:\n    global:\n      simple-app/ConfigMap/simple-app-env.data.ENV_VAR3: prod-cluster-a-value\n```\n\n### Kustomize components\n\nIf you use **kustomize components** format, similar overrides will be generated\nas strategic-merge patches:\n\n- [components/prod](examples/export-components/components/prod/simple-app/simple-app-deployment.yaml):\n\n```\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: simple-app\n  namespace: simple-app\nspec:\n  replicas: 5\n```\n\n- [components/test](examples/export-components/components/test/simple-app/simple-app-deployment.yaml):\n\n```\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: simple-app\n  namespace: simple-app\nspec:\n  replicas: 3\n```\n\n- [components/prod_test](examples/export-components/components/prod_test/simple-app/simple-app-deployment.yaml)\n\n```\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: simple-app\n  namespace: simple-app\nspec:\n  template:\n    spec:\n      containers:\n      - name: simple-app\n        image: example.com/simple-app:v1.2.345\n```\n\n## `rekustomization.yaml`\n\nTo start using `rekustomize`, create a new folder with a `rekustomization.yaml`\nfile where you can configure `rekustomize` behavior. Here's a breakdown of the\n**helm chart** [example](examples/export-helm/rekustomization.yaml):\n\n### Cluster selector\n\nBy default `rekustomize` will use clusters defined in your `KUBECONFIG` file.\nYou can select clusters using shell-like patterns:\n\n```\nclusters:\n- names: dev-* # shell-like pattern\n  tags: dev\n- names: test-cluster-a,test-cluster-* # comma-separated list\n  tags: test\n- names: # yaml list\n  - prod-cluster-a\n  - prod-cluster-*\n  tags: prod\n```\n\nIn the future versions `rekustomize` will be able to use cluster metadata/labels\nfrom external sources, such as **ClusterAPI**, **k0rdent**, **ArgoCD** or\n**Flux**.\n\n### Resource selector\n\nBy default, `rekustomize` will generate manifests for all resources from all\nnamespaces, excluding a [pre-defined](pkg/cmd/defaults.yaml) list of dynamic\nresources, like `pods` or `events`. You can customize that behavior in the\n`export` section:\n\n```\nexport:\n- namespaces: simple-app\n  labelSelectors: ['!generated-by']\n  apiResources:\n    exclude: jobs.batch\n- apiResources: namespaces\n  names: simple-app\n```\n\n### Resource attribute cleanup\n\nIf your live cluster resources contain attributes that you don't want to be\nincluded in the generated manifests, you can use `SkipFilter` to remove such\nunwanted attributes or values. The following example will remove any\n`'example.com/generated'` annotations and `'dev.example.com/info'` annotations\nwith the value of `'flaky-tests'`:\n\n```\nfilters:\n- kind: SkipFilter\n  fields:\n  - metadata.annotations.example\\.com/generated\n  - metadata.annotations.dev\\.example\\.com/info[=flaky-tests]\n```\n\n### Resource filters\n\nYou can also use `SkipFilter` to exclude entire resources from the generated\nmanifests - to further refine [resource selection](#resource-selector):\n\n```\nfilters:\n- kind: SkipFilter\n  resources:\n  - kind: CronJob\n    name: infra-canary\n```\n\n### Chart metadata\n\nThis section defines metadata for the generated chart:\n\n```\nhelmChart:\n  name: simple-app\n  version: v1.0\n```\n\nIf no `helmChart` is specified, `rekustomize` will generate manifests in **kustomize components** format\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirantis%2Frekustomize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirantis%2Frekustomize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirantis%2Frekustomize/lists"}