{"id":13798281,"url":"https://github.com/DevOpsHiveHQ/kustomize-plugin-merger","last_synced_at":"2025-05-13T05:32:02.027Z","repository":{"id":193603721,"uuid":"688675400","full_name":"DevOpsHiveHQ/kustomize-plugin-merger","owner":"DevOpsHiveHQ","description":"🔀 Merger 🔀 A Kustomize plugin generating manifests seamlessly by extending Kustomize merge strategies (schemaless StrategicMerge).","archived":false,"fork":false,"pushed_at":"2024-11-22T00:41:06.000Z","size":182,"stargazers_count":32,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-08T03:02:19.509Z","etag":null,"topics":["golang","krm","kubernetes","kustomize","kustomize-plugin","merge"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/DevOpsHiveHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-07T21:29:08.000Z","updated_at":"2024-12-17T13:14:14.000Z","dependencies_parsed_at":"2023-09-09T01:37:39.170Z","dependency_job_id":"cd5e79ac-de95-455d-ae90-c5c07d3fdef5","html_url":"https://github.com/DevOpsHiveHQ/kustomize-plugin-merger","commit_stats":null,"previous_names":["aabouzaid/kustomize-plugin-merger","devopshivecloud/kustomize-plugin-merger","devopshivehq/kustomize-plugin-merger"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevOpsHiveHQ%2Fkustomize-plugin-merger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevOpsHiveHQ%2Fkustomize-plugin-merger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevOpsHiveHQ%2Fkustomize-plugin-merger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevOpsHiveHQ%2Fkustomize-plugin-merger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevOpsHiveHQ","download_url":"https://codeload.github.com/DevOpsHiveHQ/kustomize-plugin-merger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253883121,"owners_count":21978611,"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":["golang","krm","kubernetes","kustomize","kustomize-plugin","merge"],"created_at":"2024-08-04T00:00:41.292Z","updated_at":"2025-05-13T05:32:00.230Z","avatar_url":"https://github.com/DevOpsHiveHQ.png","language":"Go","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/DevOpsHiveHQ/kustomize-plugin-merger\" style=\"display: block; padding: 1em 0;\"\u003e\n    \u003cimg width=\"128px\" alt=\"Kustomize Merger Logo\" border=\"0\" src=\"img/kustomize-merger-logo.svg\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1\u003eKustomize Merger\u003c/h1\u003e\n\u003cp\u003e\u003cb\u003e\n\nA Kustomize generator plugin to merge YAML files seamlessly for real-world use cases. Merger provides schemaless merge with different merge strategies (StrategicMerge).\n\n\u003c/b\u003e\u003c/p\u003e\n\n[![Awesome Kustomize](https://devopshive.net/badges/awesome-kustomize.svg)](https://github.com/DevOpsHiveHQ/awesome-kustomize)\n\n[![CI](https://img.shields.io/github/actions/workflow/status/aabouzaid/kustomize-plugin-merger/.github%2Fworkflows%2Fgo-ci.yml?logo=github\u0026label=CI\u0026color=31c653)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/actions/workflows/go-ci.yml?query=branch%3Amain)\n[![CodeQL](https://img.shields.io/github/actions/workflow/status/aabouzaid/kustomize-plugin-merger/.github%2Fworkflows%2Fgo-ci.yml?logo=github\u0026label=CodeQL\u0026color=31c653)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/actions/workflows/sec-codeql.yml?query=branch%3Amain)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/7815/badge)](https://www.bestpractices.dev/projects/7815)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/DevOpsHiveHQ/kustomize-plugin-merger/badge)](https://securityscorecards.dev/viewer/?uri=github.com/DevOpsHiveHQ/kustomize-plugin-merger)\n[![Go Report Card](https://goreportcard.com/badge/github.com/DevOpsHiveHQ/kustomize-plugin-merger)](https://goreportcard.com/report/github.com/DevOpsHiveHQ/kustomize-plugin-merger)\n[![codecov](https://codecov.io/github/aabouzaid/kustomize-plugin-merger/graph/badge.svg?token=BUFRT7BO2I)](https://codecov.io/github/aabouzaid/kustomize-plugin-merger)\n[![GitHub Release](https://img.shields.io/github/v/release/aabouzaid/kustomize-plugin-merger?logo=github)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/releases)\n[![Docker](https://img.shields.io/badge/Docker-available-blue?logo=docker\u0026logoColor=white)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/pkgs/container/kustomize-generator-merger)\n[![Go Reference](https://pkg.go.dev/badge/github.com/DevOpsHiveHQ/kustomize-plugin-merger.svg)](https://pkg.go.dev/github.com/DevOpsHiveHQ/kustomize-plugin-merger)\n[![Renovate](https://img.shields.io/badge/Renovate-enabled-blue?logo=renovatebot)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/issues/7)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/pulls)\n\n\u003c/div\u003e\n\n- [Why](#why)\n- [Features](#features)\n- [Options](#options)\n- [Examples](#examples)\n  - [1. Generate multiple manifests from a single base](#1-generate-multiple-manifests-from-a-single-base)\n  - [2. Merge non-manifest files and store them into ConfigMap or Secret](#2-merge-non-manifest-files-and-store-them-into-configmap-or-secret)\n  - [3. Merge lists in manifests without schema or a unique identifier](#3-merge-lists-in-manifests-without-schema-or-a-unique-identifier)\n  - [4. Organize long manifests into smaller ones](#4-organize-long-manifests-into-smaller-ones)\n- [TO-DO](#to-do)\n- [Project status](#project-status)\n- [Contributing](#contributing)\n- [License](#license)\n\n\n## Why\n\n**The main goal of the `Merger` plugin is to provide a more flexible way to merge YAML files\nand extend the strict merge capacities of Kustomize.**\n\nKustomize's default patch strategy for the lists (arrays) is `replace`, and to change that\nfor the Kubernetes `Custom Resource`, you must provide the OpenAPI schema of that custom resource,\nwhich is only helpful if the lists of that CR have a unique id.\n\nMany people are asking for such functionalities as [easy merging CRs](https://stackoverflow.com/q/73655002/4547221),\n[creating a ConfigMap from arbitrary YAML files](https://stackoverflow.com/q/74547569/4547221),\nand for more details on the challenge of providing OpenAPI schema to merge files, please read the following post:\n[Set OpenAPI patch strategy for Kubernetes Custom Resources](https://tech.aabouzaid.com/2022/11/set-openapi-patch-strategy-for-kubernetes-custom-resources-kustomize.html).\n\n\n## Features\n\n- Generate multiple resources/manifests from a single base without copying the resources multiple times.\n- Merge any manifests (even CustomResources) without needing their OpenAPI schema.\n- Merge applications configuration YAML files into a ConfigMap or Secret.\n- Merge manifests with a list of maps without a unique identifier\n  (when using `x-kubernetes-patch-merge-key` is not possible).\n- Merge YAML files with different merge strategies (StrategicMerge).\n\n\n## Options\n\n```yaml\n---\napiVersion: generators.kustomize.devopshive.net/v1alpha1\nkind: Merger\nmetadata:\n  name: merge\n  annotations:\n    # Containerized KRM function.\n    config.kubernetes.io/function: |\n      container:\n        image: ghcr.io/devopshivehq/kustomize-generator-merger\n        mounts:\n        - type: bind\n          src: ./\n          dst: /mnt\n    # Exec KRM functions.\n    # config.kubernetes.io/function: |\n    #   exec:\n    #     path: kustomize-plugin-merger\nspec:\n  resources:\n  - name: example\n    input:\n      # Available options: overlay,patch.\n      # - Overlay: Produce multiple outputs by merging each source with the destination.\n      # - Patch: Produce a single output by merging all sources together then with the destination.\n      method: overlay\n      files:\n        # The same as in the KRM container above, omit it if Exec KRM is used.\n        root: /mnt\n        sources:\n        - src01.yaml\n        - src02.yaml\n        destination: dst.yaml\n    merge:\n      # Available options: replace,append,combine.\n      # - Replace: All keys in source will merge and replace what's in the destination.\n      # - Append: Maps from source merged with destination, but the lists will be appended from source to destination.\n      # - Combine: Maps from source merged with destination, but the lists will be combined together.\n      strategy: combine\n    output:\n      # Available options: raw,configmap,secret\n      format: raw\n```\n\n\n## Examples\n\nThis section shows a couple of use cases where Merger can help.\n\n### 1. Generate multiple manifests from a single base\n\nIn this case, you have multiple `CronJobs`, all of which share the same body,\nbut each has a different command or other config.\n\n[Read the full example](./examples/multiple-manifests-from-single-file/README.md).\n\n### 2. Merge non-manifest files and store them into ConfigMap or Secret\n\nNo plans from Kustomize to support non-manifest files merge and storing them into ConfigMap\nor Secret. Using Merger you can merge any YAML files like application configuration.\n\n[Read the full example](./examples/non-manifest-into-configmap-or-secret/README.md).\n\n### 3. Merge lists in manifests without schema or a unique identifier\n\nCurrently, in Kustomize, it's not possible to merge resources without a unique identifier, even with Open API schema.\n\nIt's possible to do that using the merge strategy `append` in Merger (later on, `combineWithKey` will also be supported).\n\n[Read the full example](./examples/manifest-lists-without-schema/README.md).\n\n### 4. Organize long manifests into smaller ones\n\nIn some use cases (e.g., [Crossplane Compositions](https://docs.crossplane.io/latest/concepts/compositions/)),\nyou could have a really long YAML manifest, and it's hard to read. You can split that file\nand use the Merger `patch` input method to make it a single manifest again.\n\n[Read the full example](./examples/long-omni-manifest/README.md).\n\n\n## TO-DO\n\n- Support `combine` merge strategy with an identifier key (similar to `x-kubernetes-patch-merge-key`).\n- Configure the output indentation.\n- Provide better docs for Merger options.\n\n\n## Project status\n\nPlease note that this project is still under development and could have breaking changes,\nbut it will follow the SemVer convention.\n\n\n## Contributing\n\nAll feedback and contributions are welcome. If you find any issues or want to contribute,\nplease feel free to [fill an issue](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/issues)\nor [create a PR](https://github.com/DevOpsHiveHQ/kustomize-plugin-merger/pulls).\n\n\n## License\n\nMerger is an open-source software licensed using the Apache License 2.0. Please see [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Generators"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDevOpsHiveHQ%2Fkustomize-plugin-merger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDevOpsHiveHQ%2Fkustomize-plugin-merger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDevOpsHiveHQ%2Fkustomize-plugin-merger/lists"}