kubernetes: failed to run `update-codegen.sh`

What happened?

~# make update SILENT=false
Running in short-circuit mode; run with FORCE_ALL=true to force all scripts to run.
Running update-go-workspace
Running update-codegen
+++ [0403 16:52:58] Generating protobufs for 68 targets
unknown flag: --output-dir
Usage of go-to-protobuf:
      --add_dir_header                   If true, adds the file directory to the header of the log messages
      --alsologtostderr                  log to standard error as well as files (no effect when -logtostderr=true)
      --apimachinery-packages string     comma-separated list of directories to get apimachinery input types from which are needed by any API. Directories prefixed with '-' are not generated, directories prefixed with '+' only create types with explicit IDL instructions. (default "+k8s.io/apimachinery/pkg/util/intstr,+k8s.io/apimachinery/pkg/api/resource,+k8s.io/apimachinery/pkg/runtime/schema,+k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/apis/meta/v1beta1,k8s.io/apimachinery/pkg/apis/testapigroup/v1")
      --clean                            If true, remove all generated files for the specified Packages.
      --conditional string               An optional Golang build tag condition to add to the generated Go code
      --drop-embedded-fields string      Comma-delimited list of embedded Go types to omit from generated protobufs (default "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta")
  -h, --go-header-file string            File containing boilerplate header text. The string YEAR will be replaced with the current 4-digit year.
      --keep-gogoproto                   If true, the generated IDL will contain gogoprotobuf extensions which are normally removed
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory (no effect when -logtostderr=true)
      --log_file string                  If non-empty, use this log file (no effect when -logtostderr=true)
      --log_file_max_size uint           Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --logtostderr                      log to standard error instead of files (default true)
      --one_output                       If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)
      --only-idl                         If true, only generate the IDL for each package.
  -o, --output-base string               Output base; defaults to $GOPATH/src/ (default "/Users/cyclinder/Desktop/code/kubernetes/_output/local/go/src")
  -p, --packages string                  comma-separated list of directories to get input types from. Directories prefixed with '-' are not generated, directories prefixed with '+' only create types with explicit IDL instructions.
      --proto-import strings             The search path for the core protobuf .protos, required; defaults $GOPATH/src/k8s.io/kubernetes/vendor/github.com/gogo/protobuf/protobuf. (default [/Users/cyclinder/Desktop/code/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/gogo/protobuf/protobuf])
      --skip-generated-rewrite           If true, skip fixing up the generated.pb.go file (debugging only).
      --skip_headers                     If true, avoid header prefixes in the log messages
      --skip_log_headers                 If true, avoid headers when opening log files (no effect when -logtostderr=true)
      --stderrthreshold severity         logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=false) (default 2)
      --trim-path-prefix string          If set, trim the specified prefix from --output-package when generating files.
  -v, --v Level                          number for the log level verbosity (default 0)
      --vendor-output-base string        The vendor/ directory to look for packages in; defaults to $PWD/vendor/. (default "/Users/cyclinder/Desktop/code/kubernetes/vendor")
      --verify-only                      If true, only verify existing output, do not write anything.
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging
unknown flag: --output-dir
!!! [0403 16:53:00] Call tree:
!!! [0403 16:53:00]  1: /Users/cyclinder/Desktop/code/kubernetes/hack/update-codegen.sh:885 codegen::protobuf(...)
Running update-codegen FAILED
make: *** [update] Error 1
~# protoc --version
libprotoc 23.4

What did you expect to happen?

make update works

How can we reproduce it (as minimally and precisely as possible)?

~# ./hack/install-protoc.sh
~# export PATH="/Users/cyclinder/Desktop/code/kubernetes/third_party/protoc:${PATH}"
~# make update SILENT=false

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
# paste output here

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

That error looks unrelated, can you file another issue with details like the what version you’re developing?

go workspaces should be handling this https://groups.google.com/a/kubernetes.io/g/dev/c/HjYciF1AJgI/m/kKBRpPgRBAAJ