diff --git a/Makefile b/Makefile index 8c7edef99ca..33523370e55 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,6 @@ else LDFLAGS := -s -X main.version=$(VERSION) endif BINARY_DEST_DIR ?= bin -PARSER_DIR := $(CURDIR)/pkg/parser ifeq ($(OS),Windows_NT) EXTENSION = .exe @@ -86,17 +85,10 @@ validate-image-version: generate-kubelet-flags: @./e2e/kubelet/generate-kubelet-flags.sh -.PHONY: update-contract -update-contract: compile-proto-files build-parser-binary - .PHONY: compile-proto-files compile-proto-files: @./hack/tools/bin/buf generate -o . --path ./pkg/proto/ --template ./pkg/proto/buf.gen.yaml -.PHONY: build-parser-binary -build-parser-binary: - @go build $(GOFLAGS) -v -ldflags "$(LDFLAGS)" -o $(PARSER_DIR)/bin/parser $(PARSER_DIR)/cmd/main.go - .PHONY: generate generate: bootstrap @echo $(GOFLAGS) diff --git a/packer.mk b/packer.mk index ea98c4a6c19..a30a9a55036 100755 --- a/packer.mk +++ b/packer.mk @@ -1,6 +1,6 @@ SHELL=/bin/bash -o pipefail -build-packer: +build-packer: build-nbcparser-binary ifeq (${MODE},linuxVhdMode) @echo "${MODE}: Generating prefetch scripts" @bash -c "pushd vhdbuilder/prefetch; go run main.go --components=../packer/components.json --container-image-prefetch-script=../packer/prefetch.sh; popd" @@ -97,3 +97,7 @@ convert-sig-to-classic-storage-account-blob: az-login test-building-vhd: az-login @./vhdbuilder/packer/test/run-test.sh + +build-nbcparser-binary: + @echo "Building nbcparser binary" + @bash -c "pushd pkg/nbcparser; go build main.go -o bin/nbcparser" \ No newline at end of file diff --git a/pkg/nbcparser/go.mod b/pkg/nbcparser/go.mod new file mode 100644 index 00000000000..f288430265d --- /dev/null +++ b/pkg/nbcparser/go.mod @@ -0,0 +1,31 @@ +module github.com/Azure/agentbaker/pkg/nbcparser + +go 1.21.3 + +require ( + github.com/Azure/agentbaker v0.20240503.0 + github.com/Azure/go-autorest/autorest/to v0.4.0 +) + +require ( + github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/blang/semver v3.5.1+incompatible // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/nxadm/tail v1.4.8 // indirect + github.com/pkg/errors v0.9.1 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/apimachinery v0.26.2 // indirect +) + +require ( + github.com/Azure/go-autorest v14.2.0+incompatible // indirect + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.33.1 +) diff --git a/pkg/nbcparser/go.sum b/pkg/nbcparser/go.sum new file mode 100644 index 00000000000..c9f454bb28d --- /dev/null +++ b/pkg/nbcparser/go.sum @@ -0,0 +1,126 @@ +github.com/Azure/agentbaker v0.20240503.0 h1:NBNiRRjdNolIvPLt+819mvMvvgWQQNuU3hVlbn40k/4= +github.com/Azure/agentbaker v0.20240503.0/go.mod h1:4taz9ipeevqDxKnnLmD3+e/xBfsvj9MSuSjGXDSfK7Q= +github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk= +github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= +github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= +github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= +k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= diff --git a/pkg/parser/bin/parser b/pkg/nbcparser/main similarity index 51% rename from pkg/parser/bin/parser rename to pkg/nbcparser/main index 742d611f089..9bf0f72886a 100755 Binary files a/pkg/parser/bin/parser and b/pkg/nbcparser/main differ diff --git a/pkg/parser/cmd/main.go b/pkg/nbcparser/main.go similarity index 94% rename from pkg/parser/cmd/main.go rename to pkg/nbcparser/main.go index 9a0e9756080..861753ceb08 100644 --- a/pkg/parser/cmd/main.go +++ b/pkg/nbcparser/main.go @@ -4,7 +4,7 @@ import ( "log" "os" - "github.com/Azure/agentbaker/pkg/parser" + "github.com/Azure/agentbaker/pkg/nbcparser/pkg/parser" ) // input to this function will be the serialized JSON from userdata + custom data. diff --git a/pkg/parser/consts.go b/pkg/nbcparser/pkg/parser/consts.go similarity index 100% rename from pkg/parser/consts.go rename to pkg/nbcparser/pkg/parser/consts.go diff --git a/pkg/parser/helper.go b/pkg/nbcparser/pkg/parser/helper.go similarity index 99% rename from pkg/parser/helper.go rename to pkg/nbcparser/pkg/parser/helper.go index 0ba61523289..3d0b75285d0 100644 --- a/pkg/parser/helper.go +++ b/pkg/nbcparser/pkg/parser/helper.go @@ -39,9 +39,9 @@ import ( ) var ( - //go:embed kubenet-cni.json.gtpl + //go:embed templates/kubenet-cni.json.gtpl kubenetTemplateContent []byte - //go:embed containerd.toml.gtpl + //go:embed templates/containerd.toml.gtpl containerdConfigTemplateText string //nolint:gochecknoglobals containerdConfigTemplate = template.Must( diff --git a/pkg/parser/helper_test.go b/pkg/nbcparser/pkg/parser/helper_test.go similarity index 100% rename from pkg/parser/helper_test.go rename to pkg/nbcparser/pkg/parser/helper_test.go diff --git a/pkg/parser/parser.go b/pkg/nbcparser/pkg/parser/parser.go similarity index 97% rename from pkg/parser/parser.go rename to pkg/nbcparser/pkg/parser/parser.go index 76b025e1ff5..68f14b7098d 100644 --- a/pkg/parser/parser.go +++ b/pkg/nbcparser/pkg/parser/parser.go @@ -12,7 +12,7 @@ import ( ) var ( - //go:embed cse_cmd.sh.gtpl + //go:embed templates/cse_cmd.sh.gtpl bootstrapTrigger string bootstrapTriggerTemplate = template.Must(template.New("triggerBootstrapScript").Funcs(getFuncMap()).Parse(bootstrapTrigger)) //nolint:gochecknoglobals diff --git a/pkg/parser/parser_suite_test.go b/pkg/nbcparser/pkg/parser/parser_suite_test.go similarity index 100% rename from pkg/parser/parser_suite_test.go rename to pkg/nbcparser/pkg/parser/parser_suite_test.go diff --git a/pkg/parser/parser_test.go b/pkg/nbcparser/pkg/parser/parser_test.go similarity index 99% rename from pkg/parser/parser_test.go rename to pkg/nbcparser/pkg/parser/parser_test.go index cf0c20773e3..f5e6632b358 100644 --- a/pkg/parser/parser_test.go +++ b/pkg/nbcparser/pkg/parser/parser_test.go @@ -10,7 +10,7 @@ import ( "strings" "github.com/Azure/agentbaker/pkg/agent/datamodel" - "github.com/Azure/agentbaker/pkg/parser" + "github.com/Azure/agentbaker/pkg/nbcparser/pkg/parser" nbcontractv1 "github.com/Azure/agentbaker/pkg/proto/nbcontract/v1" "github.com/Azure/go-autorest/autorest/to" diff --git a/pkg/parser/containerd.toml.gtpl b/pkg/nbcparser/pkg/parser/templates/containerd.toml.gtpl similarity index 100% rename from pkg/parser/containerd.toml.gtpl rename to pkg/nbcparser/pkg/parser/templates/containerd.toml.gtpl diff --git a/pkg/parser/cse_cmd.sh.gtpl b/pkg/nbcparser/pkg/parser/templates/cse_cmd.sh.gtpl similarity index 100% rename from pkg/parser/cse_cmd.sh.gtpl rename to pkg/nbcparser/pkg/parser/templates/cse_cmd.sh.gtpl diff --git a/pkg/parser/kubenet-cni.json.gtpl b/pkg/nbcparser/pkg/parser/templates/kubenet-cni.json.gtpl similarity index 100% rename from pkg/parser/kubenet-cni.json.gtpl rename to pkg/nbcparser/pkg/parser/templates/kubenet-cni.json.gtpl diff --git a/pkg/parser/testdata/test_nbc.json b/pkg/nbcparser/testdata/test_nbc.json similarity index 100% rename from pkg/parser/testdata/test_nbc.json rename to pkg/nbcparser/testdata/test_nbc.json diff --git a/pkg/parser/testdata/test_nbc_fields_missing.json b/pkg/nbcparser/testdata/test_nbc_fields_missing.json similarity index 100% rename from pkg/parser/testdata/test_nbc_fields_missing.json rename to pkg/nbcparser/testdata/test_nbc_fields_missing.json diff --git a/pkg/parser/testdata/test_nbc_fields_unexpected.json b/pkg/nbcparser/testdata/test_nbc_fields_unexpected.json similarity index 100% rename from pkg/parser/testdata/test_nbc_fields_unexpected.json rename to pkg/nbcparser/testdata/test_nbc_fields_unexpected.json diff --git a/vhdbuilder/packer/packer_source.sh b/vhdbuilder/packer/packer_source.sh index f965536c537..82148cbe819 100644 --- a/vhdbuilder/packer/packer_source.sh +++ b/vhdbuilder/packer/packer_source.sh @@ -240,9 +240,9 @@ copyPackerFiles() { CSE_HELPERS_DISTRO_DEST=/opt/azure/containers/provision_source_distro.sh cpAndMode $CSE_HELPERS_DISTRO_SRC $CSE_HELPERS_DISTRO_DEST 0744 - PARSER_SRC=/home/packer/parser - PARSER_DEST=/opt/azure/containers/parser - cpAndMode $PARSER_SRC $PARSER_DEST 0755 + NBC_PARSER_SRC=/home/packer/nbcparser + NBC_PARSER_DEST=/opt/azure/containers/nbcparser + cpAndMode $NBC_PARSER_SRC $NBC_PARSER_DEST 0755 NOTICE_SRC=/home/packer/NOTICE.txt NOTICE_DEST=/NOTICE.txt diff --git a/vhdbuilder/packer/test/linux-vhd-content-test.sh b/vhdbuilder/packer/test/linux-vhd-content-test.sh index 61ed2d08b67..734b942af48 100644 --- a/vhdbuilder/packer/test/linux-vhd-content-test.sh +++ b/vhdbuilder/packer/test/linux-vhd-content-test.sh @@ -869,6 +869,18 @@ testBccTools () { return 0 } +testNBCParserBinary () { + local test="testNBCParserBinary" + local go_binary_path="/opt/azure/containers/nbcparser" + + echo "$test: checking existence of nbcparser go binary at $go_binary_path" + if [ ! -f "$go_binary_path" ]; then + err "$test: nbcparser go binary does not exist at $go_binary_path" + return 1 + fi + echo "$test: nbcparser go binary exists at $go_binary_path" +} + # As we call these tests, we need to bear in mind how the test results are processed by the # the caller in run-tests.sh. That code uses az vm run-command invoke to run this script # on a VM. It then looks at stderr to see if any errors were reported. Notably it doesn't @@ -904,3 +916,4 @@ testPamDSettings $OS_SKU $OS_VERSION testPam $OS_SKU $OS_VERSION testUmaskSettings testContainerImagePrefetchScript +testNBCParserBinary diff --git a/vhdbuilder/packer/vhd-image-builder-base.json b/vhdbuilder/packer/vhd-image-builder-base.json index 61cf58c217a..a4dd879ebf8 100644 --- a/vhdbuilder/packer/vhd-image-builder-base.json +++ b/vhdbuilder/packer/vhd-image-builder-base.json @@ -89,8 +89,8 @@ }, { "type": "file", - "source": "pkg/parser/bin/parser", - "destination": "/home/packer/parser" + "source": "pkg/nbcparser/bin/nbcparser", + "destination": "/home/packer/nbcparser" }, { "type": "file",