Use OpenAPI when merging (3way) resources

- When merging (3way) resources use the patch strategy from the openAPI if the definition exists for the field
- Allow disabling of guessing patch strategy merge keys when no definition exists
- Support defining strategy and key directly on configuration fields through line and header coments
- Support attaching schema to parent fields of lists, and propagating -- e.g. that a field is a PodTemplate
This commit is contained in:
Phillip Wittrock
2020-02-27 10:08:40 -08:00
parent 8991b193c6
commit 5d1a0346b5
24 changed files with 991 additions and 507 deletions

View File

@@ -4,6 +4,7 @@
package walk
import (
"sigs.k8s.io/kustomize/kyaml/openapi"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
@@ -16,11 +17,11 @@ const (
// Visitor is invoked by walk with source and destination node pairs
type Visitor interface {
VisitMap(nodes Sources) (*yaml.RNode, error)
VisitMap(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)
VisitScalar(nodes Sources) (*yaml.RNode, error)
VisitScalar(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)
VisitList(nodes Sources, kind ListKind) (*yaml.RNode, error)
VisitList(Sources, *openapi.ResourceSchema, ListKind) (*yaml.RNode, error)
}
// ClearNode is returned if GrepFilter should do nothing after calling Set