mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 18:30:15 +00:00
Further isolate unstructured with factories.
This commit is contained in:
@@ -18,18 +18,22 @@ package transformers
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
)
|
||||
|
||||
func TestImageTagTransformer(t *testing.T) {
|
||||
var rf = resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -60,7 +64,7 @@ func TestImageTagTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(gvk.Gvk{Kind: "randomKind"}, "random"): resource.NewFromMap(
|
||||
resid.NewResId(gvk.Gvk{Kind: "randomKind"}, "random"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"template": map[string]interface{}{
|
||||
@@ -97,7 +101,7 @@ func TestImageTagTransformer(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -128,7 +132,7 @@ func TestImageTagTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(gvk.Gvk{Kind: "randomKind"}, "random"): resource.NewFromMap(
|
||||
resid.NewResId(gvk.Gvk{Kind: "randomKind"}, "random"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"template": map[string]interface{}{
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
@@ -41,10 +42,12 @@ var pvc = gvk.Gvk{Version: "v1", Kind: "PersistentVolumeClaim"}
|
||||
var crb = gvk.Gvk{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRoleBinding"}
|
||||
var sa = gvk.Gvk{Version: "v1", Kind: "ServiceAccount"}
|
||||
var ingress = gvk.Gvk{Kind: "Ingress"}
|
||||
var rf = resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
|
||||
func TestLabelsRun(t *testing.T) {
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -52,7 +55,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -78,7 +81,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
@@ -94,7 +97,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(job, "job1"): resource.NewFromMap(
|
||||
resid.NewResId(job, "job1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
@@ -114,7 +117,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(job, "job2"): resource.NewFromMap(
|
||||
resid.NewResId(job, "job2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
@@ -139,7 +142,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cronjob, "cronjob1"): resource.NewFromMap(
|
||||
resid.NewResId(cronjob, "cronjob1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1beta1",
|
||||
"kind": "CronJob",
|
||||
@@ -164,7 +167,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cronjob, "cronjob2"): resource.NewFromMap(
|
||||
resid.NewResId(cronjob, "cronjob2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1beta1",
|
||||
"kind": "CronJob",
|
||||
@@ -196,7 +199,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -208,7 +211,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -246,7 +249,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
@@ -270,7 +273,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(job, "job1"): resource.NewFromMap(
|
||||
resid.NewResId(job, "job1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
@@ -300,7 +303,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(job, "job2"): resource.NewFromMap(
|
||||
resid.NewResId(job, "job2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
@@ -337,7 +340,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cronjob, "cronjob1"): resource.NewFromMap(
|
||||
resid.NewResId(cronjob, "cronjob1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1beta1",
|
||||
"kind": "CronJob",
|
||||
@@ -372,7 +375,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cronjob, "cronjob2"): resource.NewFromMap(
|
||||
resid.NewResId(cronjob, "cronjob2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "batch/v1beta1",
|
||||
"kind": "CronJob",
|
||||
@@ -433,7 +436,7 @@ func TestLabelsRun(t *testing.T) {
|
||||
|
||||
func TestAnnotationsRun(t *testing.T) {
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -441,7 +444,7 @@ func TestAnnotationsRun(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -467,7 +470,7 @@ func TestAnnotationsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
@@ -485,7 +488,7 @@ func TestAnnotationsRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -497,7 +500,7 @@ func TestAnnotationsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -531,7 +534,7 @@ func TestAnnotationsRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
|
||||
@@ -18,6 +18,7 @@ package transformers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
)
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
type multiTransformer struct {
|
||||
transformers []Transformer
|
||||
checkConflictEnabled bool
|
||||
rf *resource.Factory
|
||||
}
|
||||
|
||||
var _ Transformer = &multiTransformer{}
|
||||
@@ -69,7 +71,7 @@ func (o *multiTransformer) transform(m resmap.ResMap) error {
|
||||
// A spot check to perform when the transformations are supposed to be commutative.
|
||||
// Fail if there's a difference in the result.
|
||||
func (o *multiTransformer) transformWithCheckConflict(m resmap.ResMap) error {
|
||||
mcopy := m.DeepCopy()
|
||||
mcopy := m.DeepCopy(o.rf)
|
||||
err := o.transform(m)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -28,8 +28,10 @@ import (
|
||||
)
|
||||
|
||||
func TestNameHashTransformer(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
objs := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -37,7 +39,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -63,7 +65,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
@@ -79,7 +81,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(secret, "secret1"): resource.NewFromMap(
|
||||
resid.NewResId(secret, "secret1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
@@ -90,7 +92,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
}
|
||||
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -98,7 +100,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -124,7 +126,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(service, "svc1"): resource.NewFromMap(
|
||||
resid.NewResId(service, "svc1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
@@ -140,7 +142,7 @@ func TestNameHashTransformer(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(secret, "secret1"): resource.NewFromMap(
|
||||
resid.NewResId(secret, "secret1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
@@ -27,8 +28,10 @@ import (
|
||||
)
|
||||
|
||||
func TestNameReferenceRun(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -36,7 +39,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
"name": "someprefix-cm1-somehash",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cmap, "cm2"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -44,7 +47,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
"name": "someprefix-cm2-somehash",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(secret, "secret1"): resource.NewFromMap(
|
||||
resid.NewResId(secret, "secret1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
@@ -52,7 +55,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
"name": "someprefix-secret1-somehash",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(pvc, "claim1"): resource.NewFromMap(
|
||||
resid.NewResId(pvc, "claim1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "PersistentVolumeClaim",
|
||||
@@ -60,7 +63,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
"name": "someprefix-claim1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(ingress, "ingress1"): resource.NewFromMap(
|
||||
resid.NewResId(ingress, "ingress1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "extensions",
|
||||
"apiVersion": "v1beta1",
|
||||
@@ -80,7 +83,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
),
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -158,7 +161,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(statefulset, "statefulset1"): resource.NewFromMap(
|
||||
resid.NewResId(statefulset, "statefulset1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -195,7 +198,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
expected[k] = v
|
||||
}
|
||||
|
||||
expected[resid.NewResId(deploy, "deploy1")] = resource.NewFromMap(
|
||||
expected[resid.NewResId(deploy, "deploy1")] = rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -273,7 +276,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
expected[resid.NewResId(statefulset, "statefulset1")] = resource.NewFromMap(
|
||||
expected[resid.NewResId(statefulset, "statefulset1")] = rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "apps",
|
||||
"apiVersion": "v1",
|
||||
@@ -303,7 +306,7 @@ func TestNameReferenceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
expected[resid.NewResId(ingress, "ingress1")] = resource.NewFromMap(
|
||||
expected[resid.NewResId(ingress, "ingress1")] = rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"group": "extensions",
|
||||
"apiVersion": "v1beta1",
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
@@ -27,8 +28,10 @@ import (
|
||||
)
|
||||
|
||||
func TestNamespaceRun(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -36,7 +39,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cmap, "cm2"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -45,7 +48,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "foo",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(ns, "ns1"): resource.NewFromMap(
|
||||
resid.NewResId(ns, "ns1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Namespace",
|
||||
@@ -53,7 +56,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"name": "ns1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(sa, "default"): resource.NewFromMap(
|
||||
resid.NewResId(sa, "default"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ServiceAccount",
|
||||
@@ -62,7 +65,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "system",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(sa, "service-account"): resource.NewFromMap(
|
||||
resid.NewResId(sa, "service-account"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ServiceAccount",
|
||||
@@ -71,7 +74,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "system",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crb, "crb"): resource.NewFromMap(
|
||||
resid.NewResId(crb, "crb"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "rbac.authorization.k8s.io/v1",
|
||||
"kind": "ClusterRoleBinding",
|
||||
@@ -96,7 +99,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crd, "crd"): resource.NewFromMap(
|
||||
resid.NewResId(crd, "crd"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apiextensions.k8s.io/v1beta1",
|
||||
"kind": "CustomResourceDefinition",
|
||||
@@ -106,7 +109,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResIdWithPrefixNamespace(ns, "ns1", "", ""): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefixNamespace(ns, "ns1", "", ""): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Namespace",
|
||||
@@ -114,7 +117,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"name": "ns1",
|
||||
},
|
||||
}),
|
||||
resid.NewResIdWithPrefixNamespace(cmap, "cm1", "", "test"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefixNamespace(cmap, "cm1", "", "test"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -123,7 +126,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "test",
|
||||
},
|
||||
}),
|
||||
resid.NewResIdWithPrefixNamespace(cmap, "cm2", "", "test"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefixNamespace(cmap, "cm2", "", "test"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -132,7 +135,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "test",
|
||||
},
|
||||
}),
|
||||
resid.NewResIdWithPrefixNamespace(sa, "default", "", "test"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefixNamespace(sa, "default", "", "test"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ServiceAccount",
|
||||
@@ -141,7 +144,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "test",
|
||||
},
|
||||
}),
|
||||
resid.NewResIdWithPrefixNamespace(sa, "service-account", "", "test"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefixNamespace(sa, "service-account", "", "test"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ServiceAccount",
|
||||
@@ -150,7 +153,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
"namespace": "test",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crb, "crb"): resource.NewFromMap(
|
||||
resid.NewResId(crb, "crb"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "rbac.authorization.k8s.io/v1",
|
||||
"kind": "ClusterRoleBinding",
|
||||
@@ -175,7 +178,7 @@ func TestNamespaceRun(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crd, "crd"): resource.NewFromMap(
|
||||
resid.NewResId(crd, "crd"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apiextensions.k8s.io/v1beta1",
|
||||
"kind": "CustomResourceDefinition",
|
||||
|
||||
@@ -31,16 +31,18 @@ import (
|
||||
// patchTransformer applies patches.
|
||||
type patchTransformer struct {
|
||||
patches []*resource.Resource
|
||||
rf *resource.Factory
|
||||
}
|
||||
|
||||
var _ Transformer = &patchTransformer{}
|
||||
|
||||
// NewPatchTransformer constructs a patchTransformer.
|
||||
func NewPatchTransformer(slice []*resource.Resource) (Transformer, error) {
|
||||
func NewPatchTransformer(
|
||||
slice []*resource.Resource, rf *resource.Factory) (Transformer, error) {
|
||||
if len(slice) == 0 {
|
||||
return NewNoOpTransformer(), nil
|
||||
}
|
||||
return &patchTransformer{slice}, nil
|
||||
return &patchTransformer{patches: slice, rf: rf}, nil
|
||||
}
|
||||
|
||||
// Transform apply the patches on top of the base resources.
|
||||
@@ -129,9 +131,9 @@ func (pt *patchTransformer) mergePatches() (resmap.ResMap, error) {
|
||||
}
|
||||
var cd conflictDetector
|
||||
if err != nil {
|
||||
cd = newJMPConflictDetector()
|
||||
cd = newJMPConflictDetector(pt.rf)
|
||||
} else {
|
||||
cd, err = newSMPConflictDetector(versionedObj)
|
||||
cd, err = newSMPConflictDetector(versionedObj, pt.rf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -21,14 +21,17 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
)
|
||||
|
||||
func TestOverlayRun(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
@@ -55,7 +58,7 @@ func TestOverlayRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -88,7 +91,7 @@ func TestOverlayRun(t *testing.T) {
|
||||
),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
@@ -121,7 +124,7 @@ func TestOverlayRun(t *testing.T) {
|
||||
},
|
||||
}),
|
||||
}
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -137,7 +140,7 @@ func TestOverlayRun(t *testing.T) {
|
||||
|
||||
func TestMultiplePatches(t *testing.T) {
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
@@ -159,7 +162,7 @@ func TestMultiplePatches(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -185,7 +188,7 @@ func TestMultiplePatches(t *testing.T) {
|
||||
},
|
||||
},
|
||||
),
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -216,7 +219,7 @@ func TestMultiplePatches(t *testing.T) {
|
||||
),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
@@ -251,7 +254,7 @@ func TestMultiplePatches(t *testing.T) {
|
||||
},
|
||||
}),
|
||||
}
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -267,7 +270,7 @@ func TestMultiplePatches(t *testing.T) {
|
||||
|
||||
func TestMultiplePatchesWithConflict(t *testing.T) {
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(deploy, "deploy1"): resource.NewFromMap(
|
||||
resid.NewResId(deploy, "deploy1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
@@ -289,7 +292,7 @@ func TestMultiplePatchesWithConflict(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -315,7 +318,7 @@ func TestMultiplePatchesWithConflict(t *testing.T) {
|
||||
},
|
||||
},
|
||||
),
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -337,7 +340,7 @@ func TestMultiplePatchesWithConflict(t *testing.T) {
|
||||
),
|
||||
}
|
||||
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -352,7 +355,7 @@ func TestMultiplePatchesWithConflict(t *testing.T) {
|
||||
|
||||
func TestNoSchemaOverlayRun(t *testing.T) {
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(foo, "my-foo"): resource.NewFromMap(
|
||||
resid.NewResId(foo, "my-foo"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
@@ -368,7 +371,7 @@ func TestNoSchemaOverlayRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -384,7 +387,7 @@ func TestNoSchemaOverlayRun(t *testing.T) {
|
||||
),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(foo, "my-foo"): resource.NewFromMap(
|
||||
resid.NewResId(foo, "my-foo"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
@@ -400,7 +403,7 @@ func TestNoSchemaOverlayRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -415,7 +418,7 @@ func TestNoSchemaOverlayRun(t *testing.T) {
|
||||
|
||||
func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(foo, "my-foo"): resource.NewFromMap(
|
||||
resid.NewResId(foo, "my-foo"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
@@ -431,7 +434,7 @@ func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -445,7 +448,7 @@ func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
},
|
||||
},
|
||||
),
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -464,7 +467,7 @@ func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResId(foo, "my-foo"): resource.NewFromMap(
|
||||
resid.NewResId(foo, "my-foo"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
@@ -484,7 +487,7 @@ func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -499,7 +502,7 @@ func TestNoSchemaMultiplePatches(t *testing.T) {
|
||||
|
||||
func TestNoSchemaMultiplePatchesWithConflict(t *testing.T) {
|
||||
base := resmap.ResMap{
|
||||
resid.NewResId(foo, "my-foo"): resource.NewFromMap(
|
||||
resid.NewResId(foo, "my-foo"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
@@ -515,7 +518,7 @@ func TestNoSchemaMultiplePatchesWithConflict(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
patch := []*resource.Resource{
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -528,7 +531,7 @@ func TestNoSchemaMultiplePatchesWithConflict(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
resource.NewFromMap(map[string]interface{}{
|
||||
rf.FromMap(map[string]interface{}{
|
||||
"apiVersion": "example.com/v1",
|
||||
"kind": "Foo",
|
||||
"metadata": map[string]interface{}{
|
||||
@@ -542,7 +545,7 @@ func TestNoSchemaMultiplePatchesWithConflict(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
|
||||
lt, err := NewPatchTransformer(patch)
|
||||
lt, err := NewPatchTransformer(patch, rf)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package transformers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/evanphx/json-patch"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/mergepatch"
|
||||
@@ -31,12 +32,14 @@ type conflictDetector interface {
|
||||
mergePatches(patch1, patch2 *resource.Resource) (*resource.Resource, error)
|
||||
}
|
||||
|
||||
type jsonMergePatch struct{}
|
||||
type jsonMergePatch struct {
|
||||
rf *resource.Factory
|
||||
}
|
||||
|
||||
var _ conflictDetector = &jsonMergePatch{}
|
||||
|
||||
func newJMPConflictDetector() conflictDetector {
|
||||
return &jsonMergePatch{}
|
||||
func newJMPConflictDetector(rf *resource.Factory) conflictDetector {
|
||||
return &jsonMergePatch{rf: rf}
|
||||
}
|
||||
|
||||
func (jmp *jsonMergePatch) hasConflict(
|
||||
@@ -82,18 +85,21 @@ func (jmp *jsonMergePatch) mergePatches(
|
||||
}
|
||||
mergedMap := make(map[string]interface{})
|
||||
err = json.Unmarshal(mergedBytes, &mergedMap)
|
||||
return resource.NewFromMap(mergedMap), err
|
||||
return jmp.rf.FromMap(mergedMap), err
|
||||
}
|
||||
|
||||
type strategicMergePatch struct {
|
||||
lookupPatchMeta strategicpatch.LookupPatchMeta
|
||||
rf *resource.Factory
|
||||
}
|
||||
|
||||
var _ conflictDetector = &strategicMergePatch{}
|
||||
|
||||
func newSMPConflictDetector(versionedObj runtime.Object) (conflictDetector, error) {
|
||||
func newSMPConflictDetector(
|
||||
versionedObj runtime.Object,
|
||||
rf *resource.Factory) (conflictDetector, error) {
|
||||
lookupPatchMeta, err := strategicpatch.NewPatchMetaFromStruct(versionedObj)
|
||||
return &strategicMergePatch{lookupPatchMeta: lookupPatchMeta}, err
|
||||
return &strategicMergePatch{lookupPatchMeta: lookupPatchMeta, rf: rf}, err
|
||||
}
|
||||
|
||||
func (smp *strategicMergePatch) hasConflict(p1, p2 *resource.Resource) (bool, error) {
|
||||
@@ -127,5 +133,5 @@ func (smp *strategicMergePatch) findConflict(
|
||||
func (smp *strategicMergePatch) mergePatches(patch1, patch2 *resource.Resource) (*resource.Resource, error) {
|
||||
mergeJsonMap, err := strategicpatch.MergeStrategicMergeMapPatchUsingLookupPatchMeta(
|
||||
smp.lookupPatchMeta, patch1.Map(), patch2.Map())
|
||||
return resource.NewFromMap(mergeJsonMap), err
|
||||
return smp.rf.FromMap(mergeJsonMap), err
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/k8sdeps"
|
||||
"sigs.k8s.io/kustomize/pkg/resid"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
@@ -27,8 +28,10 @@ import (
|
||||
)
|
||||
|
||||
func TestPrefixNameRun(t *testing.T) {
|
||||
rf := resource.NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
m := resmap.ResMap{
|
||||
resid.NewResId(cmap, "cm1"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm1"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -36,7 +39,7 @@ func TestPrefixNameRun(t *testing.T) {
|
||||
"name": "cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(cmap, "cm2"): resource.NewFromMap(
|
||||
resid.NewResId(cmap, "cm2"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -44,7 +47,7 @@ func TestPrefixNameRun(t *testing.T) {
|
||||
"name": "cm2",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crd, "crd"): resource.NewFromMap(
|
||||
resid.NewResId(crd, "crd"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apiextensions.k8s.io/v1beta1",
|
||||
"kind": "CustomResourceDefinition",
|
||||
@@ -54,7 +57,7 @@ func TestPrefixNameRun(t *testing.T) {
|
||||
}),
|
||||
}
|
||||
expected := resmap.ResMap{
|
||||
resid.NewResIdWithPrefix(cmap, "cm1", "someprefix-"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefix(cmap, "cm1", "someprefix-"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -62,7 +65,7 @@ func TestPrefixNameRun(t *testing.T) {
|
||||
"name": "someprefix-cm1",
|
||||
},
|
||||
}),
|
||||
resid.NewResIdWithPrefix(cmap, "cm2", "someprefix-"): resource.NewFromMap(
|
||||
resid.NewResIdWithPrefix(cmap, "cm2", "someprefix-"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -70,7 +73,7 @@ func TestPrefixNameRun(t *testing.T) {
|
||||
"name": "someprefix-cm2",
|
||||
},
|
||||
}),
|
||||
resid.NewResId(crd, "crd"): resource.NewFromMap(
|
||||
resid.NewResId(crd, "crd"): rf.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apiextensions.k8s.io/v1beta1",
|
||||
"kind": "CustomResourceDefinition",
|
||||
|
||||
Reference in New Issue
Block a user