There’s not a huge difference between the Go projects that kubebuilder and operator-sdk scaffold. Both use controller-tools and controller-runtime and both scaffold substantially similar go package structures.
Where they differ is:
Operator SDK also has support for Ansible and Helm operators, which make it easy to write operators without having to learn Go and if you already have experience with Ansible or Helm
Operator SDK includes integrations with the Operator Lifecycle Manager (OLM), which is a key component of the Operator Framework that is important to Day 2 cluster operations, like managing a live upgrade of your operator.
Operator SDK includes a scorecard subcommand that helps you understand if your operator follows best practices.
Operator SDK includes an e2e testing framework that simplifies testing your operator against an actual cluster.
Kubebuilder includes an envtest package that allows operator developers to run simple tests with a standalone etcd and apiserver.
Kubebuilder scaffolds a Makefile to assist users in operator tasks (build, test, run, code generation, etc.); Operator SDK is currently using built-in subcommands. Each has pros and cons. The SDK team will likely be migrating to a Makefile-based approach in the future.
Kubebuilder uses Kustomize to build deployment manifests; Operator SDK uses static files with placeholders.
Kubebuilder has recently improved its support for admission and CRD conversion webhooks, which has not yet made it into SDK.
The SDK and Kubebuilder teams work closely together, and we’re planning to increase our efforts to help the kubebuilder team maintain controller-tools and controller-runtime so that the entire community has access to the latest features and bug fixes.
Kubebuilder
1 2 3 4 5 6 7 8 9
$ kubebuilder init --domain test.com Writing kustomize manifests for you to edit... Writing scaffold for you to edit... Get controller runtime: $ go get sigs.k8s.io/controller-runtime@v0.10.0 Update dependencies: $ go mod tidy Next: define a resource with: $ kubebuilder create api
$ kubebuilder create api --group devops --version v1 --kind Cluster Create Resource [y/n] y Create Controller [y/n] y Writing kustomize manifests for you to edit... Writing scaffold for you to edit... api/v1/cluster_types.go controllers/cluster_controller.go Update dependencies: $ go mod tidy Running make: $ make generate go: creating new go.mod: module tmp Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 go get: installing executables with 'go get' in module mode is deprecated. To adjust and download dependencies of the current module, use 'go get -d'. To install using requirements of the current module, use 'go install'. To install ignoring the current module, use 'go install' with a version, like 'go install example.com/cmd@latest'. For more information, see https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'. go get: added github.com/fatih/color v1.12.0 go get: added github.com/go-logr/logr v0.4.0 go get: added github.com/gobuffalo/flect v0.2.3 go get: added github.com/gogo/protobuf v1.3.2 go get: added github.com/google/go-cmp v0.5.6 go get: added github.com/google/gofuzz v1.1.0 go get: added github.com/inconshreveable/mousetrap v1.0.0 go get: added github.com/json-iterator/go v1.1.11 go get: added github.com/mattn/go-colorable v0.1.8 go get: added github.com/mattn/go-isatty v0.0.12 go get: added github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd go get: added github.com/modern-go/reflect2 v1.0.1 go get: added github.com/spf13/cobra v1.2.1 go get: added github.com/spf13/pflag v1.0.5 go get: added golang.org/x/mod v0.4.2 go get: added golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 go get: added golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 go get: added golang.org/x/text v0.3.6 go get: added golang.org/x/tools v0.1.5 go get: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 go get: added gopkg.in/inf.v0 v0.9.1 go get: added gopkg.in/yaml.v2 v2.4.0 go get: added gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b go get: added k8s.io/api v0.22.2 go get: added k8s.io/apiextensions-apiserver v0.22.2 go get: added k8s.io/apimachinery v0.22.2 go get: added k8s.io/klog/v2 v2.9.0 go get: added k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a go get: added sigs.k8s.io/controller-tools v0.7.0 go get: added sigs.k8s.io/structured-merge-diff/v4 v4.1.2 go get: added sigs.k8s.io/yaml v1.2.0 /Users/flynn/go/src/test.com/cluster-manager/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." Next: implement your new API and generate the manifests (e.g. CRDs,CRs) with: $ make manifests