Skip to content

Commit

Permalink
fix:fixed version of sigs.k8s.io/kubebuilder-declarative-pattern whic…
Browse files Browse the repository at this point in the history
…h should be used
  • Loading branch information
camilamacedo86 committed May 29, 2020
1 parent 9eb8673 commit 0bf5703
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/plugin/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ func (p *createAPIPlugin) GetScaffolder() (scaffold.Scaffolder, error) {
}

func (p *createAPIPlugin) PostScaffold() error {
// Load the requested plugins
switch strings.ToLower(p.pattern) {
case "":
// Default pattern
case "addon":
// Ensure that we are pinning sigs.k8s.io/kubebuilder-declarative-pattern version
err := internal.RunCmd("Get controller runtime", "go", "get",
"sigs.k8s.io/kubebuilder-declarative-pattern@"+scaffold.KbDeclarativePattern)
if err != nil {
return err
}
default:
return fmt.Errorf("unknown pattern %q", p.pattern)
}

if p.runMake {
return internal.RunCmd("Running make", "make")
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/scaffold/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
"sigs.k8s.io/kubebuilder/pkg/scaffold/internal/templates/crd"
)

// (used only to gen api with --pattern=addon)
// KbDeclarativePattern is the sigs.k8s.io/kubebuilder-declarative-pattern version
const KbDeclarativePattern = "v0.0.0-20200522144838-848d48e5b073"

var _ Scaffolder = &apiScaffolder{}

// apiScaffolder contains configuration for generating scaffolding for Go type
Expand Down

0 comments on commit 0bf5703

Please sign in to comment.