mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 10:15:22 +00:00
This PR - defines a patch conflict detector interface, - extracts implementations of the interface from the merginator code, making the merginator code independent of --enable_kyaml. - injects those implementations into kustomize as a function of --enable_kyaml. So, instead of using different merginators to combine resmaps, this pr allows the use of a single patch merge code path that uses different conflict detectors. So instead of debating how to merge, we're now only considering whether to warn on conflict detection in one transformer. This PR is in service of #3304, eliminating seven instances where --enable_kyaml was consulted. These were cases where conflict detection wasn't an issue (but merging patches was).
24 lines
569 B
Go
24 lines
569 B
Go
// Copyright 2020 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package conflict
|
|
|
|
import (
|
|
"sigs.k8s.io/kustomize/api/resid"
|
|
"sigs.k8s.io/kustomize/api/resource"
|
|
)
|
|
|
|
type cdFactory struct{}
|
|
|
|
var _ resource.ConflictDetectorFactory = &cdFactory{}
|
|
|
|
// NewFactory returns a new conflict detector factory.
|
|
func NewFactory() resource.ConflictDetectorFactory {
|
|
return &cdFactory{}
|
|
}
|
|
|
|
// New returns an instance of smPatchMergeOnlyDetector.
|
|
func (c cdFactory) New(_ resid.Gvk) (resource.ConflictDetector, error) {
|
|
return &smPatchMergeOnlyDetector{}, nil
|
|
}
|