You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: no plugin could be resolved with key "go/v4-alpha" (plugin version is unstable, there may be an upgrade available: https://kubebuilder.io/migration/plugin/plugins.html)
Usage:
operator-sdk [flags]
Examples:
The first step is to initialize your project:
operator-sdk init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]
<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table
and <PROJECT VERSION> a supported project version for these plugins.
Plugin keys | Supported project versions
-----------------------------------------------+----------------------------
ansible.sdk.operatorframework.io/v1 | 3
declarative.go.kubebuilder.io/v1 | 2, 3
deploy-image.go.kubebuilder.io/v1-alpha | 3
go.kubebuilder.io/v2 | 2, 3
go.kubebuilder.io/v3 | 3
go.kubebuilder.io/v4 | 3
grafana.kubebuilder.io/v1-alpha | 3
helm.sdk.operatorframework.io/v1 | 3
hybrid.helm.sdk.operatorframework.io/v1-alpha | 3
quarkus.javaoperatorsdk.io/v1-beta | 3
For more specific help for the init command of a certain plugins and project version
configuration please run:
operator-sdk init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]
Default plugin keys: "go.kubebuilder.io/v4"
Default project version: "3"
Flags:
-h, --help help for operator-sdk
--plugins strings plugin keys to be used for this subcommand execution
--project-version string project version (default "3")
FATA[0000] no plugin could be resolved with key "go/v4-alpha" (plugin version is unstable, there may be an upgrade available: https://kubebuilder.io/migration/plugin/plugins.html)
seems like plugin go/v4-alpha is not supported.
When I checked kubebuilder's plugin page I don't see that plugin "go/v4-alpha" instead I see "go/v4" which is default so, I run following command
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: example.com
layout:
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: memcached-operator
repo: github.com/harshvijaythakkar/sample-memcached-operator
version: "3"
But now when I run operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller command it failing with FATA[0005] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2. The detailed output is as follows
INFO[0000] Writing kustomize manifests for you to edit...
INFO[0000] Writing scaffold for you to edit...
INFO[0000] api/v1alpha1/memcached_types.go
INFO[0000] api/v1alpha1/groupversion_info.go
INFO[0000] internal/controller/suite_test.go
INFO[0000] internal/controller/memcached_controller.go
INFO[0000] internal/controller/memcached_controller_test.go
INFO[0000] Update dependencies:
$ go mod tidy
INFO[0000] Running make:
$ make generate
mkdir -p /Users/thakkarh/Desktop/learn-go/memcached-operator/bin
test -s /Users/thakkarh/Desktop/learn-go/memcached-operator/bin/controller-gen && /Users/thakkarh/Desktop/learn-go/memcached-operator/bin/controller-gen --version | grep -q v0.13.0 || \
GOBIN=/Users/thakkarh/Desktop/learn-go/memcached-operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
/Users/thakkarh/Desktop/learn-go/memcached-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10358cfb0]
goroutine 179 [running]:
go/types.(*Checker).handleBailout(0x14000abc800, 0x1400004bd18)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/check.go:367 +0x9c
panic({0x103865a60?, 0x103e00af0?})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x103930990, 0x103e092e0})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/sizes.go:228 +0x320
go/types.(*Config).sizeof(...)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x103930990?, 0x103e092e0?})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x103936c30, 0x103dd4240}, 0x14000abc800, 0x103e092e0, 0x0)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/const.go:92 +0x138
go/types.(*Checker).arrayLength(0x14000abc800, {0x103934f78, 0x140012cb880?})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:510 +0x238
go/types.(*Checker).typInternal(0x14000abc800, {0x103933598, 0x140012e9830}, 0x0)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:299 +0x3bc
go/types.(*Checker).definedType(0x14000abc800, {0x103933598, 0x140012e9830}, 0x103004bac?)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).varType(0x14000abc800, {0x103933598, 0x140012e9830})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:145 +0x2c
go/types.(*Checker).structType(0x14000abc800, 0x140011759b0, 0x140011759b0?)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/struct.go:113 +0x128
go/types.(*Checker).typInternal(0x14000abc800, {0x103933508, 0x140012b3398}, 0x1400117f860)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:316 +0xed0
go/types.(*Checker).definedType(0x14000abc800, {0x103933508, 0x140012b3398}, 0x1036a14e8?)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).typeDecl(0x14000abc800, 0x1400117f860, 0x140012ccdc0, 0x0)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/decl.go:615 +0x39c
go/types.(*Checker).objDecl(0x14000abc800, {0x10393ba98, 0x1400117f860}, 0x0)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/decl.go:197 +0x880
go/types.(*Checker).packageObjects(0x14000abc800)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/resolver.go:681 +0x3c0
go/types.(*Checker).checkFiles(0x14000abc800, {0x14000f5c9f0, 0x3, 0x3})
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
/opt/homebrew/Cellar/go/1.22.0/libexec/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0x140002d53b0, 0x14000196b60)
/Users/thakkarh/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:286 +0x2d8
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0x14000196b60)
/Users/thakkarh/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:99 +0x44
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0x140002fd1d0, 0x14000196b60)
/Users/thakkarh/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:268 +0x304
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x4c?)
/Users/thakkarh/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:262 +0x58
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 162
/Users/thakkarh/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x230
make: *** [generate] Error 2
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2
Usage:
operator-sdk create api [flags]
Examples:
# Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate
operator-sdk create api --group ship --version v1beta1 --kind Frigate
# Edit the API Scheme
nano api/v1beta1/frigate_types.go
# Edit the Controller
nano internal/controller/frigate/frigate_controller.go
# Edit the Controller Test
nano internal/controller/frigate/frigate_controller_test.go
# Generate the manifests
make manifests
# Install CRDs into the Kubernetes cluster using kubectl apply
make install
# Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
make run
Flags:
--controller if set, generate the controller without prompting the user (default true)
--force attempt to create resource even if it already exists
--group string resource Group
-h, --help help for api
--kind string resource Kind
--make make generate if true, run make generate after generating files (default true)
--namespaced resource is namespaced (default true)
--plural string resource irregular plural form
--resource if set, generate the resource without prompting the user (default true)
--version string resource Version
Global Flags:
--plugins strings plugin keys to be used for this subcommand execution
--verbose Enable verbose logging
FATA[0005] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2
The text was updated successfully, but these errors were encountered:
harshvijaythakkar
changed the title
Go Operator Tutorial: Document pointing to wrong file location
Go Operator Tutorial: Not able to create Initial Project
Mar 5, 2024
I am following Go Operator Tutorial and I am facing following issue
Go Version
go version go1.22.0 darwin/arm64
Issue-1:
My local environment is Apple Silicon
(darwin/arm64)
When I run following commandIt is giving following error
seems like plugin
go/v4-alpha
is not supported.When I checked kubebuilder's plugin page I don't see that plugin "go/v4-alpha" instead I see "go/v4" which is default so, I run following command
My
PROJECT
file looks something like thisBut now when I run
operator-sdk create api --group cache --version v1alpha1 --kind Memcached --resource --controller
command it failing withFATA[0005] failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2
. The detailed output is as followsThe text was updated successfully, but these errors were encountered: