Skip to content

Commit

Permalink
don't build nbcparser
Browse files Browse the repository at this point in the history
  • Loading branch information
r2k1 committed Oct 22, 2024
1 parent 5c894c2 commit 67798cd
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 182 deletions.
4 changes: 0 additions & 4 deletions .pipelines/templates/.builder-release-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ steps:
echo "##vso[task.setvariable variable=SKU_NAME]$SKU_NAME"
echo "Set SKU_NAME to $SKU_NAME"
displayName: Set SKU Name
- bash: |
./build.sh
displayName: Build node-bootstrapper
workingDirectory: node-bootstrapper
- bash: make -f packer.mk run-packer
displayName: Build VHD
retryCountOnTaskFailure: 3
Expand Down
46 changes: 27 additions & 19 deletions e2e/config/vhd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ const (

var (
VHDUbuntu1804Gen2Containerd = &Image{
Name: "1804gen2containerd",
OS: "ubuntu",
Arch: "amd64",
Name: "1804gen2containerd",
OS: "ubuntu",
Arch: "amd64",
Distro: datamodel.AKSUbuntuContainerd1804Gen2,
}
VHDUbuntu2204Gen2Arm64Containerd = &Image{
Name: "2204gen2arm64containerd",
OS: "ubuntu",
Arch: "arm64",
Name: "2204gen2arm64containerd",
OS: "ubuntu",
Arch: "arm64",
Distro: datamodel.AKSUbuntuArm64Containerd2204Gen2,
}
VHDUbuntu2204Gen2Containerd = &Image{
Name: "2204gen2containerd",
Expand All @@ -36,24 +38,28 @@ var (
Distro: datamodel.AKSUbuntuContainerd2404Gen2,
}
VHDAzureLinuxV2Gen2Arm64 = &Image{
Name: "AzureLinuxV2gen2arm64",
OS: "azurelinux",
Arch: "arm64",
Name: "AzureLinuxV2gen2arm64",
OS: "azurelinux",
Arch: "arm64",
Distro: datamodel.AKSAzureLinuxV2Arm64Gen2,
}
VHDAzureLinuxV2Gen2 = &Image{
Name: "AzureLinuxV2gen2",
OS: "azurelinux",
Arch: "amd64",
Name: "AzureLinuxV2gen2",
OS: "azurelinux",
Arch: "amd64",
Distro: datamodel.AKSAzureLinuxV2Gen2,
}
VHDCBLMarinerV2Gen2Arm64 = &Image{
Name: "CBLMarinerV2gen2arm64",
OS: "mariner",
Arch: "arm64",
Name: "CBLMarinerV2gen2arm64",
OS: "mariner",
Arch: "arm64",
Distro: datamodel.AKSCBLMarinerV2Arm64Gen2,
}
VHDCBLMarinerV2Gen2 = &Image{
Name: "CBLMarinerV2gen2",
OS: "mariner",
Arch: "amd64",
Name: "CBLMarinerV2gen2",
OS: "mariner",
Arch: "amd64",
Distro: datamodel.AKSCBLMarinerV2Gen2,
}
// this is a particular 2204gen2containerd image originally built with private packages,
// if we ever want to update this then we'd need to run a new VHD build using private package overrides
Expand All @@ -62,6 +68,7 @@ var (
OS: "ubuntu",
Arch: "amd64",
Version: "1.1704411049.2812",
Distro: datamodel.AKSUbuntuContainerd2404Gen2,
}

// without kubelet, kubectl, credential-provider and wasm
Expand All @@ -70,17 +77,18 @@ var (
OS: "ubuntu",
Arch: "amd64",
Version: "1.1725612526.29638",
Distro: datamodel.AKSUbuntuContainerd2404Gen2,
}
)

var ErrNotFound = fmt.Errorf("not found")

type Image struct {
Arch string
Distro datamodel.Distro
Name string
OS string
Version string
Distro datamodel.Distro

vhd VHDResourceID
vhdOnce sync.Once
Expand Down
54 changes: 0 additions & 54 deletions nbcparser/main.go

This file was deleted.

2 changes: 0 additions & 2 deletions node-bootstrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
node-bootstrapper.log
node-bootstrapper
dist
8 changes: 0 additions & 8 deletions node-bootstrapper/build.sh

This file was deleted.

18 changes: 10 additions & 8 deletions packer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ifeq (${ARCHITECTURE},ARM64)
GOARCH=arm64
endif

build-packer: generate-prefetch-scripts build-nbcparser-all build-lister-binary
build-packer: generate-prefetch-scripts build-node-bootstrapper build-lister-binary
ifeq (${ARCHITECTURE},ARM64)
@echo "${MODE}: Building with Hyper-v generation 2 ARM64 VM"
ifeq (${OS_SKU},Ubuntu)
Expand Down Expand Up @@ -112,13 +112,15 @@ 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-nbcparser-all:
@$(MAKE) -f packer.mk build-nbcparser-binary ARCH=amd64
@$(MAKE) -f packer.mk build-nbcparser-binary ARCH=arm64

build-nbcparser-binary:
@echo "Building nbcparser binary"
@bash -c "pushd nbcparser && CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -o bin/nbcparser-$(ARCH) main.go && popd"
build-node-bootstrapper:
@echo "Building node bootstrapper binaries"
@bash -c "pushd node-bootstrapper && \
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 && \
popd"

build-lister-binary:
@echo "Building lister binary for $(GOARCH)"
Expand Down
2 changes: 1 addition & 1 deletion parts/linux/cloud-init/artifacts/bootstrap.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Wants=cloud-init.target

[Service]
Type=oneshot
ExecStart=/bin/bash /opt/azure/containers/bootstrap.sh
ExecStart=/opt/azure/containers/node-bootstrapper provision --provision-config=/opt/azure/containers/node-bootstrapper-config.json
RemainAfterExit=No

[Install]
Expand Down
8 changes: 0 additions & 8 deletions parts/linux/cloud-init/artifacts/bootstrap.sh

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/agent/bakerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func getScriptlessCustomDataTemplate(config any) (string, error) {
encodedNBCJson := base64.StdEncoding.EncodeToString(nbcJSON)
customDataTAML := fmt.Sprintf(`#cloud-config
write_files:
- path: /opt/azure/containers/nbc.json
- path: /opt/azure/containers/node-bootstrapper-config.json
permissions: "0755"
owner: root
content: !!binary |
Expand Down
17 changes: 6 additions & 11 deletions vhdbuilder/packer/packer_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,13 @@ copyPackerFiles() {
CSE_HELPERS_DISTRO_DEST=/opt/azure/containers/provision_source_distro.sh
cpAndMode $CSE_HELPERS_DISTRO_SRC $CSE_HELPERS_DISTRO_DEST 0744

NBC_PARSER_SRC=/home/packer/nbcparser
NBC_PARSER_DEST=/opt/azure/containers/nbcparser
cpAndMode $NBC_PARSER_SRC $NBC_PARSER_DEST 0755

NBCPARSER_SERVICE_SRC=/home/packer/bootstrap.service
NBCPARSER_SERVICE_DEST=/etc/systemd/system/bootstrap.service
cpAndMode $NBCPARSER_SERVICE_SRC $NBCPARSER_SERVICE_DEST 0644
NODE_BOOTSTRAPPER_SRC=/home/packer/node-bootstrapper
NODE_BOOTSTRAPPER_DEST=/opt/azure/containers/node-bootstrapper
cpAndMode $NODE_BOOTSTRAPPER_SRC $NODE_BOOTSTRAPPER_DEST 755

NBCPARSER_SCRIPT_SRC=/home/packer/bootstrap.sh
NBCPARSER_SCRIPT_DEST=/opt/azure/containers/bootstrap.sh
cpAndMode $NBCPARSER_SCRIPT_SRC $NBCPARSER_SCRIPT_DEST 0744
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

NOTICE_SRC=/home/packer/NOTICE.txt
NOTICE_DEST=/NOTICE.txt
Expand Down Expand Up @@ -367,7 +363,6 @@ copyPackerFiles() {

# Copy the generated CNI prefetch script to the appropriate location so AIB can invoke it later
cpAndMode $CONTAINER_IMAGE_PREFETCH_SCRIPT_SRC $CONTAINER_IMAGE_PREFETCH_SCRIPT_DEST 644
cpAndMode $NODE_BOOTSTRAPPER_SRC $NODE_BOOTSTRAPPER_DEST 755
}

cpAndMode() {
Expand Down
28 changes: 10 additions & 18 deletions vhdbuilder/packer/test/linux-vhd-content-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -961,16 +961,16 @@ testBccTools () {
return 0
}

testNBCParserBinary () {
testNodeBootstrapperBinary () {
local test="testNBCParserBinary"
local go_binary_path="/opt/azure/containers/nbcparser"
local go_binary_path="/opt/azure/containers/node-bootstrapper"

echo "$test: checking existence of nbcparser go binary at $go_binary_path"
echo "$test: checking existence of node-bootstrapper go binary at $go_binary_path"
if [ ! -f "$go_binary_path" ]; then
err "$test: nbcparser go binary does not exist at $go_binary_path"
err "$test: node-bootstrapper go binary does not exist at $go_binary_path"
return 1
fi
echo "$test: nbcparser go binary exists at $go_binary_path"
echo "$test: node-bootstrapper go binary exists at $go_binary_path"

file_path="config.json"
# define sample nbc content
Expand Down Expand Up @@ -998,28 +998,20 @@ testNBCParserBinary () {
}'
echo -n "$nbc_content" > "$file_path"

errs=$($go_binary_path --bootstrap-config="$file_path" --test 2>/dev/null)
errs=$($go_binary_path provision --provision-config="$file_path" --test 2>/dev/null)
code=$?
if [ $code -ne 0 ]; then
err "$test: nbcparser go binary exited with code $code, stderr:\n$errs"
err "$test: node-bootstrapper go binary exited with code $code, stderr:\n$errs"
return 1
fi
echo "$test: nbcparser go binary ran successfully"
echo "$test: node-bootstrapper go binary ran successfully"
}

testNBCParserService() {
testNodeBootstrapperService() {
local test="testNBCParserService"
local service_name="bootstrap.service"
local script_path="/opt/azure/containers/bootstrap.sh"
echo "$test:Start"

echo "$test: checking existence of nbcparser script invoked by systemd unit at $script_path"
if [ ! -f "$script_path" ]; then
err "$test: bootstrap.sh does not exist at $script_path"
return 1
fi
echo "$test: bootstrap.sh exists at $script_path"

# is-enabled returns:
# 'enabled' if the service is enabled.
# empty string if the service is not installed.
Expand Down Expand Up @@ -1138,4 +1130,4 @@ testPam $OS_SKU $OS_VERSION
testUmaskSettings
testContainerImagePrefetchScript
testNBCParserBinary
testNBCParserService
testNodeBootstrapperService
14 changes: 2 additions & 12 deletions vhdbuilder/packer/vhd-image-builder-arm64-gen2.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,21 @@
"sudo chown -R $USER /opt/certs"
]
},
{
"type": "file",
"source": "node-bootstrapper/dist/node-bootstrapper-linux-arm64",
"destination": "/home/packer/node-bootstrapper"
},
{
"type": "file",
"source": "vhdbuilder/lister/bin/lister",
"destination": "/home/packer/lister"
},
{
"type": "file",
"source": "nbcparser/bin/nbcparser-arm64",
"destination": "/home/packer/nbcparser"
"source": "node-bootstrapper/bin/node-bootstrapper-linux-arm64",
"destination": "/home/packer/node-bootstrapper"
},
{
"type": "file",
"source": "parts/linux/cloud-init/artifacts/bootstrap.service",
"destination": "/home/packer/bootstrap.service"
},
{
"type": "file",
"source": "parts/linux/cloud-init/artifacts/bootstrap.sh",
"destination": "/home/packer/bootstrap.sh"
},
{
"type": "file",
"source": "vhdbuilder/packer/prefetch.sh",
Expand Down
14 changes: 2 additions & 12 deletions vhdbuilder/packer/vhd-image-builder-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,21 @@
"sudo chown -R $USER /opt/certs"
]
},
{
"type": "file",
"source": "node-bootstrapper/dist/node-bootstrapper-linux-amd64",
"destination": "/home/packer/node-bootstrapper"
},
{
"type": "file",
"source": "vhdbuilder/lister/bin/lister",
"destination": "/home/packer/lister"
},
{
"type": "file",
"source": "nbcparser/bin/nbcparser-amd64",
"destination": "/home/packer/nbcparser"
"source": "node-bootstrapper/bin/node-bootstrapper-linux-amd64",
"destination": "/home/packer/node-bootstrapper"
},
{
"type": "file",
"source": "parts/linux/cloud-init/artifacts/bootstrap.service",
"destination": "/home/packer/bootstrap.service"
},
{
"type": "file",
"source": "parts/linux/cloud-init/artifacts/bootstrap.sh",
"destination": "/home/packer/bootstrap.sh"
},
{
"type": "file",
"source": "vhdbuilder/packer/prefetch.sh",
Expand Down
Loading

0 comments on commit 67798cd

Please sign in to comment.