- Notifications
You must be signed in to change notification settings - Fork214
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.
License
Azure/AgentBaker
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Developing agentbaker requires a few basic requisites:
- Go (at least version 1.19)
- Make
Runmake -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 runmake
.
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 ofgo test ./...
) and regenerates snapshot testdata.
We usegolangci-lint to enforce style.
Runmake -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 havejob 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 toconventional commits.
Prefer pull requests with single commits.
To clean up in-progress commits, you can usegit rebase -i
to fixup commits.
See thegit documentation for more details.
Most code may be tested with vanilla Go unit tests.
Please visit the officialGitHub link for more details. Below is a brief use case.
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 runningmake tools-install
ormake generate
in root (/AgentBaker) directory.
Note:make generate
will install and run the shellspec tests.
If you want to install it in your local machine, please runcurl -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 commandexport PATH=$PATH:~/.local/lib/shellspec
.
You will need to writexxx_spec.sh
file for the test.
For example,AgentBaker/spec/parts/linux/cloud-init/artifacts/cse_install_spec.sh
is a test file forAgentBaker/parts/linux/cloud-init/artifacts/cse_install.sh
To run all tests, in AgentBaker folder, simply runbash ./hack/tools/bin/shellspec
in root (/AgentBaker) directory.
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"
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 fordynamic-config-dir
to see a validation sample.).
Checkout thee2e directory.
This project welcomes contributions and suggestions. Most contributions require you to agree to aContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant usthe rights to use your contribution. For details, visithttps://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to providea CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructionsprovided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted theMicrosoft Open Source Code of Conduct.For more information see theCode of Conduct FAQ orcontactopencode@microsoft.com with any additional questions or comments.
A cgmanifest file is a json file used to register components manually when the component type is not supported bygovernance. The file name is "cgmanifest.json" and you can have as many as you need and can be anywhere in yourrepository.
File path:./vhdbuilder/cgmanifest.json
Reference:https://docs.opensource.microsoft.com/tools/cg/cgmanifest.html
Package:
- Calico Windows:https://docs.projectcalico.org/release-notes/
About
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.