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

deps: bump kubebuilder to v3.0.0-beta.1 #4581

Merged
merged 1 commit into from
Mar 24, 2021
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
rsc.io/letsencrypt v0.0.3 // indirect
sigs.k8s.io/controller-runtime v0.8.2
sigs.k8s.io/controller-tools v0.5.0
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210318180717-646f742d9407
sigs.k8s.io/kubebuilder/v3 v3.0.0-beta.1
sigs.k8s.io/yaml v1.2.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,8 @@ sigs.k8s.io/controller-tools v0.4.1 h1:VkuV0MxlRPmRu5iTgBZU4UxUX2LiR99n3sdQGRxZF
sigs.k8s.io/controller-tools v0.4.1/go.mod h1:G9rHdZMVlBDocIxGkK3jHLWqcTMNvveypYJwrvYKjWU=
sigs.k8s.io/controller-tools v0.5.0 h1:3u2RCwOlp0cjCALAigpOcbAf50pE+kHSdueUosrC/AE=
sigs.k8s.io/controller-tools v0.5.0/go.mod h1:JTsstrMpxs+9BUj6eGuAaEb6SDSPTeVtUyp0jmnAM/I=
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210318180717-646f742d9407 h1:t0QuAKNpt3NEcQFoKtAjGlcvOYWA7OY34ozN81xrKlY=
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210318180717-646f742d9407/go.mod h1:eVtLdWzmvL1ixDYLlVrvQe8wjpikJVoSOg5PghTk2Lw=
sigs.k8s.io/kubebuilder/v3 v3.0.0-beta.1 h1:WGYvUPZ5tVrAOgvGW/NEqOXV2uYtplB6hJ/SFndrvIc=
sigs.k8s.io/kubebuilder/v3 v3.0.0-beta.1/go.mod h1:eVtLdWzmvL1ixDYLlVrvQe8wjpikJVoSOg5PghTk2Lw=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/kustomize/kyaml v0.10.10 h1:caAxDDkaXZp+0kDsZVik4leFJV8LCy09PdVqpaoNeF4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
func (mh *MemcachedGoWithWebhooks) Run() {
log.Infof("creating the project")
err := mh.ctx.Init(
"--project-version", "3",
"--plugins", "go/v2",
"--project-version", "3",
"--repo", "github.com/example/memcached-operator",
"--domain",
mh.ctx.Domain)
"--domain", mh.ctx.Domain)
pkg.CheckError("creating the project", err)

err = mh.ctx.CreateAPI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
func (mh *MemcachedGoWithWebhooks) Run() {
log.Infof("creating the project")
err := mh.ctx.Init(
"--project-version", "3",
"--plugins", "go/v3",
"--project-version", "3",
"--repo", "github.com/example/memcached-operator",
"--domain",
mh.ctx.Domain)
"--domain", mh.ctx.Domain)
pkg.CheckError("creating the project", err)

err = mh.ctx.CreateAPI(
Expand Down
44 changes: 35 additions & 9 deletions internal/cmd/operator-sdk/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import (
"sigs.k8s.io/kubebuilder/v3/pkg/cli"
cfgv2 "sigs.k8s.io/kubebuilder/v3/pkg/config/v2"
cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3"
"sigs.k8s.io/kubebuilder/v3/pkg/plugin"
golangv2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2"
golangv3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"

"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/alpha/config3alphato3"
"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle"
Expand All @@ -30,10 +33,12 @@ import (
"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run"
"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/scorecard"
"github.com/operator-framework/operator-sdk/internal/flags"
"github.com/operator-framework/operator-sdk/internal/plugins"
ansiblev1 "github.com/operator-framework/operator-sdk/internal/plugins/ansible/v1"
golangv2 "github.com/operator-framework/operator-sdk/internal/plugins/golang/v2"
golangv3 "github.com/operator-framework/operator-sdk/internal/plugins/golang/v3"
envtestv1 "github.com/operator-framework/operator-sdk/internal/plugins/envtest/v1"
helmv1 "github.com/operator-framework/operator-sdk/internal/plugins/helm/v1"
manifestsv2 "github.com/operator-framework/operator-sdk/internal/plugins/manifests/v2"
scorecardv2 "github.com/operator-framework/operator-sdk/internal/plugins/scorecard/v2"
"github.com/operator-framework/operator-sdk/internal/util/projutil"
)

Expand All @@ -60,18 +65,39 @@ func Run() error {
// This CLI can run kubebuilder commands and certain SDK specific commands that are aligned for
// the kubebuilder project layout
func GetPluginsCLIAndRoot() (*cli.CLI, *cobra.Command) {
ansibleBundle, _ := plugin.NewBundle("ansible"+plugins.DefaultNameQualifier, plugin.Version{Number: 1},
ansiblev1.Plugin{},
manifestsv2.Plugin{},
scorecardv2.Plugin{},
)
gov2Bundle, _ := plugin.NewBundle(golangv2.Plugin{}.Name(), golangv2.Plugin{}.Version(),
camilamacedo86 marked this conversation as resolved.
Show resolved Hide resolved
estroz marked this conversation as resolved.
Show resolved Hide resolved
golangv2.Plugin{},
envtestv1.Plugin{},
manifestsv2.Plugin{},
scorecardv2.Plugin{},
)
gov3Bundle, _ := plugin.NewBundle(golangv3.Plugin{}.Name(), golangv3.Plugin{}.Version(),
golangv3.Plugin{},
manifestsv2.Plugin{},
scorecardv2.Plugin{},
)
helmBundle, _ := plugin.NewBundle("helm"+plugins.DefaultNameQualifier, plugin.Version{Number: 1},
helmv1.Plugin{},
manifestsv2.Plugin{},
scorecardv2.Plugin{},
)
c, err := cli.New(
cli.WithCommandName("operator-sdk"),
cli.WithVersion(makeVersionString()),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithPlugins(
&golangv2.Plugin{},
&golangv3.Plugin{},
&helmv1.Plugin{},
&ansiblev1.Plugin{},
ansibleBundle,
gov2Bundle,
gov3Bundle,
helmBundle,
),
cli.WithDefaultPlugins(cfgv2.Version, &golangv2.Plugin{}),
cli.WithDefaultPlugins(cfgv3.Version, &golangv3.Plugin{}),
cli.WithDefaultPlugins(cfgv2.Version, gov2Bundle),
cli.WithDefaultPlugins(cfgv3.Version, gov3Bundle),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithExtraCommands(commands...),
cli.WithExtraAlphaCommands(alphaCommands...),
cli.WithCompletion(),
Expand Down
8 changes: 3 additions & 5 deletions internal/cmd/operator-sdk/generate/kustomize/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ import (
"sigs.k8s.io/kubebuilder/v3/pkg/config"
cfgv2 "sigs.k8s.io/kubebuilder/v3/pkg/config/v2"
"sigs.k8s.io/kubebuilder/v3/pkg/machinery"
"sigs.k8s.io/kubebuilder/v3/pkg/model/file"
"sigs.k8s.io/yaml"

genutil "github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/internal"
"github.com/operator-framework/operator-sdk/internal/generate/clusterserviceversion/bases"
manifestsv2 "github.com/operator-framework/operator-sdk/internal/plugins/manifests/v2"
"github.com/operator-framework/operator-sdk/internal/plugins/manifests/v2/templates/config/manifests"
"github.com/operator-framework/operator-sdk/internal/util/k8sutil"
"github.com/operator-framework/operator-sdk/internal/util/projutil"
)
Expand Down Expand Up @@ -183,7 +182,7 @@ func (c manifestsCmd) run(cfg config.Config) error {
}
}

operatorType := projutil.PluginKeyToOperatorType(cfg.GetPluginChain())
operatorType := projutil.PluginChainToOperatorType(cfg.GetPluginChain())
relBasePath := filepath.Join("bases", c.packageName+".clusterserviceversion.yaml")
basePath := filepath.Join(c.inputDir, relBasePath)
gvks, err := getGVKs(cfg)
Expand Down Expand Up @@ -220,8 +219,7 @@ func (c manifestsCmd) run(cfg config.Config) error {
}

// Write a kustomization.yaml to outputDir if one does not exist.
kustomization := manifestsv2.Kustomization{SupportsWebhooks: operatorType == projutil.OperatorTypeGo}
kustomization.IfExistsAction = file.Skip
kustomization := manifests.Kustomization{SupportsWebhooks: operatorType == projutil.OperatorTypeGo}
err = machinery.NewScaffold(machinery.Filesystem{FS: afero.NewOsFs()}, machinery.WithConfig(cfg)).Execute(
&kustomization,
)
Expand Down
68 changes: 0 additions & 68 deletions internal/kubebuilder/cmdutil/cmdutil.go

This file was deleted.

Loading