Skip to content

Commit

Permalink
align the sdk with kb
Browse files Browse the repository at this point in the history
Signed-off-by: Camila Macedo <cmacedo@redhat.com>
  • Loading branch information
Camila Macedo committed Feb 11, 2021
1 parent 2eaca78 commit 5ab84a1
Show file tree
Hide file tree
Showing 230 changed files with 1,170 additions and 832 deletions.
113 changes: 113 additions & 0 deletions changelog/fragments/align-kb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: >
For Go-based operators, migrate your project to use the project version stable.
kind: "change"
breaking: true
migration:
header: For Go-based operators, migrate your project to use the project version stable.
body: >
The PROJECT version config file represents the project configuration. It reach the maturate stability and it will
store the data used to do the scaffolds. The motivation for this behaviour is to allow tools and helpers in the future such as to make easier the process to update the projects to use upper versions.
More info: TBD. //TODO: add link for docs (see the PR kubernetes-sigs/kubebuilder#1916)
- description: >
For Ansible/Helm-based operators, usage of project config stable version.
kind: "change"
breaking: true
migration:
header: For Ansible/Helm-based operators, update the PROJECT file.
body: >
Update the PROJECT file by replacing the `version: 3-alpha` with `version: "3"` and then, for each API scaffolded in your project:
- Add the `- api.crdVersion: <crdVersion>` and `api.namespaced: true`.
- Add the resource `domain` which will be the same value of the project domain unless it is an external type
Ensure that the PROJECT file results are like:
```yml
domain: example.com
projectName: memcached-operator
resources:
- api:
crdVersion: v1
namespaced: true
domain: example.com
group: cache
kind: Memcached
version: v1alpha1
version: "3"
```
- description: >
Add support for markers for files with the `yml` extension. More info: [#kubernetes-sigs/kubebuilder#1907](https://github.com/kubernetes-sigs/kubebuilder/pull/1907).
kind: "addition"
breaking: false
- description: >
(go/v3) Added the `--force` option to the `create webhook` command. More info: [#kubernetes-sigs/kubebuilder#1903](https://github.com/kubernetes-sigs/kubebuilder/pull/1903).
kind: "addition"
breaking: false
- description: >
For Go-based operators, fix `--force` option to recreate the files via `create api` command. More info: [#kubernetes-sigs/kubebuilder#1903](https://github.com/kubernetes-sigs/kubebuilder/pull/1903).
kind: "bugfix"
breaking: false
- description: >
For Go-based operators using go/v3 plugin only, upgrade the sigs.k8s.io/kubebuilder-declarative-pattern dependency (used only to gen api with --pattern=addon). More info: [#kubernetes-sigs/kubebuilder#1946](https://github.com/kubernetes-sigs/kubebuilder/pull/1946).
kind: "change"
breaking: false
- description: >
For Go-based operators, fix the name of the files to be edit in the comments of `[kind]_types.go` files. More info: [#kubernetes-sigs/kubebuilder#1927](https://github.com/kubernetes-sigs/kubebuilder/pull/1927).
kind: "bugfix"
breaking: false
header: Fix the name of the files in the comments on the `<kind>_types.go` files
body: >
When we use `$operator-sdk create api` or `$operator-sdk create webhook`, it generates a file like `[kind]_types.go`. In this file, there is a comment that indicates which file to change when adding a field.
You can update it with the correct value if you wich by replacing the Kind for lower case, such as replace `Edit Memcached_types.go to remove/update` with `Edit memcached_types.go to remove/update`
- description: >
Upgrade the `kube-rbac-proxy` image version from 0.5.0 to 0.8.0 to address security concerns. More info [#kubernetes-sigs/kubebuilder#1955](https://github.com/kubernetes-sigs/kubebuilder/pull/1955).
kind: "bugfix"
breaking: false
header: Upgrade the `kube-rbac-proxy` from 0.5.0 to 0.8.0 to solve security concerns
body: >
In the `config/default/manager_auth_proxy_patch.yaml` file, replace `gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0` with `gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0`.
- description: >
For Go-based operators, fix the endpoint names. More info [#kubernetes-sigs/kubebuilder#1910](https://github.com/kubernetes-sigs/kubebuilder/pull/1910).
kind: "bugfix"
breaking: false
header: For Go-based operators, fix the endpoint names
body: >
In the `main.go` file, replace `health` with `healthz` and `ready` with `readyz` then, it would look like:
```go
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up ready check")
os.Exit(1)
}
```
- description: >
For Go-based operators, add `ErrorIfCRDPathMissing` config by default to the `suite_tests.go`. More info [#kubernetes-sigs/kubebuilder#1910](https://github.com/kubernetes-sigs/kubebuilder/pull/1910).
kind: "addition"
breaking: false
header: For Go-based operators, add `ErrorIfCRDPathMissing` config option if please you.
body: >
In the `controllers/<kind>/suite_test.go` file(s), add the option `ErrorIfCRDPathMissing` to raise an issue if the CRDs path be missing which would like:
```go
By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: true,
}
```
- description: >
Allows initialize the projects with directories with `.`(dot) prefix names. More info [#kubernetes-sigs/kubebuilder#1944](https://github.com/kubernetes-sigs/kubebuilder/pull/1944).
kind: "bugfix"
breaking: false
- description: >
For Go-based operators, add Makefile help
kind: "change"
breaking: false
- description: >
For Go-based operators, Makefile scaffold was improved
kind: "change"
breaking: false
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
rsc.io/letsencrypt v0.0.3 // indirect
sigs.k8s.io/controller-runtime v0.8.0
sigs.k8s.io/controller-tools v0.4.1
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201214213149-0a807f4e9428
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210211121616-05abe25e7215
sigs.k8s.io/yaml v1.2.0
)

Expand Down
8 changes: 5 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
Expand Down Expand Up @@ -1318,6 +1320,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down Expand Up @@ -1457,13 +1460,12 @@ sigs.k8s.io/controller-runtime v0.8.0/go.mod h1:v9Lbj5oX443uR7GXYY46E0EE2o7k2YxQ
sigs.k8s.io/controller-tools v0.3.0/go.mod h1:enhtKGfxZD1GFEoMgP8Fdbu+uKQ/cq1/WGJhdVChfvI=
sigs.k8s.io/controller-tools v0.4.1 h1:VkuV0MxlRPmRu5iTgBZU4UxUX2LiR99n3sdQGRxZF4w=
sigs.k8s.io/controller-tools v0.4.1/go.mod h1:G9rHdZMVlBDocIxGkK3jHLWqcTMNvveypYJwrvYKjWU=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201214213149-0a807f4e9428 h1:VUvP/g8pDUdqBHgKPoSX6WA/ZH1Y1+FBOk7khgyTLJw=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201214213149-0a807f4e9428/go.mod h1:J/D/179LBZhQOhRvmMRNbje/Bk+PjbN0/fzUupmO7+U=
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210211121616-05abe25e7215 h1:pwEHSu3/ODNEr33DNrKt2DovGV84LhRBLt4QyrT6FJA=
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210211121616-05abe25e7215/go.mod h1:b1WkCy5t/3VSRBCffSfPV1WbH+f45ls69d4ic37sW6w=
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/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1 h1:YXTMot5Qz/X1iBRJhAt+vI+HVttY0WkSqqhKxQ0xVbA=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 h1:YHQV7Dajm86OuqnIR6zAelnDWBRjo+YhYV9PmGrh1s8=
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
Expand Down
6 changes: 3 additions & 3 deletions hack/generate/samples/internal/ansible/advanced_molecule.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"

log "github.com/sirupsen/logrus"
kbtestutils "sigs.k8s.io/kubebuilder/v2/test/e2e/utils"
kbtestutils "sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/pkg"
"github.com/operator-framework/operator-sdk/internal/testutils"
Expand Down Expand Up @@ -145,10 +145,10 @@ func (ma *AdvancedMolecule) updateConfig() {
- patch
- update
- watch
# +kubebuilder:scaffold:rules`
#+kubebuilder:scaffold:rules`
err := testutils.ReplaceInFile(
filepath.Join(ma.ctx.Dir, "config", "rbac", "role.yaml"),
"# +kubebuilder:scaffold:rules",
"#+kubebuilder:scaffold:rules",
cmRolesFragment)
pkg.CheckError("adding customized roles", err)

Expand Down
2 changes: 1 addition & 1 deletion hack/generate/samples/internal/ansible/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,5 @@ const rolesForBaseOperator = `
- patch
- update
- watch
# +kubebuilder:scaffold:rules
#+kubebuilder:scaffold:rules
`
2 changes: 1 addition & 1 deletion hack/generate/samples/internal/ansible/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strings"

log "github.com/sirupsen/logrus"
kbtestutils "sigs.k8s.io/kubebuilder/v2/test/e2e/utils"
kbtestutils "sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/pkg"
"github.com/operator-framework/operator-sdk/internal/testutils"
Expand Down
4 changes: 2 additions & 2 deletions hack/generate/samples/internal/ansible/memcached_molecule.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"path/filepath"
"strings"

kbtestutils "sigs.k8s.io/kubebuilder/v2/test/e2e/utils"
kbtestutils "sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/pkg"
"github.com/operator-framework/operator-sdk/internal/testutils"
Expand Down Expand Up @@ -81,7 +81,7 @@ func (ma *MoleculeAnsible) Run() {

log.Infof("adding RBAC permissions")
err = testutils.ReplaceInFile(filepath.Join(ma.ctx.Dir, "config", "rbac", "role.yaml"),
"# +kubebuilder:scaffold:rules", rolesForBaseOperator)
"#+kubebuilder:scaffold:rules", rolesForBaseOperator)
pkg.CheckError("replacing in role.yml", err)

log.Infof("adding Memcached mock task to the role with black list")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
playbook: playbooks/reconciliationtest.yml
vars:
meta: '{{ ansible_operator_meta }}'
# +kubebuilder:scaffold:watch
#+kubebuilder:scaffold:watch
14 changes: 7 additions & 7 deletions hack/generate/samples/internal/go/v2/memcached_with_webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"

log "github.com/sirupsen/logrus"
kbtestutils "sigs.k8s.io/kubebuilder/v2/test/e2e/utils"
kbtestutils "sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/pkg"
"github.com/operator-framework/operator-sdk/internal/testutils"
Expand Down Expand Up @@ -59,8 +59,7 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
func (mh *MemcachedGoWithWebhooks) Run() {
log.Infof("creating the project")
err := mh.ctx.Init(
// TODO(estroz): change this to 3 when stabilized.
"--project-version", "3-alpha",
"--project-version", "3",
"--plugins", "go/v2",
"--repo", "github.com/example/memcached-operator",
"--domain",
Expand Down Expand Up @@ -231,6 +230,7 @@ func (mh *MemcachedGoWithWebhooks) implementingController() {
pkg.CheckError("replacing reconcile", err)
}

// nolint:gosec
// implementingAPI will customize the API
func (mh *MemcachedGoWithWebhooks) implementingAPI() {
typeFilePath := filepath.Join(mh.ctx.Dir, "api", mh.ctx.Version, fmt.Sprintf("%s_types.go", strings.ToLower(mh.ctx.Kind)))
Expand Down Expand Up @@ -278,9 +278,9 @@ func GenerateMemcachedGoWithWebhooksSample(samplesPath string) {
}

const rbacFragment = `
// +kubebuilder:rbac:groups=cache.example.com,resources=memcacheds/finalizers,verbs=update
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;`
//+kubebuilder:rbac:groups=cache.example.com,resources=memcacheds/finalizers,verbs=update
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;`

const reconcileFragment = `// Fetch the Memcached instance
memcached := &cachev1alpha1.Memcached{}
Expand Down Expand Up @@ -433,7 +433,7 @@ const watchCustomizedFragment = `return ctrl.NewControllerManagedBy(mgr).

const webhooksFragment = `
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:verbs=create;update,path=/validate-cache-example-com-v1alpha1-memcached,mutating=false,failurePolicy=fail,groups=cache.example.com,resources=memcacheds,versions=v1alpha1,name=vmemcached.kb.io
//+kubebuilder:webhook:verbs=create;update,path=/validate-cache-example-com-v1alpha1-memcached,mutating=false,failurePolicy=fail,groups=cache.example.com,resources=memcacheds,versions=v1alpha1,name=vmemcached.kb.io
var _ webhook.Validator = &Memcached{}
Expand Down
12 changes: 6 additions & 6 deletions hack/generate/samples/internal/go/v3/memcached_with_webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"

log "github.com/sirupsen/logrus"
kbtestutils "sigs.k8s.io/kubebuilder/v2/test/e2e/utils"
kbtestutils "sigs.k8s.io/kubebuilder/v3/test/e2e/utils"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/pkg"
"github.com/operator-framework/operator-sdk/internal/testutils"
Expand Down Expand Up @@ -59,8 +59,7 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
func (mh *MemcachedGoWithWebhooks) Run() {
log.Infof("creating the project")
err := mh.ctx.Init(
// TODO(estroz): change this to 3 when stabilized.
"--project-version", "3-alpha",
"--project-version", "3",
"--plugins", "go/v3",
"--repo", "github.com/example/memcached-operator",
"--domain",
Expand Down Expand Up @@ -229,6 +228,7 @@ func (mh *MemcachedGoWithWebhooks) implementingController() {
pkg.CheckError("replacing reconcile", err)
}

// nolint:gosec
// implementingAPI will customize the API
func (mh *MemcachedGoWithWebhooks) implementingAPI() {
err := kbtestutils.InsertCode(
Expand Down Expand Up @@ -273,8 +273,8 @@ func GenerateMemcachedGoWithWebhooksSample(samplesPath string) {
}

const rbacFragment = `
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;`
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;`

const reconcileFragment = `// Fetch the Memcached instance
memcached := &cachev1alpha1.Memcached{}
Expand Down Expand Up @@ -427,7 +427,7 @@ const watchCustomizedFragment = `return ctrl.NewControllerManagedBy(mgr).

const webhooksFragment = `
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:path=/validate-cache-example-com-v1alpha1-memcached,mutating=false,failurePolicy=fail,sideEffects=None,groups=cache.example.com,resources=memcacheds,verbs=create;update,versions=v1alpha1,name=vmemcached.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/validate-cache-example-com-v1alpha1-memcached,mutating=false,failurePolicy=fail,sideEffects=None,groups=cache.example.com,resources=memcacheds,verbs=create;update,versions=v1alpha1,name=vmemcached.kb.io,admissionReviewVersions={v1,v1beta1}
var _ webhook.Validator = &Memcached{}
Expand Down
4 changes: 2 additions & 2 deletions hack/generate/samples/internal/helm/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (mh *MemcachedHelm) Run() {

log.Infof("adding customized roles")
err = testutils.ReplaceInFile(filepath.Join(mh.ctx.Dir, "config", "rbac", "role.yaml"),
"# +kubebuilder:scaffold:rules", policyRolesFragment)
"#+kubebuilder:scaffold:rules", policyRolesFragment)
pkg.CheckError("adding customized roles", err)

log.Infof("creating the bundle")
Expand Down Expand Up @@ -151,5 +151,5 @@ const policyRolesFragment = `
- update
- watch
# +kubebuilder:scaffold:rules
#+kubebuilder:scaffold:rules
`
19 changes: 10 additions & 9 deletions internal/cmd/operator-sdk/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
package cli

import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"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"

"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle"
"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cleanup"
"github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/completion"
Expand All @@ -28,12 +35,6 @@ import (
golangv3 "github.com/operator-framework/operator-sdk/internal/plugins/golang/v3"
helmv1 "github.com/operator-framework/operator-sdk/internal/plugins/helm/v1"
"github.com/operator-framework/operator-sdk/internal/util/projutil"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"sigs.k8s.io/kubebuilder/v2/pkg/cli"
"sigs.k8s.io/kubebuilder/v2/pkg/model/config"
)

var commands = []*cobra.Command{
Expand All @@ -58,15 +59,15 @@ func GetPluginsCLIAndRoot() (cli.CLI, *cobra.Command) {
c, err := cli.New(
cli.WithCommandName("operator-sdk"),
cli.WithVersion(makeVersionString()),
cli.WithDefaultProjectVersion(config.Version3Alpha),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithPlugins(
&golangv2.Plugin{},
&golangv3.Plugin{},
&helmv1.Plugin{},
&ansiblev1.Plugin{},
),
cli.WithDefaultPlugins(config.Version2, &golangv2.Plugin{}),
cli.WithDefaultPlugins(config.Version3Alpha, &golangv3.Plugin{}),
cli.WithDefaultPlugins(cfgv2.Version, &golangv2.Plugin{}),
cli.WithDefaultPlugins(cfgv3.Version, &golangv3.Plugin{}),
cli.WithExtraCommands(commands...),
)
if err != nil {
Expand Down
Loading

0 comments on commit 5ab84a1

Please sign in to comment.