Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed version of sigs.k8s.io/kubebuilder-declarative-pattern which should be used #1527

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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