diff --git a/go.mod b/go.mod index 56a483bd97..cd7c86e004 100644 --- a/go.mod +++ b/go.mod @@ -25,5 +25,5 @@ require ( k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd sigs.k8s.io/cli-utils v0.15.0 sigs.k8s.io/kustomize/cmd/config v0.0.0-20200629173832-441581b74521 - sigs.k8s.io/kustomize/kyaml v0.3.2 + sigs.k8s.io/kustomize/kyaml v0.3.5-0.20200701183017-c7bc9d20663b ) diff --git a/go.sum b/go.sum index 6f818d2ff0..5c64f29e61 100644 --- a/go.sum +++ b/go.sum @@ -535,6 +535,7 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 h1:bw9doJza/SFBEweII/rHQh338oozWyiFsBRHtrflcws= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= @@ -580,6 +581,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 h1:Xe2gvTZUJpsvOWUnvmL/tmhVBZUmHSvLbMjRj6NUUKo= gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -652,14 +655,16 @@ sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbL sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/kustomize/cmd/config v0.0.0-20200629173832-441581b74521 h1:5Ph1WKZMOa1/0R4WUtRatC/jwE8YKa/YkRSqHapFCG8= sigs.k8s.io/kustomize/cmd/config v0.0.0-20200629173832-441581b74521/go.mod h1:0gcINVqp3BKKS/cDUuU5GLxVz0Y4UoW6MBBuEhrTgYU= +sigs.k8s.io/kustomize/cmd/config v0.3.0 h1:MXbJgQXeO45DAdttKjQKUgO7WJ3B8+BopDcMZw/qKbw= +sigs.k8s.io/kustomize/cmd/config v0.3.0/go.mod h1:3fEoJyrBJLE1Nag7glwmpqd+uH0JzMTrpumYxmhbj/8= sigs.k8s.io/kustomize/kyaml v0.1.4/go.mod h1:461i94nj0h0ylJ6w83jLkR4SqqVhn1iY6fjD0JSTQeE= sigs.k8s.io/kustomize/kyaml v0.1.13/go.mod h1:72/rLkSi+L/pHM1oCjwrf3ClU+tH5kZQvvdLSqIHwWU= -sigs.k8s.io/kustomize/kyaml v0.3.2 h1:0AorBQuNiz/JwYBOULcjQTltif/vrPRjsEhGkE1FZig= -sigs.k8s.io/kustomize/kyaml v0.3.2/go.mod h1:Z9y2rjGUGzVhgdYtDphESD9Hz+JZKOofKYObQYtMyVI= +sigs.k8s.io/kustomize/kyaml v0.3.0/go.mod h1:LjuK+fiy63C7cz/6I0OqxIth8nZzytzzDOgpjBHCtG8= +sigs.k8s.io/kustomize/kyaml v0.3.5-0.20200701183017-c7bc9d20663b h1:qEKXmy9Z4YfEEEgQQhMSCMJsyXLgZex6QpdlBsFRg10= +sigs.k8s.io/kustomize/kyaml v0.3.5-0.20200701183017-c7bc9d20663b/go.mod h1:XJL84E6sOFeNrQ7CADiemc1B0EjIxHo3OhW4o1aJYNw= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= -sigs.k8s.io/testing_frameworks v0.1.2 h1:vK0+tvjF0BZ/RYFeZ1E6BYBwHJJXhjuZ3TdsEKH+UQM= sigs.k8s.io/testing_frameworks v0.1.2/go.mod h1:ToQrwSC3s8Xf/lADdZp3Mktcql9CG0UAmdJG9th5i0w= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/run/run.go b/run/run.go index c029d603c3..8ae80e1f8d 100644 --- a/run/run.go +++ b/run/run.go @@ -37,6 +37,7 @@ import ( "sigs.k8s.io/cli-utils/pkg/util/factory" "sigs.k8s.io/kustomize/cmd/config/ext" "sigs.k8s.io/kustomize/kyaml/commandutil" + "sigs.k8s.io/kustomize/kyaml/openapi" ) var pgr []string @@ -80,7 +81,17 @@ func GetMain() *cobra.Command { ext.GetOpenAPIFile = func(args []string) (s string, err error) { return filepath.Join(args[0], kptfile.KptFileName), nil } - return kptopenapi.ConfigureOpenAPI(f, cmdutil.K8sSchemaSource, cmdutil.K8sSchemaPath) + err := kptopenapi.ConfigureOpenAPI(f, cmdutil.K8sSchemaSource, cmdutil.K8sSchemaPath) + if err != nil { + return err + } + + // add openAPI definitions from Kptfile to configured openAPI + if addErr := openapi.AddSchemaFromFile(filepath.Join(args[0], kptfile.KptFileName)); addErr != nil { + // do not throw error if schema doesn't exist or not readable from Kptfile + return nil + } + return nil } cmd.Flags().BoolVar(&installComp, "install-completion", false,