kubernetes/hack
Tim Hockin 7afaf23b01
Copy make's codegen logic to update-codegen.sh
The `make` rules which auto-generate some of our API stuff are
incredibly baroque, and hard to maintain.  They were originally added on
the assumption that we would stop checking generated files into git.
Since then we have moved away from that goal, and the worst problems
with generated files have been resolved.

Reasons to kill this:
* It is slow on every build, as opposed to just being slow when running
  the generators.  It is even slow to calculate that there's nothing to
  update.
* Most development work doesn't involve changing APIs.
* It only covers about half (or less) of the generated code, and making
  it cover more would be even slower.
* Approximately 1 person knows how this all works.
* We have CI to make sure changes do not get merged without updating
  this code.
* We have corner cases where this does the WRONG thing and tracking
  those down is ugly and hard in perpetuity.

So this commit puts all the same logic that WAS in the
Makefile.generated_files into update-codegen.sh.

I do not love this script, especially WRT sub-packages, but I am trying
not to boil the ocean.  I hope to follow up with some more cleanups over
time.

I have tested this manually and with the scripts and it still seems to
catch errors properly.

This includes a change to kube::util::read-array to make it not unset
variables and not over-write non-array variables.
2022-10-04 08:48:39 -07:00
..
boilerplate hack/boilerplate: Tolerate new build tag format (//go:build) 2021-08-24 15:47:49 -04:00
conformance replace ioutil with io and os for hack 2021-10-30 14:44:41 +08:00
e2e-internal hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
gen-swagger-doc
jenkins stop using deprecated klog flags 2022-09-04 21:02:43 +02:00
lib Copy make's codegen logic to update-codegen.sh 2022-10-04 08:48:39 -07:00
make-rules Lock ServerSideApply feature to true 2022-09-27 13:48:28 +02:00
testdata Switching everything to use pause:3.8 2022-07-21 14:53:15 -07:00
tools update golangci-lint for go 1.19 2022-08-07 12:01:15 +08:00
verify-flags Update sig-cli OWNERS 2022-02-14 10:55:35 -07:00
.descriptions_failures Add missing comments in APF API types 2021-06-25 00:27:40 -04:00
.import-aliases e2e: generalize the framework e2e* import alias rule 2022-09-08 18:37:52 +02:00
.spelling_failures clean up spelling_failures 2022-06-21 17:33:46 +08:00
benchmark-go.sh
build-cross.sh
build-go.sh
cherry_pick_pull.sh Update cherry_pick_pull.sh 2022-06-26 09:21:05 +05:30
dev-build-and-push.sh
dev-build-and-up.sh
dev-push-conformance.sh Build Ginkgo binary 2022-07-08 10:46:11 +08:00
e2e-node-test.sh
generate-docs.sh
get-build.sh cluster,hack: Use community infra GCS bucket for retrieving CI builds 2021-07-03 17:04:54 -04:00
ginkgo-e2e.sh e2e: poll state of test 2022-09-18 10:11:22 +02:00
grab-profiles.sh Fix exit code check in hack/grab-profiles.sh 2021-05-17 14:47:05 +08:00
install-etcd.sh
lint-dependencies.sh add update-unwanted-dependencies.sh to track unwanted dependencies 2021-09-17 13:21:38 +08:00
list-feature-tests.sh
local-up-cluster.sh Remove references to openstack and cinder 2022-08-22 16:43:14 -04:00
logcheck.conf logcheck: enable helper check 2022-05-31 08:07:37 +02:00
module-graph.sh Make sure the _output folder exists before using it from module-graph.sh 2020-07-07 01:19:59 -07:00
OWNERS Add enj to hack OWNERS 2022-03-02 10:04:11 -05:00
pin-dependency.sh pin-dependency.sh: enhance forking of a dependency 2021-09-14 11:30:17 +02:00
print-workspace-status.sh Remove invalid comments in hack/lib/version.sh 2022-07-06 19:19:29 +08:00
README.md
run-in-gopath.sh
run-prometheus-on-etcd-scrapes.sh Add serving of scrapes as Prometheus metrics 2021-11-08 15:28:05 -05:00
serve-prom-scrapes.sh Fixed typo in hack/serve-prom-scrapes.sh 2022-02-04 01:33:06 -05:00
test-go.sh
test-integration.sh
unwanted-dependencies.json Add Ginkgo v1 to the list of unwanted dependencies 2022-07-08 10:46:11 +08:00
update-all.sh refactor(hack): use ${BASH_SOURCE[0]} to get script name 2022-04-16 23:58:13 +08:00
update-codegen.sh Copy make's codegen logic to update-codegen.sh 2022-10-04 08:48:39 -07:00
update-conformance-yaml.sh port conformance yaml generation to hack 2021-02-28 00:54:54 -08:00
update-generated-api-compatibility-data.sh Add check for unused API compatibility fixture files 2022-02-10 17:40:25 -05:00
update-generated-device-plugin-dockerized.sh
update-generated-device-plugin.sh
update-generated-docs.sh
update-generated-kms-dockerized.sh Add staging directory for kms 2022-09-26 19:23:35 +00:00
update-generated-kms.sh
update-generated-kubelet-plugin-registration-dockerized.sh
update-generated-kubelet-plugin-registration.sh
update-generated-pod-resources-dockerized.sh Add podresources v1 API 2020-10-26 12:10:18 -07:00
update-generated-pod-resources.sh Add podresources v1 API 2020-10-26 12:10:18 -07:00
update-generated-protobuf-dockerized.sh drop vendor from go install paths 2022-05-05 08:47:33 -04:00
update-generated-protobuf.sh Add usage in some hack/update scripts 2020-05-26 21:49:38 -07:00
update-generated-runtime-dockerized.sh drop vendor from go install paths 2022-05-05 08:47:33 -04:00
update-generated-runtime.sh Add usage in some hack/update scripts 2020-05-26 21:49:38 -07:00
update-generated-stable-metrics.sh remove the rest of the bazel test wiring for metrics stability 2021-02-05 10:48:48 -08:00
update-generated-swagger-docs.sh drop vendor from go install paths 2022-05-05 08:47:33 -04:00
update-gofmt.sh
update-import-aliases.sh *.sh: cleanup all white noise 2020-05-29 09:56:00 +08:00
update-internal-modules.sh Rename _examples to examples 2021-01-25 10:20:46 -08:00
update-kustomize.sh kubectl version should include bundled kustomize version 2022-03-24 13:31:57 -04:00
update-mocks.sh Added update and verify scripts for automated mock generation 2021-09-03 17:40:11 +00:00
update-netparse-cve.sh update and verify netparse 2021-08-20 10:42:09 +02:00
update-openapi-spec.sh stop using deprecated klog flags 2022-09-04 21:02:43 +02:00
update-translations.sh fix translations location in update-translations.sh 2021-07-07 20:01:25 +02:00
update-vendor-licenses.sh Update go.mod files to go1.18, update license vendor script 2022-05-04 10:22:27 -04:00
update-vendor.sh update-vendor.sh: add reminder about LICENSE files 2022-10-04 12:39:05 +02:00
update-yamlfmt.sh Cleanup owners files to make parsing automatable 2021-12-09 21:31:03 -05:00
verify-all.sh refactor(hack): use ${BASH_SOURCE[0]} to get script name 2022-04-16 23:58:13 +08:00
verify-api-groups.sh fix a few missed references 2020-09-02 11:45:10 -07:00
verify-boilerplate.sh
verify-cli-conventions.sh
verify-codegen.sh Copy make's codegen logic to update-codegen.sh 2022-10-04 08:48:39 -07:00
verify-conformance-requirements.sh
verify-conformance-yaml.sh port conformance yaml generation to hack 2021-02-28 00:54:54 -08:00
verify-description.sh hack/verify-description.sh: correctly look for versioned API types 2021-03-02 21:50:40 +05:30
verify-e2e-test-ownership.sh Drop all stacktrace related validtion 2022-07-08 10:46:11 +08:00
verify-external-dependencies-version.sh use sed to drop escape codes from zeitgeist output 2021-03-04 14:59:52 -08:00
verify-flags-underscore.py Merge pull request #92829 from marload/patch-0706-04 2020-10-19 19:12:07 -07:00
verify-generated-device-plugin.sh
verify-generated-docs.sh
verify-generated-files-remake.sh Always pass HEAD to worktree 2021-10-27 15:43:48 -07:00
verify-generated-files.sh
verify-generated-kms.sh Add staging directory for kms 2022-09-26 19:23:35 +00:00
verify-generated-kubelet-plugin-registration.sh
verify-generated-pod-resources.sh Add podresources v1 API 2020-10-26 12:10:18 -07:00
verify-generated-protobuf.sh
verify-generated-runtime.sh Add CRI v1 proto 2020-11-10 14:17:17 -08:00
verify-generated-stable-metrics.sh remove the rest of the bazel test wiring for metrics stability 2021-02-05 10:48:48 -08:00
verify-generated-swagger-docs.sh verify-generated-swagger-docs: remove unnecessary build 2020-09-15 19:30:58 -07:00
verify-gofmt.sh cleanup verify-gofmt.sh 2021-03-07 12:51:33 -08:00
verify-golangci-lint.sh [golang] Fix things commented out in 1.19rc2 2022-08-04 10:27:09 -04:00
verify-govet-levee.sh KEP-1933: add static analysis target to hack/ 2020-11-03 20:03:26 +00:00
verify-govet.sh
verify-import-aliases.sh
verify-import-boss.sh drop vendor from go install paths 2022-05-05 08:47:33 -04:00
verify-imports.sh
verify-internal-modules.sh Rename *-hack-tools.sh -> *-internal-modules.sh 2021-01-25 10:15:59 -08:00
verify-licenses.sh add workaround fix for incorrect license URL 2022-05-06 13:19:24 +05:30
verify-mocks.sh Added update and verify scripts for automated mock generation 2021-09-03 17:40:11 +00:00
verify-netparse-cve.sh update and verify netparse 2021-08-20 10:42:09 +02:00
verify-no-vendor-cycles.sh Update go.mod files to go1.18, update license vendor script 2022-05-04 10:22:27 -04:00
verify-non-mutating-validation.sh add verify script to catch most validation mutations 2021-10-08 14:37:55 -04:00
verify-openapi-spec.sh Generate openapi v3 static files 2021-11-16 17:38:54 -08:00
verify-pkg-names.sh
verify-prerelease-lifecycle-tags.sh Fix error path in file /verify-prerelease-lifecycle-tags.sh. 2021-03-06 15:32:07 +08:00
verify-prometheus-imports.sh Merge pull request #111527 from mengjiao-liu/clean-prometheus-in-volume 2022-08-23 16:05:31 -07:00
verify-publishing-bot.py Change yaml.load() to safe_load() 2021-01-19 15:58:12 +10:00
verify-readonly-packages.sh
verify-shellcheck.sh Fix shellcheck output streams 2021-10-14 15:53:47 +03:00
verify-spelling.sh move linting dependencies to hack/tools/tools.go 2020-04-20 13:45:38 -04:00
verify-staging-meta-files.sh
verify-test-code.sh Use ExpectNoError(err) 2020-09-03 23:29:07 +00:00
verify-test-featuregates.sh
verify-test-images.sh
verify-typecheck-providerless.sh providerless tag for client-go auth plugins 2021-03-28 20:07:59 -04:00
verify-typecheck.sh Add env to verify-typecheck for serial execution 2022-03-09 18:21:27 -07:00
verify-vendor-licenses.sh Remove docker remote/docker-machine from build scripts 2020-12-30 12:37:51 -05:00
verify-vendor.sh Remove docker remote/docker-machine from build scripts 2020-12-30 12:37:51 -05:00
verify-yamlfmt.sh Cleanup owners files to make parsing automatable 2021-12-09 21:31:03 -05:00

Kubernetes hack GuideLines

This document describes how you can use the scripts from hack directory and gives a brief introduction and explanation of these scripts.

Overview

The hack directory contains many scripts that ensure continuous development of kubernetes, enhance the robustness of the code, improve development efficiency, etc. The explanations and descriptions of these scripts are helpful for contributors. For details, refer to the following guidelines.

Key scripts

  • verify-all.sh: This script is a vestigial redirection, Please do not add "real" logic. It is equivalent to make verify.
  • update-all.sh: This script is a vestigial redirection, Please do not add "real" logic. The true target of this makerule is hack/make-rules/update.sh.It is equivalent to make update.

Attention

Note that all scripts must be run from the Kubernetes root directory. We should run hack/verify-all.sh before submitting a PR and if anything fails run hack/update-all.sh.