From dd3ff341e091de80f105bc257d625e1bd25be393 Mon Sep 17 00:00:00 2001 From: Justin SB Date: Sun, 17 Nov 2019 14:08:09 -0800 Subject: [PATCH 1/9] Fix typo: suing -> using --- examples/goGetterGeneratorPlugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/goGetterGeneratorPlugin.md b/examples/goGetterGeneratorPlugin.md index e136fb748..54d193d2e 100644 --- a/examples/goGetterGeneratorPlugin.md +++ b/examples/goGetterGeneratorPlugin.md @@ -2,7 +2,7 @@ Kustomize supports building a [remote target], but the URLs are limited to common [Git repository specs]. -To extend the supported format, Kustomize has a [plugin] system that allows one to integrate third-party tools such as [hashicorp/go-getter] to "download things from a string URL suing a variety of protocols", extract the content and generated resources as part of kustomize build. +To extend the supported format, Kustomize has a [plugin] system that allows one to integrate third-party tools such as [hashicorp/go-getter] to "download things from a string URL using a variety of protocols", extract the content and generated resources as part of kustomize build. [remote target]: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md [Git repository specs]: https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/git/repospec_test.go From 83db25d6c4eca581db7ebf7cfb982a537beb8a8e Mon Sep 17 00:00:00 2001 From: Jeffrey Regan Date: Mon, 18 Nov 2019 06:25:50 -0800 Subject: [PATCH 2/9] Activate lint for unused code. --- .golangci-kustomize.yml | 6 ++++-- api/builtins/hashtransformer.go | 2 +- api/go.sum | 1 + api/internal/accumulator/refvartransformer.go | 4 +++- api/internal/plugins/execplugin/execplugin_test.go | 2 +- api/internal/target/kusttarget.go | 5 ----- api/resource/resource.go | 7 ++++--- api/types/genargs.go | 13 ++++++------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.golangci-kustomize.yml b/.golangci-kustomize.yml index c82a87361..e2fadf5ba 100644 --- a/.golangci-kustomize.yml +++ b/.golangci-kustomize.yml @@ -23,10 +23,12 @@ linters: - nakedret - staticcheck - structcheck - # - stylecheck (panics) + # stylecheck demands that acronyms not be treated as words + # in camelCase, so JsonOp become JSONOp, etc. Yuck. + # - stylecheck # - typecheck (fails in lots of places) - unconvert - # - unused (panics) + - unused - unparam - varcheck diff --git a/api/builtins/hashtransformer.go b/api/builtins/hashtransformer.go index 8de0d94bd..b96d90c24 100644 --- a/api/builtins/hashtransformer.go +++ b/api/builtins/hashtransformer.go @@ -23,7 +23,7 @@ func (p *HashTransformerPlugin) Config( // Transform appends hash to generated resources. func (p *HashTransformerPlugin) Transform(m resmap.ResMap) error { for _, res := range m.Resources() { - if res.NeedHashSuffix() { + if res.ShouldAddHashSuffixToName() { h, err := p.hasher.Hash(res) if err != nil { return err diff --git a/api/go.sum b/api/go.sum index 95908b3b9..9dfdab7f4 100644 --- a/api/go.sum +++ b/api/go.sum @@ -389,6 +389,7 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190909003024-a7b16738d86b h1:XfVGCX+0T4WOStkaOsJRllbsiImhB2jgVBGc9L0lPGc= golang.org/x/net v0.0.0-20190909003024-a7b16738d86b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/api/internal/accumulator/refvartransformer.go b/api/internal/accumulator/refvartransformer.go index 48f2b7396..1900cdc4b 100644 --- a/api/internal/accumulator/refvartransformer.go +++ b/api/internal/accumulator/refvartransformer.go @@ -70,7 +70,9 @@ func (rv *refVarTransformer) replaceVars(in interface{}) (interface{}, error) { // This field can potentially contain a $(VAR) since it is // of string type. return expansion2.Expand(s, rv.mappingFunc), nil - //nolint:staticcheck (erroneously claims that `case nil` is unreachable) + // staticcheck erroneously claims that `case nil` + // is unreachable here, so suppressing it. + //nolint:staticcheck case nil: return nil, nil default: diff --git a/api/internal/plugins/execplugin/execplugin_test.go b/api/internal/plugins/execplugin/execplugin_test.go index 9974ff96a..aa002868c 100644 --- a/api/internal/plugins/execplugin/execplugin_test.go +++ b/api/internal/plugins/execplugin/execplugin_test.go @@ -157,7 +157,7 @@ func TestUpdateResourceOptions(t *testing.T) { if !a.Equals(b) { t.Errorf("expected %v got %v", a, b) } - if a.NeedHashSuffix() != b.NeedHashSuffix() { + if a.ShouldAddHashSuffixToName() != b.ShouldAddHashSuffixToName() { t.Errorf("") } if a.Behavior() != b.Behavior() { diff --git a/api/internal/target/kusttarget.go b/api/internal/target/kusttarget.go index 093fe57d4..2ee0d03cf 100644 --- a/api/internal/target/kusttarget.go +++ b/api/internal/target/kusttarget.go @@ -222,11 +222,6 @@ func (kt *KustTarget) computeInventory( return ra.Transform(p) } -func (kt *KustTarget) shouldAddHashSuffixesToGeneratedResources() bool { - return kt.kustomization.GeneratorOptions == nil || - !kt.kustomization.GeneratorOptions.DisableNameSuffixHash -} - // AccumulateTarget returns a new ResAccumulator, // holding customized resources and the data/rules used // to do so. The name back references and vars are diff --git a/api/resource/resource.go b/api/resource/resource.go index 99939806a..7c44f9fcc 100644 --- a/api/resource/resource.go +++ b/api/resource/resource.go @@ -252,9 +252,10 @@ func (r *Resource) Behavior() types.GenerationBehavior { return r.options.Behavior() } -// NeedHashSuffix checks if the resource need a hash suffix -func (r *Resource) NeedHashSuffix() bool { - return r.options != nil && r.options.NeedsHashSuffix() +// ShouldAddHashSuffixToName returns true if a resource +// content hash should be appended to the name of the resource. +func (r *Resource) ShouldAddHashSuffixToName() bool { + return r.options != nil && r.options.ShouldAddHashSuffixToName() } // GetNamespace returns the namespace the resource thinks it's in. diff --git a/api/types/genargs.go b/api/types/genargs.go index 93acbad84..a80955b36 100644 --- a/api/types/genargs.go +++ b/api/types/genargs.go @@ -28,18 +28,17 @@ func (g *GenArgs) String() string { } return "{" + strings.Join([]string{ - "nsfx:" + strconv.FormatBool(g.NeedsHashSuffix()), + "nsfx:" + strconv.FormatBool(g.ShouldAddHashSuffixToName()), "beh:" + g.Behavior().String()}, ",") + "}" } -// NeedsHashSuffix returns true if the hash suffix is needed. -// It is needed when the two conditions are both met -// 1) GenArgs is not nil -// 2) DisableNameSuffixHash in GeneratorOptions is not set to true -func (g *GenArgs) NeedsHashSuffix() bool { - return g.args != nil && (g.opts == nil || !g.opts.DisableNameSuffixHash) +// ShouldAddHashSuffixToName returns true if a resource +// content hash should be appended to the name of the resource. +func (g *GenArgs) ShouldAddHashSuffixToName() bool { + return g.args != nil && + (g.opts == nil || !g.opts.DisableNameSuffixHash) } // Behavior returns Behavior field of GeneratorArgs From 362454413ab30446694ef38d4c0588622f86b78f Mon Sep 17 00:00:00 2001 From: Jeffrey Regan Date: Mon, 18 Nov 2019 06:53:38 -0800 Subject: [PATCH 3/9] Activate lint typecheck --- .golangci-kustomize.yml | 2 +- api/builtins/hashtransformer.go | 2 +- api/internal/plugins/execplugin/execplugin_test.go | 2 +- api/resource/resource.go | 6 +++--- api/types/genargs.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.golangci-kustomize.yml b/.golangci-kustomize.yml index e2fadf5ba..097af0f10 100644 --- a/.golangci-kustomize.yml +++ b/.golangci-kustomize.yml @@ -26,7 +26,7 @@ linters: # stylecheck demands that acronyms not be treated as words # in camelCase, so JsonOp become JSONOp, etc. Yuck. # - stylecheck - # - typecheck (fails in lots of places) + - typecheck - unconvert - unused - unparam diff --git a/api/builtins/hashtransformer.go b/api/builtins/hashtransformer.go index b96d90c24..8de0d94bd 100644 --- a/api/builtins/hashtransformer.go +++ b/api/builtins/hashtransformer.go @@ -23,7 +23,7 @@ func (p *HashTransformerPlugin) Config( // Transform appends hash to generated resources. func (p *HashTransformerPlugin) Transform(m resmap.ResMap) error { for _, res := range m.Resources() { - if res.ShouldAddHashSuffixToName() { + if res.NeedHashSuffix() { h, err := p.hasher.Hash(res) if err != nil { return err diff --git a/api/internal/plugins/execplugin/execplugin_test.go b/api/internal/plugins/execplugin/execplugin_test.go index aa002868c..9974ff96a 100644 --- a/api/internal/plugins/execplugin/execplugin_test.go +++ b/api/internal/plugins/execplugin/execplugin_test.go @@ -157,7 +157,7 @@ func TestUpdateResourceOptions(t *testing.T) { if !a.Equals(b) { t.Errorf("expected %v got %v", a, b) } - if a.ShouldAddHashSuffixToName() != b.ShouldAddHashSuffixToName() { + if a.NeedHashSuffix() != b.NeedHashSuffix() { t.Errorf("") } if a.Behavior() != b.Behavior() { diff --git a/api/resource/resource.go b/api/resource/resource.go index 7c44f9fcc..fc8931d42 100644 --- a/api/resource/resource.go +++ b/api/resource/resource.go @@ -252,9 +252,9 @@ func (r *Resource) Behavior() types.GenerationBehavior { return r.options.Behavior() } -// ShouldAddHashSuffixToName returns true if a resource -// content hash should be appended to the name of the resource. -func (r *Resource) ShouldAddHashSuffixToName() bool { +// NeedHashSuffix returns true if a resource content +// hash should be appended to the name of the resource. +func (r *Resource) NeedHashSuffix() bool { return r.options != nil && r.options.ShouldAddHashSuffixToName() } diff --git a/api/types/genargs.go b/api/types/genargs.go index a80955b36..ad0e750fd 100644 --- a/api/types/genargs.go +++ b/api/types/genargs.go @@ -34,7 +34,7 @@ func (g *GenArgs) String() string { "}" } -// ShouldAddHashSuffixToName returns true if a resource +// NeedHashSuffix returns true if a resource // content hash should be appended to the name of the resource. func (g *GenArgs) ShouldAddHashSuffixToName() bool { return g.args != nil && From 277f565f2e3343a1aa09569829c592549edfb6f2 Mon Sep 17 00:00:00 2001 From: Jeff Regan Date: Mon, 18 Nov 2019 09:23:06 -0800 Subject: [PATCH 4/9] Update genargs.go --- api/types/genargs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/types/genargs.go b/api/types/genargs.go index ad0e750fd..a80955b36 100644 --- a/api/types/genargs.go +++ b/api/types/genargs.go @@ -34,7 +34,7 @@ func (g *GenArgs) String() string { "}" } -// NeedHashSuffix returns true if a resource +// ShouldAddHashSuffixToName returns true if a resource // content hash should be appended to the name of the resource. func (g *GenArgs) ShouldAddHashSuffixToName() bool { return g.args != nil && From bf119bf5b7ab3b51cba5845832ae1cc9807d553e Mon Sep 17 00:00:00 2001 From: Jeffrey Regan Date: Mon, 18 Nov 2019 08:52:14 -0800 Subject: [PATCH 5/9] Add test elaborating on custom config. --- .../customconfigofbuiltinplugin_test.go | 119 +---------- .../target/customconfigreusable_test.go | 186 ++++++++++++++++++ 2 files changed, 188 insertions(+), 117 deletions(-) create mode 100644 api/internal/target/customconfigreusable_test.go diff --git a/api/internal/target/customconfigofbuiltinplugin_test.go b/api/internal/target/customconfigofbuiltinplugin_test.go index 01a365508..824ba7f7b 100644 --- a/api/internal/target/customconfigofbuiltinplugin_test.go +++ b/api/internal/target/customconfigofbuiltinplugin_test.go @@ -10,8 +10,8 @@ import ( ) // Demo custom configuration of a builtin transformation. -// This is a NamePrefixer that only touches Deployments -// and Services. +// This is a NamePrefixer that touches Deployments +// and Services exclusively. func TestCustomNamePrefixer(t *testing.T) { tc := kusttest_test.NewPluginTestEnv(t).Set() defer tc.Reset() @@ -99,118 +99,3 @@ metadata: name: zzz-myService `) } - -// Demo custom configuration as a base. -func TestReusableCustomNamePrefixer(t *testing.T) { - tc := kusttest_test.NewPluginTestEnv(t).Set() - defer tc.Reset() - - tc.BuildGoPlugin( - "builtin", "", "PrefixSuffixTransformer") - tc.BuildGoPlugin( - "builtin", "", "LabelTransformer") - - th := kusttest_test.NewKustTestHarnessAllowPlugins(t, "/app/foo") - - // This kustomization file contains resources that - // all happen to be plugin configurations. This makes - // these plugins all available as part of a base, - // re-usable in any number of other kustomizations. - // Just specify the path (or URL) to this base in the - // "transformers:" field (not the "resources" field). - th.WriteK("/app/mytransformers", ` -resources: -- prefixer.yaml -- labeller.yaml -`) - th.WriteF("/app/mytransformers/prefixer.yaml", ` -apiVersion: builtin -kind: PrefixSuffixTransformer -metadata: - name: myPrefixer -prefix: zzz- -fieldSpecs: -- kind: Deployment - path: metadata/name -- kind: Service - path: metadata/name -`) - th.WriteF("/app/mytransformers/labeller.yaml", ` -apiVersion: builtin -kind: LabelTransformer -metadata: - name: myLabeller -labels: - company: acmeCorp -fieldSpecs: -- path: spec/template/metadata/labels - kind: Deployment -`) - - th.WriteK("/app/foo", ` -resources: -- deployment.yaml -- role.yaml -- service.yaml -transformers: -- ../mytransformers -`) - th.WriteF("/app/foo/deployment.yaml", ` -apiVersion: apps/v1 -kind: Deployment -metadata: - name: myDeployment -spec: - template: - metadata: - labels: - backend: awesome - spec: - containers: - - name: whatever - image: whatever -`) - th.WriteF("/app/foo/role.yaml", ` -apiVersion: v1 -kind: Role -metadata: - name: myRole -`) - th.WriteF("/app/foo/service.yaml", ` -apiVersion: v1 -kind: Service -metadata: - name: myService -`) - - m, err := th.MakeKustTarget().MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - th.AssertActualEqualsExpected(m, ` -apiVersion: apps/v1 -kind: Deployment -metadata: - name: zzz-myDeployment -spec: - template: - metadata: - labels: - backend: awesome - company: acmeCorp - spec: - containers: - - image: whatever - name: whatever ---- -apiVersion: v1 -kind: Role -metadata: - name: myRole ---- -apiVersion: v1 -kind: Service -metadata: - name: zzz-myService -`) -} diff --git a/api/internal/target/customconfigreusable_test.go b/api/internal/target/customconfigreusable_test.go new file mode 100644 index 000000000..e9c6988c0 --- /dev/null +++ b/api/internal/target/customconfigreusable_test.go @@ -0,0 +1,186 @@ +// Copyright 2019 The Kubernetes Authors. +// SPDX-License-Identifier: Apache-2.0 + +package target_test + +import ( + "testing" + + kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" +) + +// Demo custom configuration as a base. +// This test shows usage of three custom configurations sitting +// in a base, allowing them to be reused in any number of +// kustomizations. +func TestReusableCustomTransformers(t *testing.T) { + tc := kusttest_test.NewPluginTestEnv(t).Set() + defer tc.Reset() + + tc.BuildGoPlugin( + "builtin", "", "PrefixSuffixTransformer") + tc.BuildGoPlugin( + "builtin", "", "AnnotationsTransformer") + tc.BuildGoPlugin( + "builtin", "", "LabelTransformer") + + th := kusttest_test.NewKustTestHarnessAllowPlugins(t, "/app/staging") + + // First write three custom configurations for builtin plugins. + + // A custom name prefixer that only touches Deployments and Services. + th.WriteF("/app/mytransformers/deploymentServicePrefixer.yaml", ` +apiVersion: builtin +kind: PrefixSuffixTransformer +metadata: + name: myPrefixer +prefix: bob- +fieldSpecs: +- kind: Deployment + path: metadata/name +- kind: Service + path: metadata/name +`) + + // A custom annotator exclusively annotating Roles. + th.WriteF("/app/mytransformers/roleAnnotator.yaml", ` +apiVersion: builtin +kind: AnnotationsTransformer +metadata: + name: myAnnotator +annotations: + # Imagine that SRE has not approved this role yet. + status: probationary +fieldSpecs: +- path: metadata/annotations + create: true + kind: Role +`) + + // A custom labeller that only labels Deployments, + // and only labels them at their top metadata level + // exclusively. It does not modify selectors or + // add labels to pods in the template. + th.WriteF("/app/mytransformers/deploymentLabeller.yaml", ` +apiVersion: builtin +kind: LabelTransformer +metadata: + name: myLabeller +labels: + pager: 867-5301 +fieldSpecs: +- path: metadata/labels + create: true + kind: Deployment +`) + + // Combine these custom transformers in one kustomization file. + // This kustomization file contains only resources that + // all happen to be plugin configurations. This makes + // these plugins re-usable as a group in any number of other + // kustomizations. + th.WriteK("/app/mytransformers", ` +resources: +- deploymentServicePrefixer.yaml +- roleAnnotator.yaml +- deploymentLabeller.yaml +`) + + // Finally, define the kustomization for the (arbitrarily named) + // staging environment. + th.WriteK("/app/staging", ` + +# Bring in the custom transformers. +transformers: +- ../mytransformers + +# Also use the "classic" labeller, which behind the scenes uses +# the LabelTransformer, but with a broad configuration targeting +# many resources and fields (including selector fields). +# It's a big hammer - probably too big; the output shows all the +# places 'acmeCorp' now appears as a result. To avoid this, +# define your own config for your own LabelTransformer instance +# as shown above. +commonLabels: + company: acmeCorp + +# Specify the resources to modify. +resources: +- deployment.yaml +- role.yaml +- service.yaml +`) + th.WriteF("/app/staging/deployment.yaml", ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: myDeployment +spec: + template: + metadata: + labels: + backend: flawless + spec: + containers: + - name: whatever + image: whatever +`) + th.WriteF("/app/staging/role.yaml", ` +apiVersion: v1 +kind: Role +metadata: + name: myRole +`) + th.WriteF("/app/staging/service.yaml", ` +apiVersion: v1 +kind: Service +metadata: + name: myService +`) + + m, err := th.MakeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.AssertActualEqualsExpected(m, ` +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + company: acmeCorp + pager: 867-5301 + name: bob-myDeployment +spec: + selector: + matchLabels: + company: acmeCorp + template: + metadata: + labels: + backend: flawless + company: acmeCorp + spec: + containers: + - image: whatever + name: whatever +--- +apiVersion: v1 +kind: Role +metadata: + annotations: + status: probationary + labels: + company: acmeCorp + name: myRole +--- +apiVersion: v1 +kind: Service +metadata: + labels: + company: acmeCorp + name: bob-myService +spec: + selector: + company: acmeCorp +`) +} From d8e58914987c796e9e27a20ab9dff24b203d1610 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Mon, 18 Nov 2019 15:09:38 -0800 Subject: [PATCH 6/9] Rename cmd/kyaml to cmd/config --- cmd/kyaml/README.md | 2 +- cmd/kyaml/cmd/cat_test.go | 2 +- cmd/kyaml/cmd/cmdxargs_test.go | 2 +- cmd/kyaml/cmd/count_test.go | 2 +- cmd/kyaml/cmd/fmt_test.go | 2 +- cmd/kyaml/cmd/grep_test.go | 2 +- cmd/kyaml/cmd/tree_test.go | 2 +- cmd/kyaml/go.mod | 2 +- cmd/kyaml/go.sum | 1 + cmd/kyaml/main.go | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/kyaml/README.md b/cmd/kyaml/README.md index f81711fe0..b5984c93b 100644 --- a/cmd/kyaml/README.md +++ b/cmd/kyaml/README.md @@ -1,4 +1,4 @@ -# cmd/kyaml +# cmd/config This package exists to expose kyaml filters directly as cli commands for the purposes of development of the kyaml package and as a reference implementation for using the libraries. diff --git a/cmd/kyaml/cmd/cat_test.go b/cmd/kyaml/cmd/cat_test.go index 36a9133f6..4fad23229 100644 --- a/cmd/kyaml/cmd/cat_test.go +++ b/cmd/kyaml/cmd/cat_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" ) // TODO(pwittrock): write tests for reading / writing ResourceLists diff --git a/cmd/kyaml/cmd/cmdxargs_test.go b/cmd/kyaml/cmd/cmdxargs_test.go index f20265d3a..08cd9e7cd 100644 --- a/cmd/kyaml/cmd/cmdxargs_test.go +++ b/cmd/kyaml/cmd/cmdxargs_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" ) const ( diff --git a/cmd/kyaml/cmd/count_test.go b/cmd/kyaml/cmd/count_test.go index ad0e7cc3f..9ee08448e 100644 --- a/cmd/kyaml/cmd/count_test.go +++ b/cmd/kyaml/cmd/count_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" ) func TestCountCommand_files(t *testing.T) { diff --git a/cmd/kyaml/cmd/fmt_test.go b/cmd/kyaml/cmd/fmt_test.go index 4be7327a7..5ad7f82d4 100644 --- a/cmd/kyaml/cmd/fmt_test.go +++ b/cmd/kyaml/cmd/fmt_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" "sigs.k8s.io/kustomize/kyaml/kio/filters/testyaml" ) diff --git a/cmd/kyaml/cmd/grep_test.go b/cmd/kyaml/cmd/grep_test.go index eb59f94ee..78a6cce5c 100644 --- a/cmd/kyaml/cmd/grep_test.go +++ b/cmd/kyaml/cmd/grep_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" ) // TestGrepCommand_files verifies grep reads the files and filters them diff --git a/cmd/kyaml/cmd/tree_test.go b/cmd/kyaml/cmd/tree_test.go index db2d29e76..3ea10c792 100644 --- a/cmd/kyaml/cmd/tree_test.go +++ b/cmd/kyaml/cmd/tree_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" ) // TestCmd_files verifies fmt reads the files and filters them diff --git a/cmd/kyaml/go.mod b/cmd/kyaml/go.mod index a49569630..eb91ebd38 100644 --- a/cmd/kyaml/go.mod +++ b/cmd/kyaml/go.mod @@ -1,4 +1,4 @@ -module sigs.k8s.io/kustomize/cmd/kyaml +module sigs.k8s.io/kustomize/cmd/config go 1.13 diff --git a/cmd/kyaml/go.sum b/cmd/kyaml/go.sum index 7e015cc54..b75c99ecd 100644 --- a/cmd/kyaml/go.sum +++ b/cmd/kyaml/go.sum @@ -142,5 +142,6 @@ k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/utils v0.0.0-20191030222137-2b95a09bc58d/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/cmd/kyaml/main.go b/cmd/kyaml/main.go index cbd599613..b805f99de 100644 --- a/cmd/kyaml/main.go +++ b/cmd/kyaml/main.go @@ -7,7 +7,7 @@ import ( "os" "github.com/spf13/cobra" - "sigs.k8s.io/kustomize/cmd/kyaml/cmd" + "sigs.k8s.io/kustomize/cmd/config/cmd" "sigs.k8s.io/kustomize/kyaml/yaml/merge2" "sigs.k8s.io/kustomize/kyaml/yaml/merge3" ) From 99701a19323517e266ae51fad247cfa27c5c2850 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Tue, 19 Nov 2019 18:41:35 -0800 Subject: [PATCH 7/9] Rename directory cmd/kyaml to cmd/config --- cmd/{kyaml => config}/.golangci.yml | 0 cmd/{kyaml => config}/LICENSE_TEMPLATE | 0 cmd/{kyaml => config}/Makefile | 0 cmd/{kyaml => config}/README.md | 0 cmd/{kyaml => config}/cmd/cat.go | 0 cmd/{kyaml => config}/cmd/cat_test.go | 0 cmd/{kyaml => config}/cmd/cmdwrap.go | 0 cmd/{kyaml => config}/cmd/cmdwrap_test.go | 0 cmd/{kyaml => config}/cmd/cmdxargs.go | 0 cmd/{kyaml => config}/cmd/cmdxargs_test.go | 0 cmd/{kyaml => config}/cmd/count.go | 0 cmd/{kyaml => config}/cmd/count_test.go | 0 cmd/{kyaml => config}/cmd/fmt.go | 0 cmd/{kyaml => config}/cmd/fmt_test.go | 0 cmd/{kyaml => config}/cmd/grep.go | 0 cmd/{kyaml => config}/cmd/grep_test.go | 0 cmd/{kyaml => config}/cmd/merge.go | 0 cmd/{kyaml => config}/cmd/run-fns.go | 0 cmd/{kyaml => config}/cmd/test/override.yaml | 0 cmd/{kyaml => config}/cmd/test/test.sh | 0 cmd/{kyaml => config}/cmd/tree.go | 0 cmd/{kyaml => config}/cmd/tree_test.go | 0 cmd/{kyaml => config}/cmd/util.go | 0 cmd/{kyaml => config}/go.mod | 0 cmd/{kyaml => config}/go.sum | 0 cmd/{kyaml => config}/inpututil/inpututil.go | 0 cmd/{kyaml => config}/main.go | 0 27 files changed, 0 insertions(+), 0 deletions(-) rename cmd/{kyaml => config}/.golangci.yml (100%) rename cmd/{kyaml => config}/LICENSE_TEMPLATE (100%) rename cmd/{kyaml => config}/Makefile (100%) rename cmd/{kyaml => config}/README.md (100%) rename cmd/{kyaml => config}/cmd/cat.go (100%) rename cmd/{kyaml => config}/cmd/cat_test.go (100%) rename cmd/{kyaml => config}/cmd/cmdwrap.go (100%) rename cmd/{kyaml => config}/cmd/cmdwrap_test.go (100%) rename cmd/{kyaml => config}/cmd/cmdxargs.go (100%) rename cmd/{kyaml => config}/cmd/cmdxargs_test.go (100%) rename cmd/{kyaml => config}/cmd/count.go (100%) rename cmd/{kyaml => config}/cmd/count_test.go (100%) rename cmd/{kyaml => config}/cmd/fmt.go (100%) rename cmd/{kyaml => config}/cmd/fmt_test.go (100%) rename cmd/{kyaml => config}/cmd/grep.go (100%) rename cmd/{kyaml => config}/cmd/grep_test.go (100%) rename cmd/{kyaml => config}/cmd/merge.go (100%) rename cmd/{kyaml => config}/cmd/run-fns.go (100%) rename cmd/{kyaml => config}/cmd/test/override.yaml (100%) rename cmd/{kyaml => config}/cmd/test/test.sh (100%) rename cmd/{kyaml => config}/cmd/tree.go (100%) rename cmd/{kyaml => config}/cmd/tree_test.go (100%) rename cmd/{kyaml => config}/cmd/util.go (100%) rename cmd/{kyaml => config}/go.mod (100%) rename cmd/{kyaml => config}/go.sum (100%) rename cmd/{kyaml => config}/inpututil/inpututil.go (100%) rename cmd/{kyaml => config}/main.go (100%) diff --git a/cmd/kyaml/.golangci.yml b/cmd/config/.golangci.yml similarity index 100% rename from cmd/kyaml/.golangci.yml rename to cmd/config/.golangci.yml diff --git a/cmd/kyaml/LICENSE_TEMPLATE b/cmd/config/LICENSE_TEMPLATE similarity index 100% rename from cmd/kyaml/LICENSE_TEMPLATE rename to cmd/config/LICENSE_TEMPLATE diff --git a/cmd/kyaml/Makefile b/cmd/config/Makefile similarity index 100% rename from cmd/kyaml/Makefile rename to cmd/config/Makefile diff --git a/cmd/kyaml/README.md b/cmd/config/README.md similarity index 100% rename from cmd/kyaml/README.md rename to cmd/config/README.md diff --git a/cmd/kyaml/cmd/cat.go b/cmd/config/cmd/cat.go similarity index 100% rename from cmd/kyaml/cmd/cat.go rename to cmd/config/cmd/cat.go diff --git a/cmd/kyaml/cmd/cat_test.go b/cmd/config/cmd/cat_test.go similarity index 100% rename from cmd/kyaml/cmd/cat_test.go rename to cmd/config/cmd/cat_test.go diff --git a/cmd/kyaml/cmd/cmdwrap.go b/cmd/config/cmd/cmdwrap.go similarity index 100% rename from cmd/kyaml/cmd/cmdwrap.go rename to cmd/config/cmd/cmdwrap.go diff --git a/cmd/kyaml/cmd/cmdwrap_test.go b/cmd/config/cmd/cmdwrap_test.go similarity index 100% rename from cmd/kyaml/cmd/cmdwrap_test.go rename to cmd/config/cmd/cmdwrap_test.go diff --git a/cmd/kyaml/cmd/cmdxargs.go b/cmd/config/cmd/cmdxargs.go similarity index 100% rename from cmd/kyaml/cmd/cmdxargs.go rename to cmd/config/cmd/cmdxargs.go diff --git a/cmd/kyaml/cmd/cmdxargs_test.go b/cmd/config/cmd/cmdxargs_test.go similarity index 100% rename from cmd/kyaml/cmd/cmdxargs_test.go rename to cmd/config/cmd/cmdxargs_test.go diff --git a/cmd/kyaml/cmd/count.go b/cmd/config/cmd/count.go similarity index 100% rename from cmd/kyaml/cmd/count.go rename to cmd/config/cmd/count.go diff --git a/cmd/kyaml/cmd/count_test.go b/cmd/config/cmd/count_test.go similarity index 100% rename from cmd/kyaml/cmd/count_test.go rename to cmd/config/cmd/count_test.go diff --git a/cmd/kyaml/cmd/fmt.go b/cmd/config/cmd/fmt.go similarity index 100% rename from cmd/kyaml/cmd/fmt.go rename to cmd/config/cmd/fmt.go diff --git a/cmd/kyaml/cmd/fmt_test.go b/cmd/config/cmd/fmt_test.go similarity index 100% rename from cmd/kyaml/cmd/fmt_test.go rename to cmd/config/cmd/fmt_test.go diff --git a/cmd/kyaml/cmd/grep.go b/cmd/config/cmd/grep.go similarity index 100% rename from cmd/kyaml/cmd/grep.go rename to cmd/config/cmd/grep.go diff --git a/cmd/kyaml/cmd/grep_test.go b/cmd/config/cmd/grep_test.go similarity index 100% rename from cmd/kyaml/cmd/grep_test.go rename to cmd/config/cmd/grep_test.go diff --git a/cmd/kyaml/cmd/merge.go b/cmd/config/cmd/merge.go similarity index 100% rename from cmd/kyaml/cmd/merge.go rename to cmd/config/cmd/merge.go diff --git a/cmd/kyaml/cmd/run-fns.go b/cmd/config/cmd/run-fns.go similarity index 100% rename from cmd/kyaml/cmd/run-fns.go rename to cmd/config/cmd/run-fns.go diff --git a/cmd/kyaml/cmd/test/override.yaml b/cmd/config/cmd/test/override.yaml similarity index 100% rename from cmd/kyaml/cmd/test/override.yaml rename to cmd/config/cmd/test/override.yaml diff --git a/cmd/kyaml/cmd/test/test.sh b/cmd/config/cmd/test/test.sh similarity index 100% rename from cmd/kyaml/cmd/test/test.sh rename to cmd/config/cmd/test/test.sh diff --git a/cmd/kyaml/cmd/tree.go b/cmd/config/cmd/tree.go similarity index 100% rename from cmd/kyaml/cmd/tree.go rename to cmd/config/cmd/tree.go diff --git a/cmd/kyaml/cmd/tree_test.go b/cmd/config/cmd/tree_test.go similarity index 100% rename from cmd/kyaml/cmd/tree_test.go rename to cmd/config/cmd/tree_test.go diff --git a/cmd/kyaml/cmd/util.go b/cmd/config/cmd/util.go similarity index 100% rename from cmd/kyaml/cmd/util.go rename to cmd/config/cmd/util.go diff --git a/cmd/kyaml/go.mod b/cmd/config/go.mod similarity index 100% rename from cmd/kyaml/go.mod rename to cmd/config/go.mod diff --git a/cmd/kyaml/go.sum b/cmd/config/go.sum similarity index 100% rename from cmd/kyaml/go.sum rename to cmd/config/go.sum diff --git a/cmd/kyaml/inpututil/inpututil.go b/cmd/config/inpututil/inpututil.go similarity index 100% rename from cmd/kyaml/inpututil/inpututil.go rename to cmd/config/inpututil/inpututil.go diff --git a/cmd/kyaml/main.go b/cmd/config/main.go similarity index 100% rename from cmd/kyaml/main.go rename to cmd/config/main.go From 14d4059f465231999d6de5da3375daa6578364f2 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Tue, 19 Nov 2019 18:42:18 -0800 Subject: [PATCH 8/9] Rename cmd/kyaml to cmd/config in travis scripts --- travis/kyaml-pre-commit.sh | 2 +- travis/verify-deps.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/travis/kyaml-pre-commit.sh b/travis/kyaml-pre-commit.sh index e76566f86..8c6462833 100755 --- a/travis/kyaml-pre-commit.sh +++ b/travis/kyaml-pre-commit.sh @@ -4,5 +4,5 @@ set -e cd kyaml make all -cd ../cmd/kyaml +cd ../cmd/config make all \ No newline at end of file diff --git a/travis/verify-deps.sh b/travis/verify-deps.sh index f62b6357d..702815cab 100755 --- a/travis/verify-deps.sh +++ b/travis/verify-deps.sh @@ -2,7 +2,7 @@ set -o xtrace -for dir in api kustomize pseudo kyaml plugin cmd/kyaml +for dir in api kustomize pseudo kyaml plugin cmd/config do for item in api apimachinery client-go do From 3ec583a3dfd5fd7bfa23172bc88ec01c92a141e3 Mon Sep 17 00:00:00 2001 From: Nguyen Phuong An Date: Thu, 21 Nov 2019 09:26:32 +0700 Subject: [PATCH 9/9] fix typo Signed-off-by: Nguyen Phuong An --- docs/glossary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/glossary.md b/docs/glossary.md index 32d0660ce..e1de9149e 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -71,7 +71,7 @@ cluster in the form of a complete resource list. The cluster merges this with the previously applied state and the actual state to arrive at a new desired -state, which the cluster's reconcilation loop attempts +state, which the cluster's reconciliation loop attempts to create. This is the foundation of level-based state management in k8s.