From bc8fb32777aa43ec66da6671ab267b6e254b6027 Mon Sep 17 00:00:00 2001 From: r2k1 Date: Mon, 4 Nov 2024 07:59:49 +1300 Subject: [PATCH 1/2] fix lint errors (#5174) --- .github/workflows/golangci-lint-pr.yml | 45 -------------------------- .github/workflows/golangci-lint.yml | 4 +++ pkg/proto/nbcontract/v1/const.go | 1 - 3 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/golangci-lint-pr.yml diff --git a/.github/workflows/golangci-lint-pr.yml b/.github/workflows/golangci-lint-pr.yml deleted file mode 100644 index e4486aa01b1..00000000000 --- a/.github/workflows/golangci-lint-pr.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: golangci-lint-pr -on: - pull_request: - branches: - - master - - main - -permissions: - contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - pull-requests: read - -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: '1.22' - - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v4 - with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.59.1 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - only-new-issues: true - - # Optional: if set to true then the all caching functionality will be complete disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true then the action don't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 75b03ffff9d..c6c8df9c94f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -4,6 +4,10 @@ on: branches: - master - main + pull_request: + branches: + - master + - main permissions: contents: read diff --git a/pkg/proto/nbcontract/v1/const.go b/pkg/proto/nbcontract/v1/const.go index 11de1cf23c8..95227c7482b 100644 --- a/pkg/proto/nbcontract/v1/const.go +++ b/pkg/proto/nbcontract/v1/const.go @@ -1,7 +1,6 @@ package nbcontractv1 const ( - // Follow the semantic versioning format. .. //nolint: godot // no period is required after patch. contractVersion = "v0" ) From 654ed86c2ad4d8292d26290a7238abe65b6622e2 Mon Sep 17 00:00:00 2001 From: r2k1 Date: Mon, 4 Nov 2024 11:43:09 +1300 Subject: [PATCH 2/2] Rename node-bootstrapper => aks-node-controller (#5191) --- Makefile | 6 +-- aks-node-controller/.gitignore | 1 + .../app.go | 8 ++-- .../app_test.go | 8 ++-- .../go.mod | 2 +- .../go.sum | 0 .../main.go | 2 +- .../parser/consts.go | 0 .../parser/helper.go | 0 .../parser/helper_test.go | 0 .../parser/parser.go | 0 .../parser/parser_test.go | 2 +- .../parser/templates/containerd.toml.gtpl | 0 .../parser/templates/cse_cmd.sh.gtpl | 0 .../parser/templates/kubenet-cni.json.gtpl | 0 .../parser/testdata/test_nbc.json | 0 .../testdata/test_nbc_fields_missing.json | 0 .../testdata/test_nbc_fields_unexpected.json | 0 .../test_helpers.go | 0 .../utils/sensitive_string.go | 0 e2e/config/config.go | 2 +- e2e/exec.go | 2 +- e2e/node_bootstrapper_test.go | 38 +++++++++---------- e2e/scenario_test.go | 2 +- e2e/validation.go | 2 +- node-bootstrapper/.gitignore | 1 - packer.mk | 14 +++---- ...ap.service => aks-node-controller.service} | 2 +- pkg/agent/bakerapi.go | 2 +- pkg/agent/datamodel/types.go | 2 +- vhdbuilder/packer/packer_source.sh | 16 ++++---- vhdbuilder/packer/pre-install-dependencies.sh | 4 +- .../packer/test/linux-vhd-content-test.sh | 20 +++++----- .../packer/vhd-image-builder-arm64-gen2.json | 8 ++-- vhdbuilder/packer/vhd-image-builder-base.json | 8 ++-- .../vhd-image-builder-mariner-arm64.json | 8 ++-- .../packer/vhd-image-builder-mariner.json | 8 ++-- 37 files changed, 83 insertions(+), 85 deletions(-) create mode 100644 aks-node-controller/.gitignore rename {node-bootstrapper => aks-node-controller}/app.go (92%) rename {node-bootstrapper => aks-node-controller}/app_test.go (89%) rename {node-bootstrapper => aks-node-controller}/go.mod (93%) rename {node-bootstrapper => aks-node-controller}/go.sum (100%) rename {node-bootstrapper => aks-node-controller}/main.go (93%) rename {node-bootstrapper => aks-node-controller}/parser/consts.go (100%) rename {node-bootstrapper => aks-node-controller}/parser/helper.go (100%) rename {node-bootstrapper => aks-node-controller}/parser/helper_test.go (100%) rename {node-bootstrapper => aks-node-controller}/parser/parser.go (100%) rename {node-bootstrapper => aks-node-controller}/parser/parser_test.go (99%) rename {node-bootstrapper => aks-node-controller}/parser/templates/containerd.toml.gtpl (100%) rename {node-bootstrapper => aks-node-controller}/parser/templates/cse_cmd.sh.gtpl (100%) rename {node-bootstrapper => aks-node-controller}/parser/templates/kubenet-cni.json.gtpl (100%) rename {node-bootstrapper => aks-node-controller}/parser/testdata/test_nbc.json (100%) rename {node-bootstrapper => aks-node-controller}/parser/testdata/test_nbc_fields_missing.json (100%) rename {node-bootstrapper => aks-node-controller}/parser/testdata/test_nbc_fields_unexpected.json (100%) rename {node-bootstrapper => aks-node-controller}/test_helpers.go (100%) rename {node-bootstrapper => aks-node-controller}/utils/sensitive_string.go (100%) delete mode 100644 node-bootstrapper/.gitignore rename parts/linux/cloud-init/artifacts/{bootstrap.service => aks-node-controller.service} (56%) diff --git a/Makefile b/Makefile index b01d90a6781..8582251c157 100644 --- a/Makefile +++ b/Makefile @@ -180,11 +180,11 @@ endif ginkgoBuild: generate make -C ./test/e2e ginkgo-build -test: test-node-bootstrapper +test: test-aks-node-controller go test ./... -test-node-bootstrapper: - pushd node-bootstrapper && go test ./... && popd +test-aks-node-controller: + pushd aks-node-controller && go test ./... && popd .PHONY: test-style test-style: validate-go validate-shell validate-copyright-headers diff --git a/aks-node-controller/.gitignore b/aks-node-controller/.gitignore new file mode 100644 index 00000000000..67642442ba6 --- /dev/null +++ b/aks-node-controller/.gitignore @@ -0,0 +1 @@ +aks-node-controller diff --git a/node-bootstrapper/app.go b/aks-node-controller/app.go similarity index 92% rename from node-bootstrapper/app.go rename to aks-node-controller/app.go index ec508d570a6..8a876ad33dc 100644 --- a/node-bootstrapper/app.go +++ b/aks-node-controller/app.go @@ -12,7 +12,7 @@ import ( "os" "os/exec" - "github.com/Azure/agentbaker/node-bootstrapper/parser" + "github.com/Azure/agentbaker/aks-node-controller/parser" nbcontractv1 "github.com/Azure/agentbaker/pkg/proto/nbcontract/v1" ) @@ -31,13 +31,13 @@ type ProvisionFlags struct { } func (a *App) Run(ctx context.Context, args []string) int { - slog.Info("node-bootstrapper started") + slog.Info("aks-node-controller started") err := a.run(ctx, args) exitCode := errToExitCode(err) if exitCode == 0 { - slog.Info("node-bootstrapper finished successfully") + slog.Info("aks-node-controller finished successfully") } else { - slog.Error("node-bootstrapper failed", "error", err) + slog.Error("aks-node-controller failed", "error", err) } return exitCode } diff --git a/node-bootstrapper/app_test.go b/aks-node-controller/app_test.go similarity index 89% rename from node-bootstrapper/app_test.go rename to aks-node-controller/app_test.go index 6d74f81169b..595f2b95621 100644 --- a/node-bootstrapper/app_test.go +++ b/aks-node-controller/app_test.go @@ -43,12 +43,12 @@ func TestApp_Run(t *testing.T) { }{ { name: "missing command argument", - args: []string{"node-bootstrapper"}, + args: []string{"aks-node-controller"}, wantExit: 1, }, { name: "unknown command", - args: []string{"node-bootstrapper", "unknown"}, + args: []string{"aks-node-controller", "unknown"}, wantExit: 1, }, { @@ -58,7 +58,7 @@ func TestApp_Run(t *testing.T) { }, { name: "provision command with valid flag", - args: []string{"node-bootstrapper", "provision", "--provision-config=parser/testdata/test_nbc.json"}, + args: []string{"aks-node-controller", "provision", "--provision-config=parser/testdata/test_nbc.json"}, setupMocks: func(mc *MockCmdRunner) { mc.RunFunc = func(cmd *exec.Cmd) error { return nil @@ -68,7 +68,7 @@ func TestApp_Run(t *testing.T) { }, { name: "provision command with command runner error", - args: []string{"node-bootstrapper", "provision", "--provision-config=parser/testdata/test_nbc.json"}, + args: []string{"aks-node-controller", "provision", "--provision-config=parser/testdata/test_nbc.json"}, setupMocks: func(mc *MockCmdRunner) { mc.RunFunc = func(cmd *exec.Cmd) error { return &ExitError{Code: 666} diff --git a/node-bootstrapper/go.mod b/aks-node-controller/go.mod similarity index 93% rename from node-bootstrapper/go.mod rename to aks-node-controller/go.mod index 7326b08ad81..e374a9ffa29 100644 --- a/node-bootstrapper/go.mod +++ b/aks-node-controller/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/agentbaker/node-bootstrapper +module github.com/Azure/agentbaker/aks-node-controller go 1.22.2 diff --git a/node-bootstrapper/go.sum b/aks-node-controller/go.sum similarity index 100% rename from node-bootstrapper/go.sum rename to aks-node-controller/go.sum diff --git a/node-bootstrapper/main.go b/aks-node-controller/main.go similarity index 93% rename from node-bootstrapper/main.go rename to aks-node-controller/main.go index 84fbbeb48a3..ffa2ab02154 100644 --- a/node-bootstrapper/main.go +++ b/aks-node-controller/main.go @@ -10,7 +10,7 @@ import ( // Some options are intentionally non-configurable to avoid customization by users // it will help us to avoid introducing any breaking changes in the future. const ( - LogFile = "/var/log/azure/node-bootstrapper.log" + LogFile = "/var/log/azure/aks-node-controller.log" ) func main() { diff --git a/node-bootstrapper/parser/consts.go b/aks-node-controller/parser/consts.go similarity index 100% rename from node-bootstrapper/parser/consts.go rename to aks-node-controller/parser/consts.go diff --git a/node-bootstrapper/parser/helper.go b/aks-node-controller/parser/helper.go similarity index 100% rename from node-bootstrapper/parser/helper.go rename to aks-node-controller/parser/helper.go diff --git a/node-bootstrapper/parser/helper_test.go b/aks-node-controller/parser/helper_test.go similarity index 100% rename from node-bootstrapper/parser/helper_test.go rename to aks-node-controller/parser/helper_test.go diff --git a/node-bootstrapper/parser/parser.go b/aks-node-controller/parser/parser.go similarity index 100% rename from node-bootstrapper/parser/parser.go rename to aks-node-controller/parser/parser.go diff --git a/node-bootstrapper/parser/parser_test.go b/aks-node-controller/parser/parser_test.go similarity index 99% rename from node-bootstrapper/parser/parser_test.go rename to aks-node-controller/parser/parser_test.go index 23a2e64381d..c30d35a9347 100644 --- a/node-bootstrapper/parser/parser_test.go +++ b/aks-node-controller/parser/parser_test.go @@ -11,7 +11,7 @@ import ( "strings" "testing" - "github.com/Azure/agentbaker/node-bootstrapper/parser" + "github.com/Azure/agentbaker/aks-node-controller/parser" "github.com/Azure/agentbaker/pkg/agent/datamodel" nbcontractv1 "github.com/Azure/agentbaker/pkg/proto/nbcontract/v1" "github.com/Azure/go-autorest/autorest/to" diff --git a/node-bootstrapper/parser/templates/containerd.toml.gtpl b/aks-node-controller/parser/templates/containerd.toml.gtpl similarity index 100% rename from node-bootstrapper/parser/templates/containerd.toml.gtpl rename to aks-node-controller/parser/templates/containerd.toml.gtpl diff --git a/node-bootstrapper/parser/templates/cse_cmd.sh.gtpl b/aks-node-controller/parser/templates/cse_cmd.sh.gtpl similarity index 100% rename from node-bootstrapper/parser/templates/cse_cmd.sh.gtpl rename to aks-node-controller/parser/templates/cse_cmd.sh.gtpl diff --git a/node-bootstrapper/parser/templates/kubenet-cni.json.gtpl b/aks-node-controller/parser/templates/kubenet-cni.json.gtpl similarity index 100% rename from node-bootstrapper/parser/templates/kubenet-cni.json.gtpl rename to aks-node-controller/parser/templates/kubenet-cni.json.gtpl diff --git a/node-bootstrapper/parser/testdata/test_nbc.json b/aks-node-controller/parser/testdata/test_nbc.json similarity index 100% rename from node-bootstrapper/parser/testdata/test_nbc.json rename to aks-node-controller/parser/testdata/test_nbc.json diff --git a/node-bootstrapper/parser/testdata/test_nbc_fields_missing.json b/aks-node-controller/parser/testdata/test_nbc_fields_missing.json similarity index 100% rename from node-bootstrapper/parser/testdata/test_nbc_fields_missing.json rename to aks-node-controller/parser/testdata/test_nbc_fields_missing.json diff --git a/node-bootstrapper/parser/testdata/test_nbc_fields_unexpected.json b/aks-node-controller/parser/testdata/test_nbc_fields_unexpected.json similarity index 100% rename from node-bootstrapper/parser/testdata/test_nbc_fields_unexpected.json rename to aks-node-controller/parser/testdata/test_nbc_fields_unexpected.json diff --git a/node-bootstrapper/test_helpers.go b/aks-node-controller/test_helpers.go similarity index 100% rename from node-bootstrapper/test_helpers.go rename to aks-node-controller/test_helpers.go diff --git a/node-bootstrapper/utils/sensitive_string.go b/aks-node-controller/utils/sensitive_string.go similarity index 100% rename from node-bootstrapper/utils/sensitive_string.go rename to aks-node-controller/utils/sensitive_string.go diff --git a/e2e/config/config.go b/e2e/config/config.go index 628cc1a63c9..6a0da576695 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -37,7 +37,7 @@ type Configuration struct { KeepVMSS bool `env:"KEEP_VMSS"` BlobStorageAccountPrefix string `env:"BLOB_STORAGE_ACCOUNT_PREFIX" envDefault:"abe2e"` BlobContainer string `env:"BLOB_CONTAINER" envDefault:"abe2e"` - EnableNodeBootstrapperTest bool `env:"ENABLE_NODE_BOOTSTRAPPER_TEST"` + EnableAKSNodeControllerTest bool `env:"ENABLE_AKS_NODE_CONTROLLER_TEST"` } func (c *Configuration) BlobStorageAccount() string { diff --git a/e2e/exec.go b/e2e/exec.go index 0b1c47015e8..70c9c99fb0c 100644 --- a/e2e/exec.go +++ b/e2e/exec.go @@ -61,7 +61,7 @@ func extractLogsFromVM(ctx context.Context, t *testing.T, vmssName, privateIP, s "kubelet": "journalctl -u kubelet", "cluster-provision-cse-output": "cat /var/log/azure/cluster-provision-cse-output.log", "sysctl-out": "sysctl -a", - "node-bootstrapper": "cat /var/log/azure/node-bootstrapper.log", + "aks-node-controller": "cat /var/log/azure/aks-node-controller.log", } podName, err := getHostNetworkDebugPodName(ctx, cluster.Kube, t) diff --git a/e2e/node_bootstrapper_test.go b/e2e/node_bootstrapper_test.go index 8829649a4c2..987296f62ce 100644 --- a/e2e/node_bootstrapper_test.go +++ b/e2e/node_bootstrapper_test.go @@ -20,31 +20,31 @@ import ( "github.com/stretchr/testify/require" ) -// test node-bootstrapper binary without rebuilding VHD images. -// it compiles the node-bootstrapper binary and uploads it to Azure Storage. +// test aks-node-controller binary without rebuilding VHD images. +// it compiles the aks-node-controller binary and uploads it to Azure Storage. // the binary is then downloaded and executed on the VM // the test results are unreliable, as there can be a version mismatch between the binary and the rest content of VHD image // it's intended to be used for quick testing without rebuilding VHD images // mostly executed locally -func Test_ubuntu2204NodeBootstrapper(t *testing.T) { +func Test_ubuntu2204AKSNodeController(t *testing.T) { ctx := newTestCtx(t) - if !config.Config.EnableNodeBootstrapperTest { - t.Skip("ENABLE_NODE_BOOTSTRAPPER_TEST is not set") + if !config.Config.EnableAKSNodeControllerTest { + t.Skip("ENABLE_AKS_NODE_CONTROLLER_TEST is not set") } // TODO: figure out how to properly parallelize test, maybe move t.Parallel to the top of each test? cluster, err := ClusterKubenet(ctx, t) require.NoError(t, err) t.Cleanup(func() { - log, err := os.ReadFile("./scenario-logs/" + t.Name() + "/node-bootstrapper.stdout.txt") + log, err := os.ReadFile("./scenario-logs/" + t.Name() + "/aks-node-controller.stdout.txt") if err != nil { - t.Logf("failed to read node-bootstrapper log: %v", err) + t.Logf("failed to read aks-node-controller log: %v", err) } - t.Logf("node-bootstrapper log: %s", string(log)) + t.Logf("aks-node-controller log: %s", string(log)) }) identity, err := config.Azure.CreateVMManagedIdentity(ctx) require.NoError(t, err) - binary := compileNodeBootstrapper(t) - url, err := config.Azure.UploadAndGetLink(ctx, time.Now().Format("2006-01-02-15-04-05")+"/node-bootstrapper", binary) + binary := compileAKSNodeController(t) + url, err := config.Azure.UploadAndGetLink(ctx, time.Now().Format("2006-01-02-15-04-05")+"/aks-node-controller", binary) require.NoError(t, err) RunScenario(t, &Scenario{ @@ -72,7 +72,7 @@ func Test_ubuntu2204NodeBootstrapper(t *testing.T) { Settings: map[string]any{}, ProtectedSettings: map[string]any{ "fileUris": []string{url}, - "commandToExecute": CSENodeBootstrapper(t, cluster), + "commandToExecute": CSEAKSNodeController(t, cluster), "managedIdentity": map[string]any{ "clientId": identity, }, @@ -85,14 +85,14 @@ func Test_ubuntu2204NodeBootstrapper(t *testing.T) { LiveVMValidators: []*LiveVMValidator{ mobyComponentVersionValidator("containerd", getExpectedPackageVersions("containerd", "ubuntu", "r2204")[0], "apt"), mobyComponentVersionValidator("runc", getExpectedPackageVersions("runc", "ubuntu", "r2204")[0], "apt"), - FileHasContentsValidator("/var/log/azure/node-bootstrapper.log", "node-bootstrapper finished successfully"), + FileHasContentsValidator("/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully"), }, AKSNodeConfigMutator: func(config *nbcontractv1.Configuration) {}, }, }) } -func CSENodeBootstrapper(t *testing.T, cluster *Cluster) string { +func CSEAKSNodeController(t *testing.T, cluster *Cluster) string { nbcAny, err := deepcopy.Anything(cluster.NodeBootstrappingConfiguration) require.NoError(t, err) nbc := nbcAny.(*datamodel.NodeBootstrappingConfiguration) @@ -103,12 +103,12 @@ func CSENodeBootstrapper(t *testing.T, cluster *Cluster) string { configJSON, err := json.Marshal(configContent) require.NoError(t, err) - return fmt.Sprintf(`sh -c "(mkdir -p /etc/node-bootstrapper && echo '%s' | base64 -d > /etc/node-bootstrapper/config.json && ./node-bootstrapper provision --provision-config=/etc/node-bootstrapper/config.json)"`, base64.StdEncoding.EncodeToString(configJSON)) + return fmt.Sprintf(`sh -c "(mkdir -p /etc/aks-node-controller && echo '%s' | base64 -d > /etc/aks-node-controller/config.json && ./aks-node-controller provision --provision-config=/etc/aks-node-controller/config.json)"`, base64.StdEncoding.EncodeToString(configJSON)) } -func compileNodeBootstrapper(t *testing.T) *os.File { - cmd := exec.Command("go", "build", "-o", "node-bootstrapper", "-v") - cmd.Dir = filepath.Join("..", "node-bootstrapper") +func compileAKSNodeController(t *testing.T) *os.File { + cmd := exec.Command("go", "build", "-o", "aks-node-controller", "-v") + cmd.Dir = filepath.Join("..", "aks-node-controller") cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "GOOS=linux", @@ -116,8 +116,8 @@ func compileNodeBootstrapper(t *testing.T) *os.File { ) log, err := cmd.CombinedOutput() require.NoError(t, err, string(log)) - t.Logf("Compiled node-bootstrapper") - f, err := os.Open(filepath.Join("..", "node-bootstrapper", "node-bootstrapper")) + t.Logf("Compiled aks-node-controller") + f, err := os.Open(filepath.Join("..", "aks-node-controller", "aks-node-controller")) require.NoError(t, err) return f } diff --git a/e2e/scenario_test.go b/e2e/scenario_test.go index 829d7513903..97dec25e6ca 100644 --- a/e2e/scenario_test.go +++ b/e2e/scenario_test.go @@ -577,7 +577,7 @@ func Test_ubuntu2204ScriptlessInstaller(t *testing.T) { Cluster: ClusterKubenet, VHD: config.VHDUbuntu2204Gen2Containerd, LiveVMValidators: []*LiveVMValidator{ - FileHasContentsValidator("/var/log/azure/node-bootstrapper.log", "node-bootstrapper finished successfully"), + FileHasContentsValidator("/var/log/azure/aks-node-controller.log", "aks-node-controller finished successfully"), }, AKSNodeConfigMutator: func(config *nbcontractv1.Configuration) {}, }, diff --git a/e2e/validation.go b/e2e/validation.go index 013287f0211..58d26d48cca 100644 --- a/e2e/validation.go +++ b/e2e/validation.go @@ -178,7 +178,7 @@ func leakedSecretsValidators(scenario *Scenario) []*LiveVMValidator { } validators := make([]*LiveVMValidator, 0) - for _, logFile := range []string{"/var/log/azure/cluster-provision.log", "/var/log/azure/node-bootstrapper.log"} { + for _, logFile := range []string{"/var/log/azure/cluster-provision.log", "/var/log/azure/aks-node-controller.log"} { for secretName, secretValue := range secrets { validators = append(validators, FileExcludesContentsValidator(logFile, secretValue, secretName)) } diff --git a/node-bootstrapper/.gitignore b/node-bootstrapper/.gitignore deleted file mode 100644 index 0ad25ed3635..00000000000 --- a/node-bootstrapper/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node-bootstrapper diff --git a/packer.mk b/packer.mk index 4a9a6b707b3..96461332d0e 100755 --- a/packer.mk +++ b/packer.mk @@ -5,7 +5,7 @@ ifeq (${ARCHITECTURE},ARM64) GOARCH=arm64 endif -build-packer: generate-prefetch-scripts build-node-bootstrapper build-lister-binary +build-packer: generate-prefetch-scripts build-aks-node-controller build-lister-binary ifeq (${ARCHITECTURE},ARM64) @echo "${MODE}: Building with Hyper-v generation 2 ARM64 VM" ifeq (${OS_SKU},Ubuntu) @@ -112,14 +112,12 @@ ifeq (${MODE},linuxVhdMode) @bash -c "pushd vhdbuilder/prefetch; go run cmd/main.go --components-path=../../parts/linux/cloud-init/artifacts/components.json --output-path=../packer/prefetch.sh || exit 1; popd" endif -build-node-bootstrapper: - @echo "Building node bootstrapper binaries" - @bash -c "pushd node-bootstrapper && \ +build-aks-node-controller: + @echo "Building aks-node-controller binaries" + @bash -c "pushd aks-node-controller && \ go test ./... && \ - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/node-bootstrapper-linux-amd64 && \ - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/node-bootstrapper-linux-arm64 && \ - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/node-bootstrapper-windows-amd64.exe && \ - CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o bin/node-bootstrapper-windows-arm64.exe && \ + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/aks-node-controller-linux-amd64 && \ + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/aks-node-controller-linux-arm64 && \ popd" build-lister-binary: diff --git a/parts/linux/cloud-init/artifacts/bootstrap.service b/parts/linux/cloud-init/artifacts/aks-node-controller.service similarity index 56% rename from parts/linux/cloud-init/artifacts/bootstrap.service rename to parts/linux/cloud-init/artifacts/aks-node-controller.service index a4003bbd325..f0976e243ea 100644 --- a/parts/linux/cloud-init/artifacts/bootstrap.service +++ b/parts/linux/cloud-init/artifacts/aks-node-controller.service @@ -5,7 +5,7 @@ Wants=cloud-init.target [Service] Type=oneshot -ExecStart=/opt/azure/containers/node-bootstrapper provision --provision-config=/opt/azure/containers/node-bootstrapper-config.json +ExecStart=/opt/azure/containers/aks-node-controller provision --provision-config=/opt/azure/containers/aks-node-controller-config.json RemainAfterExit=No [Install] diff --git a/pkg/agent/bakerapi.go b/pkg/agent/bakerapi.go index 97c6f3e91be..b0372b9479c 100644 --- a/pkg/agent/bakerapi.go +++ b/pkg/agent/bakerapi.go @@ -129,7 +129,7 @@ func getScriptlessCustomDataContent(config any) (string, error) { encodedNBCJson := base64.StdEncoding.EncodeToString(nbcJSON) customDataYAML := fmt.Sprintf(`#cloud-config write_files: -- path: /opt/azure/containers/node-bootstrapper-config.json +- path: /opt/azure/containers/aks-node-controller-config.json permissions: "0755" owner: root content: !!binary | diff --git a/pkg/agent/datamodel/types.go b/pkg/agent/datamodel/types.go index eb0a30f4656..43510ccf550 100644 --- a/pkg/agent/datamodel/types.go +++ b/pkg/agent/datamodel/types.go @@ -1744,7 +1744,7 @@ type NodeBootstrappingConfiguration struct { // our added rule is overwritten by Cilium. InsertIMDSRestrictionRuleToMangleTable bool - // Version is required for node-bootstrapper application to determine the version of the config file. + // Version is required for aks-node-controller application to determine the version of the config file. Version string } diff --git a/vhdbuilder/packer/packer_source.sh b/vhdbuilder/packer/packer_source.sh index 49e326f3eca..d87480bb271 100644 --- a/vhdbuilder/packer/packer_source.sh +++ b/vhdbuilder/packer/packer_source.sh @@ -125,8 +125,8 @@ copyPackerFiles() { VHD_CLEANUP_SCRIPT_DEST=/opt/azure/containers/cleanup-vhd.sh CONTAINER_IMAGE_PREFETCH_SCRIPT_SRC=/home/packer/prefetch.sh CONTAINER_IMAGE_PREFETCH_SCRIPT_DEST=/opt/azure/containers/prefetch.sh - NODE_BOOTSTRAPPER_SRC=/home/packer/node-bootstrapper - NODE_BOOTSTRAPPER_DEST=/opt/azure/node-bootstrapper + AKS_NODE_CONTROLLER_SRC=/home/packer/aks-node-controller + AKS_NODE_CONTROLLER_DEST=/opt/azure/aks-node-controller CSE_REDACT_SRC=/home/packer/cse_redact_cloud_config.py CSE_REDACT_DEST=/opt/azure/containers/provision_redact_cloud_config.py @@ -246,13 +246,13 @@ copyPackerFiles() { CSE_HELPERS_DISTRO_DEST=/opt/azure/containers/provision_source_distro.sh cpAndMode $CSE_HELPERS_DISTRO_SRC $CSE_HELPERS_DISTRO_DEST 0744 - NODE_BOOTSTRAPPER_SRC=/home/packer/node-bootstrapper - NODE_BOOTSTRAPPER_DEST=/opt/azure/containers/node-bootstrapper - cpAndMode $NODE_BOOTSTRAPPER_SRC $NODE_BOOTSTRAPPER_DEST 755 + AKS_NODE_CONTROLLER_SRC=/home/packer/aks-node-controller + AKS_NODE_CONTROLLER_DEST=/opt/azure/containers/aks-node-controller + cpAndMode $AKS_NODE_CONTROLLER_SRC $AKS_NODE_CONTROLLER_DEST 755 - NODE_BOOTSTRAPPER_SERVICE_SRC=/home/packer/bootstrap.service - NODE_BOOTSTRAPPER_SERVICE_DEST=/etc/systemd/system/bootstrap.service - cpAndMode $NODE_BOOTSTRAPPER_SERVICE_SRC $NODE_BOOTSTRAPPER_SERVICE_DEST 0644 + AKS_NODE_CONTROLLER_SERVICE_SRC=/home/packer/aks-node-controller.service + AKS_NODE_CONTROLLER_SERVICE_DEST=/etc/systemd/system/aks-node-controller.service + cpAndMode $AKS_NODE_CONTROLLER_SERVICE_SRC $AKS_NODE_CONTROLLER_SERVICE_DEST 0644 NOTICE_SRC=/home/packer/NOTICE.txt NOTICE_DEST=/NOTICE.txt diff --git a/vhdbuilder/packer/pre-install-dependencies.sh b/vhdbuilder/packer/pre-install-dependencies.sh index 44a2206abd7..f0afc9b204c 100644 --- a/vhdbuilder/packer/pre-install-dependencies.sh +++ b/vhdbuilder/packer/pre-install-dependencies.sh @@ -72,8 +72,8 @@ capture_benchmark "${SCRIPT_NAME}_enable_modified_log_rotate_service" systemctlEnableAndStart sync-container-logs.service || exit 1 capture_benchmark "${SCRIPT_NAME}_sync_container_logs" -# enable bootstrap.service -systemctl enable bootstrap.service +# enable aks-node-controller.service +systemctl enable aks-node-controller.service # First handle Mariner + FIPS if isMarinerOrAzureLinux "$OS"; then diff --git a/vhdbuilder/packer/test/linux-vhd-content-test.sh b/vhdbuilder/packer/test/linux-vhd-content-test.sh index c12e03e774d..cedd9dd978e 100644 --- a/vhdbuilder/packer/test/linux-vhd-content-test.sh +++ b/vhdbuilder/packer/test/linux-vhd-content-test.sh @@ -964,21 +964,21 @@ testBccTools () { return 0 } -testNodeBootstrapperBinary () { - local test="testNodeBootstrapperBinary" - local go_binary_path="/opt/azure/containers/node-bootstrapper" +testAKSNodeControllerBinary () { + local test="testAKSNodeControllerBinary" + local go_binary_path="/opt/azure/containers/aks-node-controller" - echo "$test: checking existence of node-bootstrapper go binary at $go_binary_path" + echo "$test: checking existence of aks-node-controller go binary at $go_binary_path" if [ ! -f "$go_binary_path" ]; then - err "$test: node-bootstrapper go binary does not exist at $go_binary_path" + err "$test: aks-node-controller go binary does not exist at $go_binary_path" return 1 fi - echo "$test: node-bootstrapper go binary exists at $go_binary_path" + echo "$test: aks-node-controller go binary exists at $go_binary_path" } -testNodeBootstrapperService() { +testAKSNodeControllerService() { local test="testNBCParserService" - local service_name="bootstrap.service" + local service_name="aks-node-controller.service" echo "$test:Start" # is-enabled returns: @@ -1098,5 +1098,5 @@ testPamDSettings $OS_SKU $OS_VERSION testPam $OS_SKU $OS_VERSION testUmaskSettings testContainerImagePrefetchScript -testNodeBootstrapperBinary -testNodeBootstrapperService +testAKSNodeControllerBinary +testAKSNodeControllerService diff --git a/vhdbuilder/packer/vhd-image-builder-arm64-gen2.json b/vhdbuilder/packer/vhd-image-builder-arm64-gen2.json index 7758d3fa30e..77237e01d54 100644 --- a/vhdbuilder/packer/vhd-image-builder-arm64-gen2.json +++ b/vhdbuilder/packer/vhd-image-builder-arm64-gen2.json @@ -96,13 +96,13 @@ }, { "type": "file", - "source": "node-bootstrapper/bin/node-bootstrapper-linux-arm64", - "destination": "/home/packer/node-bootstrapper" + "source": "aks-node-controller/bin/aks-node-controller-linux-arm64", + "destination": "/home/packer/aks-node-controller" }, { "type": "file", - "source": "parts/linux/cloud-init/artifacts/bootstrap.service", - "destination": "/home/packer/bootstrap.service" + "source": "parts/linux/cloud-init/artifacts/aks-node-controller.service", + "destination": "/home/packer/aks-node-controller.service" }, { "type": "file", diff --git a/vhdbuilder/packer/vhd-image-builder-base.json b/vhdbuilder/packer/vhd-image-builder-base.json index 36a74f89c36..45fedfe60a3 100644 --- a/vhdbuilder/packer/vhd-image-builder-base.json +++ b/vhdbuilder/packer/vhd-image-builder-base.json @@ -98,13 +98,13 @@ }, { "type": "file", - "source": "node-bootstrapper/bin/node-bootstrapper-linux-amd64", - "destination": "/home/packer/node-bootstrapper" + "source": "aks-node-controller/bin/aks-node-controller-linux-amd64", + "destination": "/home/packer/aks-node-controller" }, { "type": "file", - "source": "parts/linux/cloud-init/artifacts/bootstrap.service", - "destination": "/home/packer/bootstrap.service" + "source": "parts/linux/cloud-init/artifacts/aks-node-controller.service", + "destination": "/home/packer/aks-node-controller.service" }, { "type": "file", diff --git a/vhdbuilder/packer/vhd-image-builder-mariner-arm64.json b/vhdbuilder/packer/vhd-image-builder-mariner-arm64.json index 9ce9891a0fb..2554d655548 100644 --- a/vhdbuilder/packer/vhd-image-builder-mariner-arm64.json +++ b/vhdbuilder/packer/vhd-image-builder-mariner-arm64.json @@ -95,13 +95,13 @@ }, { "type": "file", - "source": "node-bootstrapper/bin/node-bootstrapper-linux-arm64", - "destination": "/home/packer/node-bootstrapper" + "source": "aks-node-controller/bin/aks-node-controller-linux-arm64", + "destination": "/home/packer/aks-node-controller" }, { "type": "file", - "source": "parts/linux/cloud-init/artifacts/bootstrap.service", - "destination": "/home/packer/bootstrap.service" + "source": "parts/linux/cloud-init/artifacts/aks-node-controller.service", + "destination": "/home/packer/aks-node-controller.service" }, { "type": "file", diff --git a/vhdbuilder/packer/vhd-image-builder-mariner.json b/vhdbuilder/packer/vhd-image-builder-mariner.json index f296e6f00dc..b37028ec327 100644 --- a/vhdbuilder/packer/vhd-image-builder-mariner.json +++ b/vhdbuilder/packer/vhd-image-builder-mariner.json @@ -97,13 +97,13 @@ }, { "type": "file", - "source": "node-bootstrapper/bin/node-bootstrapper-linux-amd64", - "destination": "/home/packer/node-bootstrapper" + "source": "aks-node-controller/bin/aks-node-controller-linux-amd64", + "destination": "/home/packer/aks-node-controller" }, { "type": "file", - "source": "parts/linux/cloud-init/artifacts/bootstrap.service", - "destination": "/home/packer/bootstrap.service" + "source": "parts/linux/cloud-init/artifacts/aks-node-controller.service", + "destination": "/home/packer/aks-node-controller.service" }, { "type": "file",