Agent Baker is aiming to provide a centralized, portable k8s agent node provisioning lib as well as rich support on different OS image with optimized k8s binaries.
Перейти к файлу
Sylvain Boily 4522b24c3b
[ci skip] adding Tim and Artur as owner (#5091)
2024-10-15 13:31:33 -07:00
.clusterfuzzlite fix: remove clusterfuzzlite dockerfile to fix build warnings (#3608) 2023-09-12 09:14:35 -07:00
.devcontainer feat: Revising the contract ln 1- 85 between the VHD and AKS-RP, for self-contained VHD feature. (#3708) 2023-10-17 19:43:33 -07:00
.github chore: set coverage calculations to manual trigger only (#5080) 2024-10-11 15:48:19 -07:00
.pipelines node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
apiserver feat: use new configmap toggle structure (#4792) 2024-08-29 21:29:56 +00:00
cmd feat: toggles in agentbakersvc (#4206) 2024-04-05 14:31:39 -07:00
doc chore: run formatter on markdown files so lines wrap (#4465) 2024-06-04 12:24:58 +12:00
e2e node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
example Fix cse command 2020-02-13 09:41:54 -08:00
fuzz chore: run formatter on markdown files so lines wrap (#4465) 2024-06-04 12:24:58 +12:00
hack/tools change shellspec folder name to support Mac (#4651) 2024-07-16 10:38:47 -07:00
nbcparser feat(wasm): bump the spin shim the latest version from SpinKube (#4744) 2024-09-19 18:53:50 +00:00
node-bootstrapper node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
parts fix: remove possible trailing new line when resolving primary NIC IP from IMDS (#5057) 2024-10-15 16:02:31 +08:00
pkg fix: remove possible trailing new line when resolving primary NIC IP from IMDS (#5057) 2024-10-15 16:02:31 +08:00
schemas feat: update AzureLinuxOSDistro schema to have v3.0 explicitly (#5025) 2024-10-04 22:22:09 +00:00
spec feat: update AzureLinuxOSDistro schema to have v3.0 explicitly (#5025) 2024-10-04 22:22:09 +00:00
staging/cse/windows feat: bump AKS Windows CSE script package to v0.0.48 (#4940) 2024-09-13 10:55:02 +00:00
tools Add script to enable anonymous auth for non rbac 2021-05-05 22:45:29 -07:00
vhdbuilder Chore : CNI and CNS v1.5.38 and v1.4.56 (#5076) 2024-10-15 05:44:53 +00:00
.gitignore test: use latest available image for e2e tests (#4487) 2024-06-26 13:10:35 +12:00
.golangci.yaml node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
.shellspec refactor: (new) move containerd and runc from manifest.json to components.json. Merge DownloadFiles to Packages (#4532) 2024-07-12 21:21:03 +00:00
CODEOWNERS [ci skip] adding Tim and Artur as owner (#5091) 2024-10-15 13:31:33 -07:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2020-02-21 23:02:52 -08:00
LICENSE Initial LICENSE commit 2020-02-21 23:02:53 -08:00
Makefile fix: don't validate prefetch within make generate (#5000) 2024-09-26 14:48:12 -07:00
NOTICE.md chore: register containerd component using Component Governance (#746) 2021-04-20 13:08:42 +08:00
README.md chore(deps): update dependency moby-containerd to v1.7.22-ubuntu20.04u1 (#4975) 2024-09-26 16:16:31 -07:00
SECURITY.md Initial SECURITY.md commit 2020-02-21 23:02:56 -08:00
commitlint.config.js ci: add version bump as commit type 2023-05-11 12:30:28 -04:00
go.mod node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
go.sum node-bootstrapper (#4891) 2024-10-11 01:54:01 +00:00
packer.mk feat: use 1ES agent image for build pipeline (#5013) 2024-10-07 11:09:43 -07:00
versioning.mk remove client-go dep; cleanup aks-engine legacy code (#1015) 2021-08-12 15:23:44 -07:00

README.md

Agentbaker

Coverage Status

Agentbaker is a collection of components used to provision Kubernetes nodes in Azure.

Agentbaker has a few pieces

  • Packer templates and scripts to build VM images.
  • A set of templates and a public API to render those templates given input config.
  • An API to retrieve the latest VM image version for new clusters.

The primary consumer of Agentbaker is Azure Kubernetes Service (AKS).

AKS uses Agentbaker to provision Linux and Windows Kubernetes nodes.

Contributing

Developing agentbaker requires a few basic requisites:

  • Go (at least version 1.19)
  • Make

Run make -C hack/tools install to install all development tools.

If you change code or artifacts used to generate custom data or custom script extension payloads, you should run make.

This re-runs code to embed static files in Go code, which is what will actually be used at runtime.

This additionally runs unit tests (equivalent of go test ./...) and regenerates snapshot testdata.

Style

We use golangci-lint to enforce style.

Run make -C hack/tools install to install the linter.

Run ./hack/tools/bin/golangci-lint run to run the linter.

We currently have many failures we hope to eliminate.

We have job to run golangci-lint on pull requests.

This job uses the linters "no-new-issues" feature.

As long as PRs don't introduce net new issues, they should pass.

We also have a linting job to enforce commit message style.

We adhere to conventional commits.

Prefer pull requests with single commits.

To clean up in-progress commits, you can use git rebase -i to fixup commits.

See the git documentation for more details.

Testing

Most code may be tested with vanilla Go unit tests.

shell scripts unit tests

Please visit the official GitHub link for more details. Below is a brief use case.

Installation

Shellspec is used as a framework for unit test. There are 2 options to install it.

Shellspec is already included in the makefile. You can install it simply by running make tools-install or make generate in root (/AgentBaker) directory.

Note: make generate will install and run the shellspec tests.

Option 2 - install in your local machine

If you want to install it in your local machine, please run curl -fsSL https://git.io/shellspec | sh.

By default, it should be installed in ~/.local/lib/shellspec. Please append it to the $PATH for your convenience. Example command export PATH=$PATH:~/.local/lib/shellspec.

Authoring tests

You will need to write xxx_spec.sh file for the test.

For example, AgentBaker/spec/parts/linux/cloud-init/artifacts/cse_install_spec.sh is a test file for AgentBaker/parts/linux/cloud-init/artifacts/cse_install.sh

Running tests locally

To run all tests, in AgentBaker folder, simply run bash ./hack/tools/bin/shellspec in root (/AgentBaker) directory.

Useful commands for debugging

  • bash ./hack/tools/bin/shellspec -x => with -x, it will show verbose trace for debugging.
  • bash ./hack/tools/bin/shellspec -E "<test name>" => you can run a single test case by using -E and the test name. For example, bash ./hack/tools/bin/shellspec -E "returns downloadURIs.ubuntu.\"r2004\".downloadURL of package runc for UBUNTU 20.04". You can also do -xE for verbose trace for a single test case.
  • bash ./hack/tools/bin/shellspec "path to xxx_spec.sh" => by providing a full path a particular spec file, you can run only that spec file instead of all spec files in AgentBaker project. For example, bash ./hack/tools/bin/shellspec "spec/parts/linux/cloud-init/artifacts/cse_install_spec.sh"

Snapshot

We also have snapshot data tests, which store the output of key APIs as files on disk.

We can manually verify the snapshot content looks correct.

We now have unit tests which can directly validate the content without leaving generated files on disk.

See ./pkg/agent/baker_test.go for examples (search for dynamic-config-dir to see a validation sample.).

E2E

Checkout the e2e directory.

Contributor License Agreement (CLA)

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

CGManifest File

A cgmanifest file is a json file used to register components manually when the component type is not supported by governance. The file name is "cgmanifest.json" and you can have as many as you need and can be anywhere in your repository.

File path: ./vhdbuilder/cgmanifest.json

Reference: https://docs.opensource.microsoft.com/tools/cg/cgmanifest.html

Package: