Skip to content

Commit

Permalink
Inherit setter values from parent package
Browse files Browse the repository at this point in the history
  • Loading branch information
phanimarupaka committed Oct 22, 2020
1 parent a3a2039 commit 42a5488
Show file tree
Hide file tree
Showing 10 changed files with 710 additions and 70 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ require (
// Once there is a 0.18 release, we can import a semver release.
k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd
sigs.k8s.io/cli-utils v0.20.7-0.20201016204101-35a4eb0f63f9
sigs.k8s.io/kustomize/cmd/config v0.8.3
sigs.k8s.io/kustomize/kyaml v0.9.2
sigs.k8s.io/kustomize/cmd/config v0.8.4-0.20201022184337-55b4448862b7
sigs.k8s.io/kustomize/kyaml v0.9.3-0.20201022184337-55b4448862b7
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,12 @@ 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.8.3 h1:enT5nNDHht+stIsxt8LC4LyNfT3oUoxT6Iiu8NB6neY=
sigs.k8s.io/kustomize/cmd/config v0.8.3/go.mod h1:c7sIYoV9UOfM9tkVTOCNE8ycUMloWrUoaZp+kOuf+kc=
sigs.k8s.io/kustomize/cmd/config v0.8.4-0.20201022184337-55b4448862b7 h1:X3FMOWGdMnCrEP6f0IrjtsZlSVbKi7PzC3OcayLuHb4=
sigs.k8s.io/kustomize/cmd/config v0.8.4-0.20201022184337-55b4448862b7/go.mod h1:NgL9AMLDYJ+ju+D1OIB4SjH8Rq/y52hNsdLakEq0m8U=
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
sigs.k8s.io/kustomize/kyaml v0.9.3-0.20201022184337-55b4448862b7 h1:Ivr+7ZwKizIY3K1NE9ybFhmyoghJPyCc5TNBccTlO8Q=
sigs.k8s.io/kustomize/kyaml v0.9.3-0.20201022184337-55b4448862b7/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
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=
Expand Down
6 changes: 5 additions & 1 deletion internal/cmdget/cmdget.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ func (r *Runner) runE(c *cobra.Command, args []string) error {
}

if r.AutoSet {
if err := setters.PerformAutoSetters(r.Get.Destination); err != nil {
a := setters.AutoSet{
Writer: c.OutOrStdout(),
PackagePath: r.Get.Destination,
}
if err := a.PerformAutoSetters(); err != nil {
return err
}
}
Expand Down
4 changes: 4 additions & 0 deletions internal/cmdupdate/cmdupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func NewRunner(parent string) *Runner {
strings.Join(update.Strategies, ","))
c.Flags().BoolVar(&r.Update.DryRun, "dry-run", false,
"print the git patch rather than merging it.")
c.Flags().BoolVar(&r.AutoSet, "auto-set", true,
"automatically perform setters based off the environment")
c.Flags().BoolVar(&r.Update.Verbose, "verbose", false,
"print verbose logging information.")
cmdutil.FixDocs("kpt", parent, c)
Expand All @@ -62,6 +64,7 @@ func NewCommand(parent string) *cobra.Command {
// TODO, support listing versions
type Runner struct {
strategy string
AutoSet bool
Update update.Command
Command *cobra.Command
}
Expand All @@ -76,6 +79,7 @@ func (r *Runner) preRunE(c *cobra.Command, args []string) error {
if len(parts) > 1 {
r.Update.Ref = parts[1]
}
r.Update.AutoSet = r.AutoSet

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/util/openapi/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ func ConfigureOpenAPISchema(openAPISchema []byte) error {
// of where we got the Kubernetes openAPI schema.
// TODO: Refactor the openapi package in kyaml so we don't need to
// know the name of the kustomize asset here.
return openapi.AddSchema(kustomizationapi.MustAsset("openapi/kustomizationapi/swagger.json"))
return openapi.AddSchema(kustomizationapi.MustAsset("kustomizationapi/swagger.json"))
}
Loading

0 comments on commit 42a5488

Please sign in to comment.