Codebase
Navigate the Codebase using the tree view. Use the filters to highlight where various files are grouped to aid understanding.
Getting Started Commands
Project Structure
Below is a short description of the key directories of the project to aid you when understanding where key files are located.
api - This directory contains the Kubernetes API definition and implementation. It includes subdirectories like api-rules, discovery, and openapi-spec that define the API schema, discovery, and OpenAPI specification.
build - This directory contains the build scripts and configurations for Kubernetes components. It includes subdirectories like build-image, lib, pause, and server-image that build different parts of Kubernetes, such as images, libraries, and server components.
cluster - This directory contains the configuration and management scripts for Kubernetes clusters. It includes subdirectories like addons, gce, images, kubemark, log-dump, pre-existing, skeleton, and windows. The addons subdirectory contains Kubernetes add-ons, such as cloud controllers, network plugins, and storage plugins.
cmd - This directory contains the command-line interface (CLI) tools for Kubernetes, such as clicheck, cloud-controller-manager, dependencycheck, dependencyverifier, and kubectl.
hack - This directory contains development scripts and tools for the Kubernetes project. It includes subdirectories like boilerplate, conformance, e2e-internal, gen-swagger-doc, jenkins, lib, make-rules, testdata, and tools.
pkg - This directory contains the Go packages for Kubernetes components. It includes subdirectories like api, apis, auth, capabilities, client, cluster, controller, controlplane, credentialprovider, features, fieldpath, generated, kubeapiserver, kubectl, kubemark, printers, probe, proxy, quota, registry, routes, scheduler, security, serviceaccount, util, volume, and windows. These packages define and implement various Kubernetes features and components.
plugin - This directory contains the plugins for Kubernetes, such as admission plugins and auth plugins. It includes subdirectories like pkg and auth.
test - This directory contains the test scripts and configurations for Kubernetes components. It includes subdirectories like cmd, conformance, e2e, fixtures, fuzz, images, kubemark, e2e_kubeadm, e2e_node, and utils.
Entrypoints
Below are files we identified as entrypoints for to the codebase. This is where the application starts and a good place to start when learning.
cmd/clicheck/check_cli_conventions.go - Contains the main function for checking CLI conventions.
cmd/cloud-controller-manager/main.go - Contains the main function for the cloud-controller-manager.
cmd/dependencycheck/dependencycheck.go - Contains the main function for dependency checking.
cmd/dependencyverifier/dependencyverifier.go - Contains functions for dependency verification and the main function.
cmd/fieldnamedocscheck/field_name_docs_check.go - Contains the main function for checking field names and documentation.
cmd/gendocs/gen_kube_docs.go - Contains the main function for generating Kubernetes documentation.
cmd/genkubedocs/gen_kube_docs.go - Contains the main function for generating Kubernetes documentation.
cmd/genman/gen_kube_man.go - Contains the main function for generating Kubernetes man pages.
cmd/genswaggertypedocs/swagger_type_docs.go - Contains the main function for generating Swagger type documents.
cmd/genyaml/gen_kubectl_yaml.go - Contains the main function for generating YAML files for kubectl.
cmd/gotemplate/gotemplate.go - Contains the main function for generating Go templates.
cmd/import-boss/main.go - Contains functions for import boss and the main function.
cmd/importverifier/importverifier.go - Contains functions for import verification and the main function.
cmd/kube-apiserver/apiserver.go - Contains the main function for the kube-apiserver.
cmd/kube-controller-manager/controller-manager.go - Contains the main function for the kube-controller-manager.
cmd/kube-proxy/proxy.go - Contains the main function for the kube-proxy.
cmd/kube-scheduler/scheduler.go - Contains the main function for the kube-scheduler.
cmd/kubeadm/kubeadm.go - Contains the main function for kubeadm.
cmd/kubectl-convert/kubectl-convert.go - Contains the main function for converting kubectl output formats.
cmd/kubectl/kubectl.go - Contains the main function for kubectl.
cmd/kubelet/kubelet.go - Contains the main function for the kubelet.
cmd/kubemark/hollow-node.go - Contains the main function for the kubemark hollow node.
cmd/preferredimports/preferredimports.go - Contains functions for preferred imports and the main function.
cmd/prune-junit-xml/prunexml.go - Contains functions for pruning JUnit XML files and the main function.
cmd/yamlfmt/yamlfmt.go - Contains the main function for formatting YAML files.
hack/conformance/check_conformance_test_requirements.go - Checks conformance test requirements with functions like checkAllProviders, processFile, processDir, newCommand, and main.
hack/tools/ncpu/main.go - Contains the main function for the ncpu tool.
pkg/generated/openapi/cmd/models-schema/main.go - Contains the main function for generating OpenAPI schema files.
staging/src/k8s.io/sample-cli-plugin/cmd/kubectl-ns.go - Contains the main function for the sample CLI plugin.
test/conformance/image/go-runner/main.go - Contains the main function for running conformance tests in containers.
test/conformance/walk.go - Contains functions for walking through test files and checking conformance with functions like main, isConformance, getTestInfo, getTestName, saveAllTestInfo, getConformanceData, scanFileForFrame, validateTestName, tryCommentGroupAndFrame, shouldProcessCommentGroup, and commentToConformanceData.
test/e2e_node/environment/conformance.go - Contains functions for checking conformance in the test environment and the main function.
test/e2e_node/plugins/gcp-credential-provider/main.go - Contains the main function for testing the GCP credential provider plugin.
test/e2e_node/runner/local/run_local.go - Contains functions for running tests locally and the main function.
test/e2e_node/runner/remote/run_remote.go - Contains functions for running tests remotely and the main function.
test/e2e/dra/test-driver/dra-test-driver.go - Contains the main function for the DRA test driver.
test/images/agnhost/agnhost.go - Contains the main function for testing the AGNHOST image.
test/images/apparmor-loader/loader.go - Contains functions for loading profiles and the main function for testing the apparmor-loader image.
test/images/busybox/hostname.go - Contains functions for getting the outbound IP and the main function for testing the hostname image.
test/images/nonewprivs/nnp.go - Contains the main function for testing the nonewprivs image.
test/images/pets/peer-finder/peer-finder.go - Contains functions for peer lookup and shelling out, and the main function for testing the peer-finder image.
test/images/regression-issue-74839/main.go - Contains the main function for testing regression issue 74839.
test/images/resource-consumer/consume-cpu/consume_cpu_windows.go - Contains functions for testing CPU consumption on Windows.
test/images/resource-consumer/consume-cpu/consume_cpu.go - Contains functions for testing CPU consumption.
test/images/resource-consumer/resource_consumer.go - Contains the main function for testing resource consumption.
test/images/sample-device-plugin/sampledeviceplugin.go - Contains functions for stubbing functions and creating CDI files, and the main function for testing the sample device plugin.
test/instrumentation/documentation/main.go - Contains functions for generating documentation with functions like main, byStabilityLevel, and parseMinor.
test/instrumentation/main.go - Contains functions for instrumenting Go code with functions like findGOOS, main, searchPathForStableMetrics, searchFileForStableMetrics, getLocalNameOfImportedPackage, addFileInformationToErrors, globalVariableDeclarations, findPkgDir, and importedGlobalVariableDeclaration.
test/instrumentation/sort/main.go - Contains the main function for sorting Go files.
test/integration/benchmark/extractlog/main.go - Contains functions for extracting log files and the main function for benchmarking.
test/integration/benchmark/jsonify/main.go - Contains functions for jsonifying data and the main function for benchmarking.
test/list/main.go - Contains functions for listing files with functions like collect, funcName, isSprintf, makeWalker, and main.
test/soak/serve_hostnames/serve_hostnames.go - Contains the main function for serving hostnames in the test/soak directory.
test/typecheck/main.go - Handles type checking with functions like newConfig, verify, accumulate, dedup, serialFprintf, resolvePkgs, and main.
test/typecheck/testdata/bad/bad.go - Contains the main function for testing bad code samples.
test/typecheck/testdata/good/_ignore/bad.go - Contains the main function for testing bad code samples.
test/typecheck/testdata/good/good.go - Contains the main function for testing good code samples.
test/typecheck/testdata/good/testdata/bad.go - Contains the main function for testing bad code samples within testdata/good directory.