2022-02-16 04:00:04 +03:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Default platform commands
|
2022-09-01 21:35:01 +03:00
|
|
|
SHELL = /bin/bash
|
|
|
|
MKDIR := mkdir -p
|
|
|
|
RMDIR := rm -rf
|
2021-09-18 01:05:32 +03:00
|
|
|
ARCHIVE_CMD = tar -czvf
|
2021-09-09 00:46:32 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Default platform extensions
|
|
|
|
ARCHIVE_EXT = tgz
|
|
|
|
|
|
|
|
# Windows specific commands
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
MKDIR := powershell.exe -NoProfile -Command New-Item -ItemType Directory -Force
|
|
|
|
RMDIR := powershell.exe -NoProfile -Command Remove-Item -Recurse -Force
|
|
|
|
endif
|
|
|
|
|
2021-09-30 22:52:36 +03:00
|
|
|
# Build defaults.
|
2022-09-01 21:35:01 +03:00
|
|
|
GOOS ?= $(shell go env GOOS)
|
|
|
|
GOARCH ?= $(shell go env GOARCH)
|
|
|
|
GOOSES ?= "linux windows" # To override at the cli do: GOOSES="\"darwin bsd\""
|
2021-09-30 22:52:36 +03:00
|
|
|
GOARCHES ?= "amd64 arm64" # To override at the cli do: GOARCHES="\"ppc64 mips\""
|
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Windows specific extensions
|
2022-09-01 21:35:01 +03:00
|
|
|
# set these based on the GOOS, not the OS
|
2021-09-18 01:05:32 +03:00
|
|
|
ifeq ($(GOOS),windows)
|
|
|
|
ARCHIVE_CMD = zip -9lq
|
|
|
|
ARCHIVE_EXT = zip
|
2022-09-01 21:35:01 +03:00
|
|
|
EXE_EXT = .exe
|
2021-09-18 01:05:32 +03:00
|
|
|
endif
|
2018-07-20 00:23:11 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
# Interrogate the git repo and set some variables
|
2023-10-31 00:51:58 +03:00
|
|
|
REPO_ROOT = $(shell git rev-parse --show-toplevel)
|
|
|
|
REVISION ?= $(shell git rev-parse --short HEAD)
|
2024-06-12 00:40:37 +03:00
|
|
|
ACN_VERSION ?= $(shell git describe --exclude "azure-ipam*" --exclude "dropgz*" --exclude "zapai*" --exclude "ipv6-hp-bpf*" --tags --always)
|
2024-09-30 20:23:06 +03:00
|
|
|
IPV6_HP_BPF_VERSION ?= $(notdir $(shell git describe --match "ipv6-hp-bpf*" --tags --always))
|
2023-10-31 00:51:58 +03:00
|
|
|
AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always))
|
|
|
|
CNI_VERSION ?= $(ACN_VERSION)
|
|
|
|
CNS_VERSION ?= $(ACN_VERSION)
|
|
|
|
NPM_VERSION ?= $(ACN_VERSION)
|
|
|
|
ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always))
|
2022-09-01 21:35:01 +03:00
|
|
|
|
2017-03-11 03:49:07 +03:00
|
|
|
# Build directories.
|
2022-07-29 00:11:05 +03:00
|
|
|
AZURE_IPAM_DIR = $(REPO_ROOT)/azure-ipam
|
2024-05-30 23:43:37 +03:00
|
|
|
IPV6_HP_BPF_DIR = $(REPO_ROOT)/bpf-prog/ipv6-hp-bpf
|
2024-08-24 05:45:06 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
CNI_NET_DIR = $(REPO_ROOT)/cni/network/plugin
|
|
|
|
CNI_IPAM_DIR = $(REPO_ROOT)/cni/ipam/plugin
|
2024-04-25 22:39:01 +03:00
|
|
|
STATELESS_CNI_NET_DIR = $(REPO_ROOT)/cni/network/stateless
|
2021-09-18 01:05:32 +03:00
|
|
|
CNI_IPAMV6_DIR = $(REPO_ROOT)/cni/ipam/pluginv6
|
|
|
|
CNI_TELEMETRY_DIR = $(REPO_ROOT)/cni/telemetry/service
|
|
|
|
ACNCLI_DIR = $(REPO_ROOT)/tools/acncli
|
|
|
|
CNS_DIR = $(REPO_ROOT)/cns/service
|
|
|
|
NPM_DIR = $(REPO_ROOT)/npm/cmd
|
|
|
|
OUTPUT_DIR = $(REPO_ROOT)/output
|
2017-02-21 23:18:11 +03:00
|
|
|
BUILD_DIR = $(OUTPUT_DIR)/$(GOOS)_$(GOARCH)
|
2022-09-07 00:07:56 +03:00
|
|
|
AZURE_IPAM_BUILD_DIR = $(BUILD_DIR)/azure-ipam
|
2024-05-30 23:43:37 +03:00
|
|
|
IPV6_HP_BPF_BUILD_DIR = $(BUILD_DIR)/bpf-prog/ipv6-hp-bpf
|
2021-03-26 00:08:02 +03:00
|
|
|
IMAGE_DIR = $(OUTPUT_DIR)/images
|
2024-08-24 05:45:06 +03:00
|
|
|
|
2017-05-06 04:12:40 +03:00
|
|
|
CNI_BUILD_DIR = $(BUILD_DIR)/cni
|
2020-10-21 00:00:40 +03:00
|
|
|
ACNCLI_BUILD_DIR = $(BUILD_DIR)/acncli
|
2024-04-25 22:39:01 +03:00
|
|
|
STATELESS_CNI_BUILD_DIR = $(CNI_BUILD_DIR)/stateless
|
2018-07-07 02:08:36 +03:00
|
|
|
CNI_MULTITENANCY_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy
|
feat: Add SNAT bridge to Native, decouple SNAT bridge (#1506)
* Native Endpoint Client Add Endpoints
* AddEndpointRules, ConfigureContainerInterfacesAndRoutes
* Changed interface names, log statements
nw.extIf.Name > eth0 (eth0)
eth0.vlanid > eth0.X (eth0.1)
%s%s hostIfName > vnet (A1veth0)
%s%s-2 contIfName > container (B1veth0)
* Renaming, using lib to set ns
* Namespace "path" is /var/run/netns/<NS>
* Loopback set up, Remove auto kernel subnet route
* Cannot set link to up if it's in another NS
* Multiple containers on same VNET NS
* Delete Endpoint routes on Delete
* Minimizing netns usage
* Moving NS Exec Code
* Further minimized netns.Set usage
* Moved helper methods down, drafted tests
* Removed DevName from Route Info, more tests
* Test existing vnet ns, delete endpoint
* NetNS interface for testing
* Separated tests by namespace
* Endpoints delete if they cannot be moved into NS
* Namespace netns tests
* Added Native Client to deleteEndpointImpl
* Deletion of Endpoints Impl and Tests
* Cleaned code (Tests ok)
* Moved mock/netns to package (Tests ok)
* Fixing Netns (wip)
Moved netnsinterface to consumer package (network).
Removed "Netns" from "NewNetns" and "NewMockNetns" as it is unambiguous.
Changed uintptr to int and casted the int to uintptr when needed later.
* Using errors.Wrap for error context (wip)
* Removed sentence case (wip)
* Removing variable predeclaration
* Removed NewNativeEndpointClient
Directly instantiating struct because nothing special happens in NewNativeEndpointClient
* Removed generics from ExecuteInNS
* Removed uintptr from mocknetns, tests compile
Forgot to remove uintptr from mocknetns
* Fix tests, lint
* Fixes from linter
Works on VMSS
* Replacing references to ethX with vlan veth
* Removed unnecessary log
* Removed unnecessary mac, fix tests
* Mockns method name enum
* Unable to use GetNetworkInterfaceByName due to NS
If I use GetNetworkInterface, I need to be in the vnet NS, but that means I will need to call ExecuteInNS, which causes tests to fail.
* Fixes from linter
* Assume if NS exists, vlan veth exists
Tests ok
* Fixes for Linter
* Snat refactor
* Fix delete tests
* Fix delete tests bug
* More snat refactor
* Breaking, prepping for Native Snat
Delete native endpoint snat route linux to remove errors and in theory, ovs should work fine again.
* Go mod tidy for linting
Hopefully this fixes the windows lint error
* Add fields to native endpoint client for snat
* Using New() func to create Native Client
Creation of the native endpoint client is too complicated to directly instantiate.
* Snat defaults
* Insert SNAT entry points
* Native Snat error handling
* Breaking, decouple ovsctl from snat
Proposed Solution implementation
Moved ovsctlClient.AddPortOnOVSBridge to ovs_endpoint_snatroute_linux.go. Removed ovsctlclient from NewSnatClient. Removed ovsctlClient from testing file.
* Delete unecessary ovssnat files
* No lint on vishvananda netns
Maybe this will fix the windows linter?
* Build linux only for netns package
Maybe this fixes the linter error?
* Remove nolint to see if linter fails
* Breaking, removed bridgeName
bridgeName refers to the OVS Switch I believe
* If native uses snat bridge, should also get IP
* Breaking, Decouple or Wrap snat route
* Check to see if snat triggered
* Snat behaviors specific to ovs/native
* Pass the pointer
Add/Delete ok
* Renaming to make consts public
* Breaking, moving ovs specific parts of snat to ovs
* Remove enable infra vnet (Tests ok)
Tested:
Allow Host to NC only
Allow NC to Host only
Allow both
Wget
Ping between containers
Warning: Enable snat is still hard coded to true!!!
* Move add port to after exists() check
* Moved netns interface to caller, generalized tests
Tests ok, Native ok
* Typos
* Reordered if statement, unwrapped arp
Tests ok, ping ok, wget ok
* Linted, wrapping errors
* Go fumpt entire network package
* Code markers removed, clean (Tests ok)
OVS & Native:
- Ping between two containers same VM, no packets on bridge
- Ping between two containers diff VM, no packets on bridge
- Ping other container not in vnet, no packets on bridge
- Ping snat to container, packets on bridge
- Ping container to snat, packets on bridge
- Tcpdump confirmed on azSnatBr
- Deletion of containers deletes appropriate interfaces
* Renamed veth, fixed logs
* Made deleteEndpoints logic clearer, renamed error
* Renamed eth0 to primaryHostIfName, vlanEth to vlanIf
* Deleted debug log
* Corrected merge (hardware addr) (Tests ok)
* Renamed vlan veth to hostExtIf_vlanID, Disabled RA
eth0.2 makes disable RA look for a folder eth0 and then another sub folder "2". ("eth0/2") However, it should look for a folder named "eth0.2" literally. To solve this, we change the naming scheme to use an underscore instead. (Tests ok)
* Renamed Native to TransparentVlan
Confirmed basic functionality on VM with correct mode
* Make file updated
* Create azure-windows-multitenancy-transparent-vlan.conflist
* Unified snat err format
* Rename to transparent-vlan
* Route table support added to local netlink
* Moved SNAT to end of function
* Defer deleting vlan interface on failure
2022-08-10 23:50:26 +03:00
|
|
|
CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy-transparent-vlan
|
2020-10-29 20:32:21 +03:00
|
|
|
CNI_SWIFT_BUILD_DIR = $(BUILD_DIR)/cni-swift
|
2022-05-06 20:14:46 +03:00
|
|
|
CNI_OVERLAY_BUILD_DIR = $(BUILD_DIR)/cni-overlay
|
2021-03-26 20:28:42 +03:00
|
|
|
CNI_BAREMETAL_BUILD_DIR = $(BUILD_DIR)/cni-baremetal
|
2023-04-30 00:50:44 +03:00
|
|
|
CNI_DUALSTACK_BUILD_DIR = $(BUILD_DIR)/cni-dualstack
|
2018-02-22 23:57:03 +03:00
|
|
|
CNS_BUILD_DIR = $(BUILD_DIR)/cns
|
2018-07-20 00:23:11 +03:00
|
|
|
NPM_BUILD_DIR = $(BUILD_DIR)/npm
|
2021-05-28 19:34:04 +03:00
|
|
|
TOOLS_DIR = $(REPO_ROOT)/build/tools
|
|
|
|
TOOLS_BIN_DIR = $(TOOLS_DIR)/bin
|
2020-01-15 01:53:24 +03:00
|
|
|
CNI_AI_ID = 5515a1eb-b2bc-406a-98eb-ba462e6f0411
|
2021-09-29 00:17:25 +03:00
|
|
|
CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
|
2020-01-24 00:52:30 +03:00
|
|
|
NPM_AI_ID = 014c22bd-4107-459e-8475-67909e96edcb
|
2020-01-15 01:53:24 +03:00
|
|
|
ACN_PACKAGE_PATH = github.com/Azure/azure-container-networking
|
2021-09-29 00:17:25 +03:00
|
|
|
CNI_AI_PATH=$(ACN_PACKAGE_PATH)/telemetry.aiMetadata
|
|
|
|
CNS_AI_PATH=$(ACN_PACKAGE_PATH)/cns/logger.aiMetadata
|
|
|
|
NPM_AI_PATH=$(ACN_PACKAGE_PATH)/npm.aiMetadata
|
2017-01-05 03:21:14 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Tool paths
|
2022-09-01 21:35:01 +03:00
|
|
|
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
|
|
|
|
GOCOV := $(TOOLS_BIN_DIR)/gocov
|
|
|
|
GOCOV_XML := $(TOOLS_BIN_DIR)/gocov-xml
|
|
|
|
GOFUMPT := $(TOOLS_BIN_DIR)/gofumpt
|
|
|
|
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
|
2021-09-18 01:05:32 +03:00
|
|
|
GO_JUNIT_REPORT := $(TOOLS_BIN_DIR)/go-junit-report
|
2022-09-01 21:35:01 +03:00
|
|
|
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
|
2017-06-29 22:01:28 +03:00
|
|
|
|
|
|
|
# Archive file names.
|
2022-09-01 21:35:01 +03:00
|
|
|
ACNCLI_ARCHIVE_NAME = acncli-$(GOOS)-$(GOARCH)-$(ACN_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_ARCHIVE_NAME = azure-vnet-cni-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_MULTITENANCY_ARCHIVE_NAME = azure-vnet-cni-multitenancy-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_MULTITENANCY_TRANSPARENT_VLAN_ARCHIVE_NAME = azure-vnet-cni-multitenancy-transparent-vlan-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_SWIFT_ARCHIVE_NAME = azure-vnet-cni-swift-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_OVERLAY_ARCHIVE_NAME = azure-vnet-cni-overlay-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
|
|
|
CNI_BAREMETAL_ARCHIVE_NAME = azure-vnet-cni-baremetal-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
2023-04-30 00:50:44 +03:00
|
|
|
CNI_DUALSTACK_ARCHIVE_NAME = azure-vnet-cni-overlay-dualstack-$(GOOS)-$(GOARCH)-$(CNI_VERSION).$(ARCHIVE_EXT)
|
2024-08-24 05:45:06 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
CNS_ARCHIVE_NAME = azure-cns-$(GOOS)-$(GOARCH)-$(CNS_VERSION).$(ARCHIVE_EXT)
|
|
|
|
NPM_ARCHIVE_NAME = azure-npm-$(GOOS)-$(GOARCH)-$(NPM_VERSION).$(ARCHIVE_EXT)
|
2022-09-07 00:07:56 +03:00
|
|
|
AZURE_IPAM_ARCHIVE_NAME = azure-ipam-$(GOOS)-$(GOARCH)-$(AZURE_IPAM_VERSION).$(ARCHIVE_EXT)
|
2024-06-11 19:05:07 +03:00
|
|
|
IPV6_HP_BPF_ARCHIVE_NAME = ipv6-hp-bpf-$(GOOS)-$(GOARCH)-$(IPV6_HP_BPF_VERSION).$(ARCHIVE_EXT)
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
# Image info file names.
|
2023-10-31 00:51:58 +03:00
|
|
|
CNI_IMAGE_INFO_FILE = azure-cni-$(CNI_VERSION).txt
|
|
|
|
CNS_IMAGE_INFO_FILE = azure-cns-$(CNS_VERSION).txt
|
|
|
|
NPM_IMAGE_INFO_FILE = azure-npm-$(NPM_VERSION).txt
|
2017-03-30 06:42:35 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Default target
|
2021-09-09 00:46:32 +03:00
|
|
|
all-binaries-platforms: ## Make all platform binaries
|
|
|
|
@for goos in "$(GOOSES)"; do \
|
|
|
|
for goarch in "$(GOARCHES)"; do \
|
|
|
|
make all-binaries GOOS=$$goos GOARCH=$$goarch; \
|
|
|
|
done \
|
|
|
|
done
|
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# OS specific binaries/images
|
2018-07-20 04:20:01 +03:00
|
|
|
ifeq ($(GOOS),linux)
|
2024-06-11 19:05:07 +03:00
|
|
|
all-binaries: acncli azure-cni-plugin azure-cns azure-npm azure-ipam ipv6-hp-bpf
|
|
|
|
all-images: npm-image cns-image cni-manager-image ipv6-hp-bpf-image
|
2019-01-23 04:07:32 +03:00
|
|
|
else
|
2024-02-16 00:28:17 +03:00
|
|
|
all-binaries: azure-cni-plugin azure-cns azure-npm
|
2019-01-23 04:07:32 +03:00
|
|
|
all-images:
|
2018-07-21 23:15:04 +03:00
|
|
|
@echo "Nothing to build. Skip."
|
|
|
|
endif
|
2018-07-21 02:42:23 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Shorthand target names for convenience.
|
2024-04-25 22:39:01 +03:00
|
|
|
azure-cni-plugin: azure-vnet-binary azure-vnet-stateless-binary azure-vnet-ipam-binary azure-vnet-ipamv6-binary azure-vnet-telemetry-binary cni-archive
|
2021-09-18 01:05:32 +03:00
|
|
|
azure-cns: azure-cns-binary cns-archive
|
|
|
|
acncli: acncli-binary acncli-archive
|
|
|
|
azure-npm: azure-npm-binary npm-archive
|
2022-09-07 00:07:56 +03:00
|
|
|
azure-ipam: azure-ipam-binary azure-ipam-archive
|
2024-05-30 23:43:37 +03:00
|
|
|
ipv6-hp-bpf: ipv6-hp-bpf-binary ipv6-hp-bpf-archive
|
2021-01-20 22:00:32 +03:00
|
|
|
|
2017-01-05 03:21:14 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
##@ Versioning
|
|
|
|
|
|
|
|
revision: ## print the current git revision
|
|
|
|
@echo $(REVISION)
|
2023-07-28 19:44:11 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
version: ## prints the root version
|
|
|
|
@echo $(ACN_VERSION)
|
|
|
|
|
|
|
|
acncli-version: version
|
|
|
|
|
|
|
|
azure-ipam-version: ## prints the azure-ipam version
|
|
|
|
@echo $(AZURE_IPAM_VERSION)
|
|
|
|
|
2024-05-30 23:43:37 +03:00
|
|
|
ipv6-hp-bpf-version: ## prints the ipv6-hp-bpf version
|
|
|
|
@echo $(IPV6_HP_BPF_VERSION)
|
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
cni-version: ## prints the cni version
|
|
|
|
@echo $(CNI_VERSION)
|
|
|
|
|
|
|
|
cns-version:
|
2023-07-28 19:44:11 +03:00
|
|
|
@echo $(CNS_VERSION)
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
npm-version:
|
2023-07-28 19:44:11 +03:00
|
|
|
@echo $(NPM_VERSION)
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
zapai-version: ## prints the zapai version
|
|
|
|
@echo $(ZAPAI_VERSION)
|
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
##@ Binaries
|
2020-10-21 00:00:40 +03:00
|
|
|
|
2022-07-29 00:11:05 +03:00
|
|
|
# Build the delegated IPAM plugin binary.
|
|
|
|
azure-ipam-binary:
|
2023-08-14 20:24:30 +03:00
|
|
|
cd $(AZURE_IPAM_DIR) && CGO_ENABLED=0 go build -v -o $(AZURE_IPAM_BUILD_DIR)/azure-ipam$(EXE_EXT) -ldflags "-X github.com/Azure/azure-container-networking/azure-ipam/internal/buildinfo.Version=$(AZURE_IPAM_VERSION)" -gcflags="-dwarflocationlists=true"
|
2022-09-01 21:35:01 +03:00
|
|
|
|
2024-05-30 23:43:37 +03:00
|
|
|
# Build the ipv6-hp-bpf binary.
|
|
|
|
ipv6-hp-bpf-binary:
|
2024-06-21 05:34:04 +03:00
|
|
|
cd $(IPV6_HP_BPF_DIR) && CGO_ENABLED=0 go generate ./...
|
2024-06-11 19:05:07 +03:00
|
|
|
cd $(IPV6_HP_BPF_DIR)/cmd/ipv6-hp-bpf && CGO_ENABLED=0 go build -v -o $(IPV6_HP_BPF_BUILD_DIR)/ipv6-hp-bpf$(EXE_EXT) -ldflags "-X main.version=$(IPV6_HP_BPF_VERSION)" -gcflags="-dwarflocationlists=true"
|
|
|
|
|
|
|
|
# Libraries for ipv6-hp-bpf
|
2024-06-21 05:34:04 +03:00
|
|
|
ipv6-hp-bpf-lib:
|
2024-06-11 19:05:07 +03:00
|
|
|
ifeq ($(GOARCH),amd64)
|
|
|
|
sudo apt-get update && sudo apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-multilib
|
|
|
|
for dir in /usr/include/x86_64-linux-gnu/*; do sudo ln -sfn "$$dir" /usr/include/$$(basename "$$dir"); done
|
|
|
|
else ifeq ($(GOARCH),arm64)
|
|
|
|
sudo apt-get update && sudo apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-aarch64-linux-gnu
|
|
|
|
for dir in /usr/include/aarch64-linux-gnu/*; do sudo ln -sfn "$$dir" /usr/include/$$(basename "$$dir"); done
|
|
|
|
endif
|
2024-05-30 23:43:37 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Build the Azure CNI network binary.
|
|
|
|
azure-vnet-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNI_NET_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
2024-04-25 22:39:01 +03:00
|
|
|
# Build the Azure CNI stateless network binary
|
|
|
|
azure-vnet-stateless-binary:
|
|
|
|
cd $(STATELESS_CNI_NET_DIR) && CGO_ENABLED=0 go build -v -o $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true"
|
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Build the Azure CNI IPAM binary.
|
|
|
|
azure-vnet-ipam-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNI_IPAM_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
|
|
|
# Build the Azure CNI IPAMV6 binary.
|
|
|
|
azure-vnet-ipamv6-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNI_IPAMV6_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-ipamv6$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
|
|
|
# Build the Azure CNI telemetry binary.
|
|
|
|
azure-vnet-telemetry-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNI_TELEMETRY_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION) -X $(CNI_AI_PATH)=$(CNI_AI_ID)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
|
|
|
# Build the Azure CLI network binary.
|
|
|
|
acncli-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(ACNCLI_DIR) && CGO_ENABLED=0 go build -v -o $(ACNCLI_BUILD_DIR)/acn$(EXE_EXT) -ldflags "-X main.version=$(ACN_VERSION)" -gcflags="-dwarflocationlists=true"
|
2020-12-11 05:06:53 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Build the Azure CNS binary.
|
|
|
|
azure-cns-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNS_DIR) && CGO_ENABLED=0 go build -v -o $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) -ldflags "-X main.version=$(CNS_VERSION) -X $(CNS_AI_PATH)=$(CNS_AI_ID) -X $(CNI_AI_PATH)=$(CNI_AI_ID)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
|
|
|
# Build the Azure NPM binary.
|
|
|
|
azure-npm-binary:
|
2022-09-01 21:35:01 +03:00
|
|
|
cd $(CNI_TELEMETRY_DIR) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) -ldflags "-X main.version=$(NPM_VERSION)" -gcflags="-dwarflocationlists=true"
|
|
|
|
cd $(NPM_DIR) && CGO_ENABLED=0 go build -v -o $(NPM_BUILD_DIR)/azure-npm$(EXE_EXT) -ldflags "-X main.version=$(NPM_VERSION) -X $(NPM_AI_PATH)=$(NPM_AI_ID)" -gcflags="-dwarflocationlists=true"
|
2021-09-18 01:05:32 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
##@ Containers
|
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
## Common variables for all containers.
|
2023-03-01 03:25:00 +03:00
|
|
|
IMAGE_REGISTRY ?= acnpublic.azurecr.io
|
|
|
|
OS ?= $(GOOS)
|
|
|
|
ARCH ?= $(GOARCH)
|
|
|
|
PLATFORM ?= $(OS)/$(ARCH)
|
|
|
|
BUILDX_ACTION ?= --load
|
|
|
|
CONTAINER_BUILDER ?= buildah
|
|
|
|
CONTAINER_RUNTIME ?= podman
|
|
|
|
CONTAINER_TRANSPORT ?= skopeo
|
|
|
|
|
|
|
|
|
|
|
|
# prefer buildah, if available, but fall back to docker if that binary is not in the path or on Windows.
|
2022-02-16 04:00:04 +03:00
|
|
|
ifeq (, $(shell which $(CONTAINER_BUILDER)))
|
|
|
|
CONTAINER_BUILDER = docker
|
|
|
|
endif
|
2023-03-01 03:25:00 +03:00
|
|
|
ifeq ($(OS), windows)
|
|
|
|
CONTAINER_BUILDER = docker
|
|
|
|
endif
|
|
|
|
|
|
|
|
# prefer podman, if available, but fall back to docker if that binary is not in the path or on Windows.
|
2022-09-01 21:35:01 +03:00
|
|
|
ifeq (, $(shell which $(CONTAINER_RUNTIME)))
|
|
|
|
CONTAINER_RUNTIME = docker
|
|
|
|
endif
|
2023-03-01 03:25:00 +03:00
|
|
|
ifeq ($(OS), windows)
|
|
|
|
CONTAINER_RUNTIME = docker
|
|
|
|
endif
|
|
|
|
|
|
|
|
# prefer skopeo, if available, but fall back to docker if that binary is not in the path. or on Windows
|
|
|
|
ifeq (, $(shell which $(CONTAINER_TRANSPORT)))
|
|
|
|
CONTAINER_TRANSPORT = docker
|
|
|
|
endif
|
|
|
|
ifeq ($(OS), windows)
|
|
|
|
CONTAINER_TRANSPORT = docker
|
|
|
|
endif
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
## Image name definitions.
|
2023-11-21 06:59:16 +03:00
|
|
|
ACNCLI_IMAGE = acncli
|
|
|
|
AZURE_IPAM_IMAGE = azure-ipam
|
2024-06-18 00:53:44 +03:00
|
|
|
IPV6_HP_BPF_IMAGE = ipv6-hp-bpf
|
2023-11-21 06:59:16 +03:00
|
|
|
CNI_IMAGE = azure-cni
|
|
|
|
CNS_IMAGE = azure-cns
|
|
|
|
NPM_IMAGE = azure-npm
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
## Image platform tags.
|
2024-11-12 19:42:42 +03:00
|
|
|
ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(ACN_VERSION)
|
|
|
|
AZURE_IPAM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(AZURE_IPAM_VERSION)
|
|
|
|
AZURE_IPAM_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(AZURE_IPAM_VERSION)-$(OS_SKU_WIN)
|
|
|
|
IPV6_HP_BPF_IMAGE_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(IPV6_HP_BPF_VERSION)
|
|
|
|
CNI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_VERSION)
|
|
|
|
CNI_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_VERSION)-$(OS_SKU_WIN)
|
|
|
|
CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION)
|
|
|
|
CNS_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION)-$(OS_SKU_WIN)
|
|
|
|
NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(NPM_VERSION)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
qemu-user-static: ## Set up the host to run qemu multiplatform container builds.
|
|
|
|
sudo $(CONTAINER_RUNTIME) run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
## Reusable build targets for building individual container images.
|
|
|
|
|
|
|
|
container-buildah: # util target to build container images using buildah. do not invoke directly.
|
2022-02-24 21:08:13 +03:00
|
|
|
buildah bud \
|
2024-06-18 00:53:44 +03:00
|
|
|
--build-arg ARCH=$(ARCH) \
|
|
|
|
--build-arg OS=$(OS) \
|
|
|
|
--build-arg PLATFORM=$(PLATFORM) \
|
|
|
|
--build-arg VERSION=$(TAG) \
|
|
|
|
$(EXTRA_BUILD_ARGS) \
|
2022-02-16 04:00:04 +03:00
|
|
|
--jobs 16 \
|
|
|
|
--platform $(PLATFORM) \
|
2024-06-18 00:53:44 +03:00
|
|
|
--target $(TARGET) \
|
2022-02-16 04:00:04 +03:00
|
|
|
-f $(DOCKERFILE) \
|
2022-05-06 01:32:53 +03:00
|
|
|
-t $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) \
|
2022-02-16 04:00:04 +03:00
|
|
|
.
|
2023-03-01 03:25:00 +03:00
|
|
|
buildah push $(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
container-docker: # util target to build container images using docker buildx. do not invoke directly.
|
2024-11-04 23:22:11 +03:00
|
|
|
docker buildx create --use --driver-opt image=mcr.microsoft.com/oss/v2/moby/buildkit:v0.16.0-2 --platform $(PLATFORM)
|
2022-02-16 04:00:04 +03:00
|
|
|
docker buildx build \
|
2023-03-01 03:25:00 +03:00
|
|
|
$(BUILDX_ACTION) \
|
2024-06-18 00:53:44 +03:00
|
|
|
--build-arg ARCH=$(ARCH) \
|
|
|
|
--build-arg OS=$(OS) \
|
|
|
|
--build-arg PLATFORM=$(PLATFORM) \
|
|
|
|
--build-arg VERSION=$(TAG) \
|
|
|
|
$(EXTRA_BUILD_ARGS) \
|
2022-02-16 04:00:04 +03:00
|
|
|
--platform $(PLATFORM) \
|
2024-06-18 00:53:44 +03:00
|
|
|
--target $(TARGET) \
|
2022-02-16 04:00:04 +03:00
|
|
|
-f $(DOCKERFILE) \
|
2022-05-06 01:32:53 +03:00
|
|
|
-t $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) \
|
2022-02-16 04:00:04 +03:00
|
|
|
.
|
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
container: # util target to build container images. do not invoke directly.
|
2023-03-01 03:25:00 +03:00
|
|
|
$(MAKE) container-$(CONTAINER_BUILDER) \
|
2024-06-18 00:53:44 +03:00
|
|
|
ARCH=$(ARCH) \
|
|
|
|
OS=$(OS) \
|
2023-03-01 03:25:00 +03:00
|
|
|
PLATFORM=$(PLATFORM) \
|
2023-03-02 01:51:59 +03:00
|
|
|
TAG=$(TAG) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TARGET=$(TARGET)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
container-push: # util target to publish container image. do not invoke directly.
|
|
|
|
$(CONTAINER_BUILDER) push \
|
2022-05-06 01:32:53 +03:00
|
|
|
$(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
container-pull: # util target to pull container image. do not invoke directly.
|
|
|
|
$(CONTAINER_BUILDER) pull \
|
2022-05-06 01:32:53 +03:00
|
|
|
$(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
## Build specific container images.
|
|
|
|
|
|
|
|
# acncli
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-07-16 00:56:02 +03:00
|
|
|
acncli-image-name: # util target to print the CNI manager image name.
|
|
|
|
@echo $(ACNCLI_IMAGE)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-12-23 00:03:53 +03:00
|
|
|
acncli-image-name-and-tag: # util target to print the CNI manager image name and tag.
|
|
|
|
@echo $(IMAGE_REGISTRY)/$(ACNCLI_IMAGE):$(ACNCLI_PLATFORM_TAG)
|
|
|
|
|
2022-07-16 00:56:02 +03:00
|
|
|
acncli-image: ## build cni-manager container image.
|
2022-09-01 21:35:01 +03:00
|
|
|
$(MAKE) container \
|
2022-02-16 04:00:04 +03:00
|
|
|
DOCKERFILE=tools/acncli/Dockerfile \
|
2022-07-16 00:56:02 +03:00
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(ACNCLI_PLATFORM_TAG)
|
2022-07-16 00:56:02 +03:00
|
|
|
|
|
|
|
acncli-image-push: ## push cni-manager container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(ACNCLI_PLATFORM_TAG)
|
2022-07-16 00:56:02 +03:00
|
|
|
|
|
|
|
acncli-image-pull: ## pull cni-manager container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(ACNCLI_PLATFORM_TAG)
|
|
|
|
|
2023-10-31 00:51:58 +03:00
|
|
|
|
2023-11-01 23:55:00 +03:00
|
|
|
# azure-ipam
|
|
|
|
|
|
|
|
azure-ipam-image-name: # util target to print the azure-ipam image name.
|
|
|
|
@echo $(AZURE_IPAM_IMAGE)
|
|
|
|
|
|
|
|
azure-ipam-image-name-and-tag: # util target to print the azure-ipam image name and tag.
|
|
|
|
@echo $(IMAGE_REGISTRY)/$(AZURE_IPAM_IMAGE):$(AZURE_IPAM_PLATFORM_TAG)
|
|
|
|
|
|
|
|
azure-ipam-image: ## build azure-ipam container image.
|
|
|
|
$(MAKE) container \
|
2024-06-18 00:53:44 +03:00
|
|
|
DOCKERFILE=azure-ipam/Dockerfile \
|
2023-11-01 23:55:00 +03:00
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
|
|
|
PLATFORM=$(PLATFORM) \
|
|
|
|
TAG=$(AZURE_IPAM_PLATFORM_TAG) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TARGET=$(OS) \
|
2023-11-01 23:55:00 +03:00
|
|
|
OS=$(OS) \
|
2024-11-12 19:42:42 +03:00
|
|
|
ARCH=$(ARCH)
|
2023-11-01 23:55:00 +03:00
|
|
|
|
|
|
|
azure-ipam-image-push: ## push azure-ipam container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
|
|
|
TAG=$(AZURE_IPAM_PLATFORM_TAG)
|
|
|
|
|
|
|
|
azure-ipam-image-pull: ## pull azure-ipam container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
|
|
|
TAG=$(AZURE_IPAM_PLATFORM_TAG)
|
|
|
|
|
2024-05-30 23:43:37 +03:00
|
|
|
# ipv6-hp-bpf
|
|
|
|
|
|
|
|
ipv6-hp-bpf-image-name: # util target to print the ipv6-hp-bpf image name.
|
|
|
|
@echo $(IPV6_HP_BPF_IMAGE)
|
|
|
|
|
|
|
|
ipv6-hp-bpf-image-name-and-tag: # util target to print the ipv6-hp-bpf image name and tag.
|
|
|
|
@echo $(IMAGE_REGISTRY)/$(IPV6_HP_BPF_IMAGE):$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG)
|
|
|
|
|
|
|
|
ipv6-hp-bpf-image: ## build ipv6-hp-bpf container image.
|
|
|
|
$(MAKE) container \
|
|
|
|
DOCKERFILE=bpf-prog/ipv6-hp-bpf/$(OS).Dockerfile \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
EXTRA_BUILD_ARGS='--build-arg OS=$(OS) --build-arg ARCH=$(ARCH) --build-arg DEBUG=$(DEBUG)'\
|
2024-05-30 23:43:37 +03:00
|
|
|
PLATFORM=$(PLATFORM) \
|
|
|
|
TAG=$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TARGET=$(OS) \
|
2024-05-30 23:43:37 +03:00
|
|
|
OS=$(OS) \
|
2024-11-12 19:42:42 +03:00
|
|
|
ARCH=$(ARCH)
|
2024-05-30 23:43:37 +03:00
|
|
|
|
|
|
|
ipv6-hp-bpf-image-push: ## push ipv6-hp-bpf container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
|
|
|
TAG=$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG)
|
|
|
|
|
|
|
|
ipv6-hp-bpf-image-pull: ## pull ipv6-hp-bpf container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
|
|
|
TAG=$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG)
|
2023-11-01 23:55:00 +03:00
|
|
|
|
2023-10-31 00:51:58 +03:00
|
|
|
# cni
|
|
|
|
|
2023-11-01 23:55:00 +03:00
|
|
|
cni-image-name: # util target to print the cni image name.
|
2023-10-31 00:51:58 +03:00
|
|
|
@echo $(CNI_IMAGE)
|
|
|
|
|
2023-11-01 23:55:00 +03:00
|
|
|
cni-image-name-and-tag: # util target to print the cni image name and tag.
|
2023-10-31 00:51:58 +03:00
|
|
|
@echo $(IMAGE_REGISTRY)/$(CNI_IMAGE):$(CNI_PLATFORM_TAG)
|
|
|
|
|
|
|
|
cni-image: ## build cni container image.
|
|
|
|
$(MAKE) container \
|
2024-06-18 00:53:44 +03:00
|
|
|
DOCKERFILE=cni/Dockerfile \
|
2023-10-31 00:51:58 +03:00
|
|
|
IMAGE=$(CNI_IMAGE) \
|
|
|
|
PLATFORM=$(PLATFORM) \
|
|
|
|
TAG=$(CNI_PLATFORM_TAG) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TARGET=$(OS) \
|
2023-10-31 00:51:58 +03:00
|
|
|
OS=$(OS) \
|
|
|
|
ARCH=$(ARCH) \
|
2024-11-05 00:39:37 +03:00
|
|
|
EXTRA_BUILD_ARGS='--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'
|
2023-10-31 00:51:58 +03:00
|
|
|
|
|
|
|
cni-image-push: ## push cni container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(CNI_IMAGE) \
|
|
|
|
TAG=$(CNI_PLATFORM_TAG)
|
|
|
|
|
|
|
|
cni-image-pull: ## pull cni container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(CNI_IMAGE) \
|
|
|
|
TAG=$(CNI_PLATFORM_TAG)
|
|
|
|
|
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
# cns
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
cns-image-name: # util target to print the CNS image name
|
|
|
|
@echo $(CNS_IMAGE)
|
|
|
|
|
2022-12-23 00:03:53 +03:00
|
|
|
cns-image-name-and-tag: # util target to print the CNS image name and tag.
|
|
|
|
@echo $(IMAGE_REGISTRY)/$(CNS_IMAGE):$(CNS_PLATFORM_TAG)
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
cns-image: ## build cns container image.
|
2022-09-01 21:35:01 +03:00
|
|
|
$(MAKE) container \
|
2024-06-18 00:53:44 +03:00
|
|
|
DOCKERFILE=cns/Dockerfile \
|
2022-02-16 04:00:04 +03:00
|
|
|
IMAGE=$(CNS_IMAGE) \
|
2024-06-18 00:53:44 +03:00
|
|
|
EXTRA_BUILD_ARGS='--build-arg CNS_AI_PATH=$(CNS_AI_PATH) --build-arg CNS_AI_ID=$(CNS_AI_ID)' \
|
2023-03-01 03:25:00 +03:00
|
|
|
PLATFORM=$(PLATFORM) \
|
|
|
|
TAG=$(CNS_PLATFORM_TAG) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TARGET=$(OS) \
|
2023-03-01 03:25:00 +03:00
|
|
|
OS=$(OS) \
|
2024-11-12 19:42:42 +03:00
|
|
|
ARCH=$(ARCH)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
cns-image-push: ## push cns container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(CNS_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(CNS_PLATFORM_TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
cns-image-pull: ## pull cns container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(CNS_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(CNS_PLATFORM_TAG)
|
|
|
|
|
|
|
|
# npm
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
npm-image-name: # util target to print the NPM image name
|
|
|
|
@echo $(NPM_IMAGE)
|
|
|
|
|
2022-12-23 00:03:53 +03:00
|
|
|
npm-image-name-and-tag: # util target to print the NPM image name and tag.
|
|
|
|
@echo $(IMAGE_REGISTRY)/$(NPM_IMAGE):$(NPM_PLATFORM_TAG)
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
npm-image: ## build the npm container image.
|
2022-09-01 21:35:01 +03:00
|
|
|
$(MAKE) container-$(CONTAINER_BUILDER) \
|
2023-03-01 03:25:00 +03:00
|
|
|
DOCKERFILE=npm/$(OS).Dockerfile \
|
|
|
|
IMAGE=$(NPM_IMAGE) \
|
2024-06-18 00:53:44 +03:00
|
|
|
EXTRA_BUILD_ARGS='--build-arg NPM_AI_PATH=$(NPM_AI_PATH) --build-arg NPM_AI_ID=$(NPM_AI_ID)' \
|
2023-03-01 03:25:00 +03:00
|
|
|
PLATFORM=$(PLATFORM) \
|
2024-06-18 00:53:44 +03:00
|
|
|
TAG=$(NPM_PLATFORM_TAG) \
|
|
|
|
TARGET=$(OS) \
|
2023-03-01 03:25:00 +03:00
|
|
|
OS=$(OS) \
|
2024-11-12 19:42:42 +03:00
|
|
|
ARCH=$(ARCH)
|
2022-09-08 00:18:29 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
npm-image-push: ## push npm container image.
|
|
|
|
$(MAKE) container-push \
|
|
|
|
IMAGE=$(NPM_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(NPM_PLATFORM_TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
npm-image-pull: ## pull cns container image.
|
|
|
|
$(MAKE) container-pull \
|
|
|
|
IMAGE=$(NPM_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(NPM_PLATFORM_TAG)
|
|
|
|
|
|
|
|
## Reusable targets for building multiplat container image manifests.
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
IMAGE_ARCHIVE_DIR ?= $(shell pwd)
|
|
|
|
|
2023-03-01 03:25:00 +03:00
|
|
|
manifest-create:
|
2022-05-06 01:32:53 +03:00
|
|
|
$(CONTAINER_BUILDER) manifest create $(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
|
2023-03-01 03:25:00 +03:00
|
|
|
|
|
|
|
manifest-add:
|
2024-11-12 19:42:42 +03:00
|
|
|
$(CONTAINER_BUILDER) manifest add --os=$(OS) $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)
|
2023-03-01 03:25:00 +03:00
|
|
|
|
|
|
|
manifest-build: # util target to compose multiarch container manifests from platform specific images.
|
|
|
|
$(MAKE) manifest-create
|
|
|
|
$(foreach PLATFORM,$(PLATFORMS),\
|
|
|
|
$(if $(filter $(PLATFORM),windows/amd64),\
|
2024-11-12 19:42:42 +03:00
|
|
|
$(MAKE) manifest-add CONTAINER_BUILDER=$(CONTAINER_BUILDER) OS=windows OS_VERSION=$(OS_VERSION) PLATFORM=$(PLATFORM);,\
|
|
|
|
$(MAKE) manifest-add PLATFORM=$(PLATFORM);\
|
2023-03-01 03:25:00 +03:00
|
|
|
)\
|
|
|
|
)\
|
2023-07-28 19:44:11 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
manifest-push: # util target to push multiarch container manifest.
|
2022-05-06 01:32:53 +03:00
|
|
|
$(CONTAINER_BUILDER) manifest push --all $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(TAG)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
manifest-skopeo-archive: # util target to export tar archive of multiarch container manifest.
|
2023-10-27 01:54:08 +03:00
|
|
|
skopeo copy --all docker://$(IMAGE_REGISTRY)/$(IMAGE):$(TAG) oci-archive:$(IMAGE_ARCHIVE_DIR)/$(IMAGE)-$(TAG).tar --debug
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
## Build specific multiplat images.
|
|
|
|
|
2023-03-01 03:25:00 +03:00
|
|
|
acncli-manifest-build: ## build acncli multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
2022-07-16 00:56:02 +03:00
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
2022-09-01 21:35:01 +03:00
|
|
|
TAG=$(ACN_VERSION)
|
|
|
|
|
|
|
|
acncli-manifest-push: ## push acncli multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
|
|
|
TAG=$(ACN_VERSION)
|
2022-07-16 00:56:02 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
acncli-skopeo-archive: ## export tar archive of acncli multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(ACNCLI_IMAGE) \
|
2023-07-28 19:44:11 +03:00
|
|
|
TAG=$(ACN_VERSION)
|
2022-09-01 21:35:01 +03:00
|
|
|
|
2023-11-01 23:55:00 +03:00
|
|
|
azure-ipam-manifest-build: ## build azure-ipam multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
TAG=$(AZURE_IPAM_VERSION)
|
2023-11-01 23:55:00 +03:00
|
|
|
|
|
|
|
azure-ipam-manifest-push: ## push azure-ipam multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
|
|
|
TAG=$(AZURE_IPAM_VERSION)
|
|
|
|
|
|
|
|
azure-ipam-skopeo-archive: ## export tar archive of azure-ipam multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(AZURE_IPAM_IMAGE) \
|
|
|
|
TAG=$(AZURE_IPAM_VERSION)
|
|
|
|
|
2024-06-11 19:05:07 +03:00
|
|
|
ipv6-hp-bpf-manifest-build: ## build ipv6-hp-bpf multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
TAG=$(IPV6_HP_BPF_VERSION)
|
2024-06-11 19:05:07 +03:00
|
|
|
|
|
|
|
ipv6-hp-bpf-manifest-push: ## push ipv6-hp-bpf multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
|
|
|
TAG=$(IPV6_HP_BPF_VERSION)
|
|
|
|
|
|
|
|
ipv6-hp-bpf-skopeo-archive: ## export tar archive of ipv6-hp-bpf multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(IPV6_HP_BPF_IMAGE) \
|
|
|
|
TAG=$(IPV6_HP_BPF_VERSION)
|
|
|
|
|
2023-10-31 00:51:58 +03:00
|
|
|
cni-manifest-build: ## build cni multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
|
|
|
IMAGE=$(CNI_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
TAG=$(CNI_VERSION)
|
2023-10-31 00:51:58 +03:00
|
|
|
|
|
|
|
cni-manifest-push: ## push cni multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(CNI_IMAGE) \
|
|
|
|
TAG=$(CNI_VERSION)
|
|
|
|
|
|
|
|
cni-skopeo-archive: ## export tar archive of cni multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(CNI_IMAGE) \
|
|
|
|
TAG=$(CNI_VERSION)
|
|
|
|
|
2023-03-01 03:25:00 +03:00
|
|
|
cns-manifest-build: ## build azure-cns multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
2022-05-06 01:32:53 +03:00
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
2022-02-16 04:00:04 +03:00
|
|
|
IMAGE=$(CNS_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
TAG=$(CNS_VERSION)
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-09-01 21:35:01 +03:00
|
|
|
cns-manifest-push: ## push cns multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(CNS_IMAGE) \
|
|
|
|
TAG=$(CNS_VERSION)
|
|
|
|
|
|
|
|
cns-skopeo-archive: ## export tar archive of cns multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(CNS_IMAGE) \
|
|
|
|
TAG=$(CNS_VERSION)
|
|
|
|
|
2023-03-01 03:25:00 +03:00
|
|
|
npm-manifest-build: ## build azure-npm multiplat container manifest.
|
|
|
|
$(MAKE) manifest-build \
|
2022-05-06 01:32:53 +03:00
|
|
|
PLATFORMS="$(PLATFORMS)" \
|
2022-02-16 04:00:04 +03:00
|
|
|
IMAGE=$(NPM_IMAGE) \
|
2024-11-12 19:42:42 +03:00
|
|
|
TAG=$(NPM_VERSION)
|
2022-09-01 21:35:01 +03:00
|
|
|
|
|
|
|
npm-manifest-push: ## push multiplat container manifest
|
|
|
|
$(MAKE) manifest-push \
|
|
|
|
IMAGE=$(NPM_IMAGE) \
|
|
|
|
TAG=$(NPM_VERSION)
|
|
|
|
|
|
|
|
npm-skopeo-archive: ## export tar archive of multiplat container manifest.
|
|
|
|
$(MAKE) manifest-skopeo-archive \
|
|
|
|
IMAGE=$(NPM_IMAGE) \
|
|
|
|
TAG=$(NPM_VERSION)
|
|
|
|
|
2021-10-15 01:42:56 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
########################### Archives ################################
|
2020-01-07 03:11:52 +03:00
|
|
|
|
2017-06-29 22:01:28 +03:00
|
|
|
# Create a CNI archive for the target platform.
|
|
|
|
.PHONY: cni-archive
|
2021-09-18 01:05:32 +03:00
|
|
|
cni-archive: azure-vnet-binary azure-vnet-ipam-binary azure-vnet-ipamv6-binary azure-vnet-telemetry-binary
|
|
|
|
$(MKDIR) $(CNI_BUILD_DIR)
|
2018-01-31 03:54:52 +03:00
|
|
|
cp cni/azure-$(GOOS).conflist $(CNI_BUILD_DIR)/10-azure.conflist
|
2019-03-26 00:12:32 +03:00
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_BUILD_DIR)/azure-vnet-telemetry.config
|
2024-06-12 08:24:47 +03:00
|
|
|
cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-stateless$(EXE_EXT)
|
|
|
|
cd $(CNI_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-stateless$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-ipamv6$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
2020-10-29 20:32:21 +03:00
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
$(MKDIR) $(CNI_MULTITENANCY_BUILD_DIR)
|
2018-07-07 02:08:36 +03:00
|
|
|
cp cni/azure-$(GOOS)-multitenancy.conflist $(CNI_MULTITENANCY_BUILD_DIR)/10-azure.conflist
|
2022-07-02 01:09:39 +03:00
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_MULTITENANCY_BUILD_DIR)
|
|
|
|
ifeq ($(GOOS),linux)
|
2019-03-26 00:12:32 +03:00
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_MULTITENANCY_BUILD_DIR)/azure-vnet-telemetry.config
|
2022-07-02 01:09:39 +03:00
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_MULTITENANCY_BUILD_DIR)
|
|
|
|
endif
|
2019-03-26 00:12:32 +03:00
|
|
|
cd $(CNI_MULTITENANCY_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_MULTITENANCY_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
2017-06-29 22:01:28 +03:00
|
|
|
|
2024-02-16 00:28:17 +03:00
|
|
|
ifeq ($(GOOS),linux)
|
feat: Add SNAT bridge to Native, decouple SNAT bridge (#1506)
* Native Endpoint Client Add Endpoints
* AddEndpointRules, ConfigureContainerInterfacesAndRoutes
* Changed interface names, log statements
nw.extIf.Name > eth0 (eth0)
eth0.vlanid > eth0.X (eth0.1)
%s%s hostIfName > vnet (A1veth0)
%s%s-2 contIfName > container (B1veth0)
* Renaming, using lib to set ns
* Namespace "path" is /var/run/netns/<NS>
* Loopback set up, Remove auto kernel subnet route
* Cannot set link to up if it's in another NS
* Multiple containers on same VNET NS
* Delete Endpoint routes on Delete
* Minimizing netns usage
* Moving NS Exec Code
* Further minimized netns.Set usage
* Moved helper methods down, drafted tests
* Removed DevName from Route Info, more tests
* Test existing vnet ns, delete endpoint
* NetNS interface for testing
* Separated tests by namespace
* Endpoints delete if they cannot be moved into NS
* Namespace netns tests
* Added Native Client to deleteEndpointImpl
* Deletion of Endpoints Impl and Tests
* Cleaned code (Tests ok)
* Moved mock/netns to package (Tests ok)
* Fixing Netns (wip)
Moved netnsinterface to consumer package (network).
Removed "Netns" from "NewNetns" and "NewMockNetns" as it is unambiguous.
Changed uintptr to int and casted the int to uintptr when needed later.
* Using errors.Wrap for error context (wip)
* Removed sentence case (wip)
* Removing variable predeclaration
* Removed NewNativeEndpointClient
Directly instantiating struct because nothing special happens in NewNativeEndpointClient
* Removed generics from ExecuteInNS
* Removed uintptr from mocknetns, tests compile
Forgot to remove uintptr from mocknetns
* Fix tests, lint
* Fixes from linter
Works on VMSS
* Replacing references to ethX with vlan veth
* Removed unnecessary log
* Removed unnecessary mac, fix tests
* Mockns method name enum
* Unable to use GetNetworkInterfaceByName due to NS
If I use GetNetworkInterface, I need to be in the vnet NS, but that means I will need to call ExecuteInNS, which causes tests to fail.
* Fixes from linter
* Assume if NS exists, vlan veth exists
Tests ok
* Fixes for Linter
* Snat refactor
* Fix delete tests
* Fix delete tests bug
* More snat refactor
* Breaking, prepping for Native Snat
Delete native endpoint snat route linux to remove errors and in theory, ovs should work fine again.
* Go mod tidy for linting
Hopefully this fixes the windows lint error
* Add fields to native endpoint client for snat
* Using New() func to create Native Client
Creation of the native endpoint client is too complicated to directly instantiate.
* Snat defaults
* Insert SNAT entry points
* Native Snat error handling
* Breaking, decouple ovsctl from snat
Proposed Solution implementation
Moved ovsctlClient.AddPortOnOVSBridge to ovs_endpoint_snatroute_linux.go. Removed ovsctlclient from NewSnatClient. Removed ovsctlClient from testing file.
* Delete unecessary ovssnat files
* No lint on vishvananda netns
Maybe this will fix the windows linter?
* Build linux only for netns package
Maybe this fixes the linter error?
* Remove nolint to see if linter fails
* Breaking, removed bridgeName
bridgeName refers to the OVS Switch I believe
* If native uses snat bridge, should also get IP
* Breaking, Decouple or Wrap snat route
* Check to see if snat triggered
* Snat behaviors specific to ovs/native
* Pass the pointer
Add/Delete ok
* Renaming to make consts public
* Breaking, moving ovs specific parts of snat to ovs
* Remove enable infra vnet (Tests ok)
Tested:
Allow Host to NC only
Allow NC to Host only
Allow both
Wget
Ping between containers
Warning: Enable snat is still hard coded to true!!!
* Move add port to after exists() check
* Moved netns interface to caller, generalized tests
Tests ok, Native ok
* Typos
* Reordered if statement, unwrapped arp
Tests ok, ping ok, wget ok
* Linted, wrapping errors
* Go fumpt entire network package
* Code markers removed, clean (Tests ok)
OVS & Native:
- Ping between two containers same VM, no packets on bridge
- Ping between two containers diff VM, no packets on bridge
- Ping other container not in vnet, no packets on bridge
- Ping snat to container, packets on bridge
- Ping container to snat, packets on bridge
- Tcpdump confirmed on azSnatBr
- Deletion of containers deletes appropriate interfaces
* Renamed veth, fixed logs
* Made deleteEndpoints logic clearer, renamed error
* Renamed eth0 to primaryHostIfName, vlanEth to vlanIf
* Deleted debug log
* Corrected merge (hardware addr) (Tests ok)
* Renamed vlan veth to hostExtIf_vlanID, Disabled RA
eth0.2 makes disable RA look for a folder eth0 and then another sub folder "2". ("eth0/2") However, it should look for a folder named "eth0.2" literally. To solve this, we change the naming scheme to use an underscore instead. (Tests ok)
* Renamed Native to TransparentVlan
Confirmed basic functionality on VM with correct mode
* Make file updated
* Create azure-windows-multitenancy-transparent-vlan.conflist
* Unified snat err format
* Rename to transparent-vlan
* Route table support added to local netlink
* Moved SNAT to end of function
* Defer deleting vlan interface on failure
2022-08-10 23:50:26 +03:00
|
|
|
$(MKDIR) $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR)
|
|
|
|
cp cni/azure-$(GOOS)-multitenancy-transparent-vlan.conflist $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR)/10-azure.conflist
|
2024-02-16 00:28:17 +03:00
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR)
|
feat: Add SNAT bridge to Native, decouple SNAT bridge (#1506)
* Native Endpoint Client Add Endpoints
* AddEndpointRules, ConfigureContainerInterfacesAndRoutes
* Changed interface names, log statements
nw.extIf.Name > eth0 (eth0)
eth0.vlanid > eth0.X (eth0.1)
%s%s hostIfName > vnet (A1veth0)
%s%s-2 contIfName > container (B1veth0)
* Renaming, using lib to set ns
* Namespace "path" is /var/run/netns/<NS>
* Loopback set up, Remove auto kernel subnet route
* Cannot set link to up if it's in another NS
* Multiple containers on same VNET NS
* Delete Endpoint routes on Delete
* Minimizing netns usage
* Moving NS Exec Code
* Further minimized netns.Set usage
* Moved helper methods down, drafted tests
* Removed DevName from Route Info, more tests
* Test existing vnet ns, delete endpoint
* NetNS interface for testing
* Separated tests by namespace
* Endpoints delete if they cannot be moved into NS
* Namespace netns tests
* Added Native Client to deleteEndpointImpl
* Deletion of Endpoints Impl and Tests
* Cleaned code (Tests ok)
* Moved mock/netns to package (Tests ok)
* Fixing Netns (wip)
Moved netnsinterface to consumer package (network).
Removed "Netns" from "NewNetns" and "NewMockNetns" as it is unambiguous.
Changed uintptr to int and casted the int to uintptr when needed later.
* Using errors.Wrap for error context (wip)
* Removed sentence case (wip)
* Removing variable predeclaration
* Removed NewNativeEndpointClient
Directly instantiating struct because nothing special happens in NewNativeEndpointClient
* Removed generics from ExecuteInNS
* Removed uintptr from mocknetns, tests compile
Forgot to remove uintptr from mocknetns
* Fix tests, lint
* Fixes from linter
Works on VMSS
* Replacing references to ethX with vlan veth
* Removed unnecessary log
* Removed unnecessary mac, fix tests
* Mockns method name enum
* Unable to use GetNetworkInterfaceByName due to NS
If I use GetNetworkInterface, I need to be in the vnet NS, but that means I will need to call ExecuteInNS, which causes tests to fail.
* Fixes from linter
* Assume if NS exists, vlan veth exists
Tests ok
* Fixes for Linter
* Snat refactor
* Fix delete tests
* Fix delete tests bug
* More snat refactor
* Breaking, prepping for Native Snat
Delete native endpoint snat route linux to remove errors and in theory, ovs should work fine again.
* Go mod tidy for linting
Hopefully this fixes the windows lint error
* Add fields to native endpoint client for snat
* Using New() func to create Native Client
Creation of the native endpoint client is too complicated to directly instantiate.
* Snat defaults
* Insert SNAT entry points
* Native Snat error handling
* Breaking, decouple ovsctl from snat
Proposed Solution implementation
Moved ovsctlClient.AddPortOnOVSBridge to ovs_endpoint_snatroute_linux.go. Removed ovsctlclient from NewSnatClient. Removed ovsctlClient from testing file.
* Delete unecessary ovssnat files
* No lint on vishvananda netns
Maybe this will fix the windows linter?
* Build linux only for netns package
Maybe this fixes the linter error?
* Remove nolint to see if linter fails
* Breaking, removed bridgeName
bridgeName refers to the OVS Switch I believe
* If native uses snat bridge, should also get IP
* Breaking, Decouple or Wrap snat route
* Check to see if snat triggered
* Snat behaviors specific to ovs/native
* Pass the pointer
Add/Delete ok
* Renaming to make consts public
* Breaking, moving ovs specific parts of snat to ovs
* Remove enable infra vnet (Tests ok)
Tested:
Allow Host to NC only
Allow NC to Host only
Allow both
Wget
Ping between containers
Warning: Enable snat is still hard coded to true!!!
* Move add port to after exists() check
* Moved netns interface to caller, generalized tests
Tests ok, Native ok
* Typos
* Reordered if statement, unwrapped arp
Tests ok, ping ok, wget ok
* Linted, wrapping errors
* Go fumpt entire network package
* Code markers removed, clean (Tests ok)
OVS & Native:
- Ping between two containers same VM, no packets on bridge
- Ping between two containers diff VM, no packets on bridge
- Ping other container not in vnet, no packets on bridge
- Ping snat to container, packets on bridge
- Ping container to snat, packets on bridge
- Tcpdump confirmed on azSnatBr
- Deletion of containers deletes appropriate interfaces
* Renamed veth, fixed logs
* Made deleteEndpoints logic clearer, renamed error
* Renamed eth0 to primaryHostIfName, vlanEth to vlanIf
* Deleted debug log
* Corrected merge (hardware addr) (Tests ok)
* Renamed vlan veth to hostExtIf_vlanID, Disabled RA
eth0.2 makes disable RA look for a folder eth0 and then another sub folder "2". ("eth0/2") However, it should look for a folder named "eth0.2" literally. To solve this, we change the naming scheme to use an underscore instead. (Tests ok)
* Renamed Native to TransparentVlan
Confirmed basic functionality on VM with correct mode
* Make file updated
* Create azure-windows-multitenancy-transparent-vlan.conflist
* Unified snat err format
* Rename to transparent-vlan
* Route table support added to local netlink
* Moved SNAT to end of function
* Defer deleting vlan interface on failure
2022-08-10 23:50:26 +03:00
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR)/azure-vnet-telemetry.config
|
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR)
|
2024-02-16 00:28:17 +03:00
|
|
|
cd $(CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_MULTITENANCY_TRANSPARENT_VLAN_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
feat: Add SNAT bridge to Native, decouple SNAT bridge (#1506)
* Native Endpoint Client Add Endpoints
* AddEndpointRules, ConfigureContainerInterfacesAndRoutes
* Changed interface names, log statements
nw.extIf.Name > eth0 (eth0)
eth0.vlanid > eth0.X (eth0.1)
%s%s hostIfName > vnet (A1veth0)
%s%s-2 contIfName > container (B1veth0)
* Renaming, using lib to set ns
* Namespace "path" is /var/run/netns/<NS>
* Loopback set up, Remove auto kernel subnet route
* Cannot set link to up if it's in another NS
* Multiple containers on same VNET NS
* Delete Endpoint routes on Delete
* Minimizing netns usage
* Moving NS Exec Code
* Further minimized netns.Set usage
* Moved helper methods down, drafted tests
* Removed DevName from Route Info, more tests
* Test existing vnet ns, delete endpoint
* NetNS interface for testing
* Separated tests by namespace
* Endpoints delete if they cannot be moved into NS
* Namespace netns tests
* Added Native Client to deleteEndpointImpl
* Deletion of Endpoints Impl and Tests
* Cleaned code (Tests ok)
* Moved mock/netns to package (Tests ok)
* Fixing Netns (wip)
Moved netnsinterface to consumer package (network).
Removed "Netns" from "NewNetns" and "NewMockNetns" as it is unambiguous.
Changed uintptr to int and casted the int to uintptr when needed later.
* Using errors.Wrap for error context (wip)
* Removed sentence case (wip)
* Removing variable predeclaration
* Removed NewNativeEndpointClient
Directly instantiating struct because nothing special happens in NewNativeEndpointClient
* Removed generics from ExecuteInNS
* Removed uintptr from mocknetns, tests compile
Forgot to remove uintptr from mocknetns
* Fix tests, lint
* Fixes from linter
Works on VMSS
* Replacing references to ethX with vlan veth
* Removed unnecessary log
* Removed unnecessary mac, fix tests
* Mockns method name enum
* Unable to use GetNetworkInterfaceByName due to NS
If I use GetNetworkInterface, I need to be in the vnet NS, but that means I will need to call ExecuteInNS, which causes tests to fail.
* Fixes from linter
* Assume if NS exists, vlan veth exists
Tests ok
* Fixes for Linter
* Snat refactor
* Fix delete tests
* Fix delete tests bug
* More snat refactor
* Breaking, prepping for Native Snat
Delete native endpoint snat route linux to remove errors and in theory, ovs should work fine again.
* Go mod tidy for linting
Hopefully this fixes the windows lint error
* Add fields to native endpoint client for snat
* Using New() func to create Native Client
Creation of the native endpoint client is too complicated to directly instantiate.
* Snat defaults
* Insert SNAT entry points
* Native Snat error handling
* Breaking, decouple ovsctl from snat
Proposed Solution implementation
Moved ovsctlClient.AddPortOnOVSBridge to ovs_endpoint_snatroute_linux.go. Removed ovsctlclient from NewSnatClient. Removed ovsctlClient from testing file.
* Delete unecessary ovssnat files
* No lint on vishvananda netns
Maybe this will fix the windows linter?
* Build linux only for netns package
Maybe this fixes the linter error?
* Remove nolint to see if linter fails
* Breaking, removed bridgeName
bridgeName refers to the OVS Switch I believe
* If native uses snat bridge, should also get IP
* Breaking, Decouple or Wrap snat route
* Check to see if snat triggered
* Snat behaviors specific to ovs/native
* Pass the pointer
Add/Delete ok
* Renaming to make consts public
* Breaking, moving ovs specific parts of snat to ovs
* Remove enable infra vnet (Tests ok)
Tested:
Allow Host to NC only
Allow NC to Host only
Allow both
Wget
Ping between containers
Warning: Enable snat is still hard coded to true!!!
* Move add port to after exists() check
* Moved netns interface to caller, generalized tests
Tests ok, Native ok
* Typos
* Reordered if statement, unwrapped arp
Tests ok, ping ok, wget ok
* Linted, wrapping errors
* Go fumpt entire network package
* Code markers removed, clean (Tests ok)
OVS & Native:
- Ping between two containers same VM, no packets on bridge
- Ping between two containers diff VM, no packets on bridge
- Ping other container not in vnet, no packets on bridge
- Ping snat to container, packets on bridge
- Ping container to snat, packets on bridge
- Tcpdump confirmed on azSnatBr
- Deletion of containers deletes appropriate interfaces
* Renamed veth, fixed logs
* Made deleteEndpoints logic clearer, renamed error
* Renamed eth0 to primaryHostIfName, vlanEth to vlanIf
* Deleted debug log
* Corrected merge (hardware addr) (Tests ok)
* Renamed vlan veth to hostExtIf_vlanID, Disabled RA
eth0.2 makes disable RA look for a folder eth0 and then another sub folder "2". ("eth0/2") However, it should look for a folder named "eth0.2" literally. To solve this, we change the naming scheme to use an underscore instead. (Tests ok)
* Renamed Native to TransparentVlan
Confirmed basic functionality on VM with correct mode
* Make file updated
* Create azure-windows-multitenancy-transparent-vlan.conflist
* Unified snat err format
* Rename to transparent-vlan
* Route table support added to local netlink
* Moved SNAT to end of function
* Defer deleting vlan interface on failure
2022-08-10 23:50:26 +03:00
|
|
|
endif
|
|
|
|
|
2022-04-06 20:09:25 +03:00
|
|
|
$(MKDIR) $(CNI_SWIFT_BUILD_DIR)
|
|
|
|
cp cni/azure-$(GOOS)-swift.conflist $(CNI_SWIFT_BUILD_DIR)/10-azure.conflist
|
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_SWIFT_BUILD_DIR)/azure-vnet-telemetry.config
|
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_SWIFT_BUILD_DIR)
|
2024-06-12 08:24:47 +03:00
|
|
|
cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_SWIFT_BUILD_DIR)/azure-vnet-stateless$(EXE_EXT)
|
|
|
|
cd $(CNI_SWIFT_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_SWIFT_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-stateless$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
2022-04-06 20:09:25 +03:00
|
|
|
|
2022-05-06 20:14:46 +03:00
|
|
|
$(MKDIR) $(CNI_OVERLAY_BUILD_DIR)
|
|
|
|
cp cni/azure-$(GOOS)-swift-overlay.conflist $(CNI_OVERLAY_BUILD_DIR)/10-azure.conflist
|
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_OVERLAY_BUILD_DIR)/azure-vnet-telemetry.config
|
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_OVERLAY_BUILD_DIR)
|
2024-06-12 08:24:47 +03:00
|
|
|
cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_OVERLAY_BUILD_DIR)/azure-vnet-stateless$(EXE_EXT)
|
|
|
|
cd $(CNI_OVERLAY_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_OVERLAY_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-stateless$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
2022-05-06 20:14:46 +03:00
|
|
|
|
2023-04-30 00:50:44 +03:00
|
|
|
$(MKDIR) $(CNI_DUALSTACK_BUILD_DIR)
|
|
|
|
cp cni/azure-$(GOOS)-swift-overlay-dualstack.conflist $(CNI_DUALSTACK_BUILD_DIR)/10-azure.conflist
|
|
|
|
cp telemetry/azure-vnet-telemetry.config $(CNI_DUALSTACK_BUILD_DIR)/azure-vnet-telemetry.config
|
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_DUALSTACK_BUILD_DIR)
|
2024-06-12 08:24:47 +03:00
|
|
|
cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_DUALSTACK_BUILD_DIR)/azure-vnet-stateless$(EXE_EXT)
|
|
|
|
cd $(CNI_DUALSTACK_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_DUALSTACK_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-stateless$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config
|
2023-04-30 00:50:44 +03:00
|
|
|
|
2021-03-26 20:28:42 +03:00
|
|
|
#baremetal mode is windows only (at least for now)
|
|
|
|
ifeq ($(GOOS),windows)
|
2021-09-18 01:05:32 +03:00
|
|
|
$(MKDIR) $(CNI_BAREMETAL_BUILD_DIR)
|
2021-03-26 20:28:42 +03:00
|
|
|
cp cni/azure-$(GOOS)-baremetal.conflist $(CNI_BAREMETAL_BUILD_DIR)/10-azure.conflist
|
|
|
|
cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BAREMETAL_BUILD_DIR)
|
|
|
|
cd $(CNI_BAREMETAL_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_BAREMETAL_ARCHIVE_NAME) azure-vnet$(EXE_EXT) 10-azure.conflist
|
|
|
|
endif
|
|
|
|
|
2021-09-18 01:05:32 +03:00
|
|
|
# Create a cli archive for the target platform.
|
2020-10-21 00:00:40 +03:00
|
|
|
.PHONY: acncli-archive
|
2021-09-18 01:05:32 +03:00
|
|
|
acncli-archive: acncli-binary
|
2020-12-11 05:06:53 +03:00
|
|
|
ifeq ($(GOOS),linux)
|
2021-09-18 01:05:32 +03:00
|
|
|
$(MKDIR) $(ACNCLI_BUILD_DIR)
|
2020-10-21 00:00:40 +03:00
|
|
|
cd $(ACNCLI_BUILD_DIR) && $(ARCHIVE_CMD) $(ACNCLI_ARCHIVE_NAME) acn$(EXE_EXT)
|
2020-12-11 05:06:53 +03:00
|
|
|
endif
|
2020-10-21 00:00:40 +03:00
|
|
|
|
2018-02-22 23:57:03 +03:00
|
|
|
# Create a CNS archive for the target platform.
|
|
|
|
.PHONY: cns-archive
|
2021-09-18 01:05:32 +03:00
|
|
|
cns-archive: azure-cns-binary
|
2020-01-25 00:29:52 +03:00
|
|
|
cp cns/configuration/cns_config.json $(CNS_BUILD_DIR)/cns_config.json
|
|
|
|
cd $(CNS_BUILD_DIR) && $(ARCHIVE_CMD) $(CNS_ARCHIVE_NAME) azure-cns$(EXE_EXT) cns_config.json
|
2018-07-20 02:06:11 +03:00
|
|
|
|
2018-07-20 04:20:01 +03:00
|
|
|
# Create a NPM archive for the target platform. Only Linux is supported for now.
|
2018-07-20 02:06:11 +03:00
|
|
|
.PHONY: npm-archive
|
2021-09-18 01:05:32 +03:00
|
|
|
npm-archive: azure-npm-binary
|
2018-07-20 02:06:11 +03:00
|
|
|
ifeq ($(GOOS),linux)
|
2020-01-07 03:11:52 +03:00
|
|
|
cd $(NPM_BUILD_DIR) && $(ARCHIVE_CMD) $(NPM_ARCHIVE_NAME) azure-npm$(EXE_EXT)
|
2019-09-21 02:15:08 +03:00
|
|
|
endif
|
|
|
|
|
2022-09-07 00:07:56 +03:00
|
|
|
# Create a azure-ipam archive for the target platform.
|
|
|
|
.PHONY: azure-ipam-archive
|
|
|
|
azure-ipam-archive: azure-ipam-binary
|
|
|
|
ifeq ($(GOOS),linux)
|
|
|
|
$(MKDIR) $(AZURE_IPAM_BUILD_DIR)
|
|
|
|
cd $(AZURE_IPAM_BUILD_DIR) && $(ARCHIVE_CMD) $(AZURE_IPAM_ARCHIVE_NAME) azure-ipam$(EXE_EXT)
|
|
|
|
endif
|
|
|
|
|
2024-05-30 23:43:37 +03:00
|
|
|
# Create a ipv6-hp-bpf archive for the target platform.
|
|
|
|
.PHONY: ipv6-hp-bpf-archive
|
|
|
|
ipv6-hp-bpf-archive: ipv6-hp-bpf-binary
|
|
|
|
ifeq ($(GOOS),linux)
|
|
|
|
$(MKDIR) $(IPV6_HP_BPF_BUILD_DIR)
|
|
|
|
cd $(IPV6_HP_BPF_BUILD_DIR) && $(ARCHIVE_CMD) $(IPV6_HP_BPF_ARCHIVE_NAME) ipv6-hp-bpf$(EXE_EXT)
|
|
|
|
endif
|
2021-01-20 22:00:32 +03:00
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
##@ Utils
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
clean: ## Clean build artifacts.
|
|
|
|
$(RMDIR) $(OUTPUT_DIR)
|
|
|
|
$(RMDIR) $(TOOLS_BIN_DIR)
|
2022-04-25 21:42:29 +03:00
|
|
|
$(RMDIR) go.work*
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2021-01-20 22:00:32 +03:00
|
|
|
|
2021-06-14 21:08:26 +03:00
|
|
|
LINT_PKG ?= .
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
lint: $(GOLANGCI_LINT) ## Fast lint vs default branch showing only new issues.
|
2023-12-20 00:57:05 +03:00
|
|
|
GOGC=20 $(GOLANGCI_LINT) run --timeout 25m -v $(LINT_PKG)/...
|
2021-06-22 00:34:26 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
lint-all: $(GOLANGCI_LINT) ## Lint the current branch in entirety.
|
2022-09-28 08:22:55 +03:00
|
|
|
GOGC=20 $(GOLANGCI_LINT) run -v $(LINT_PKG)/...
|
2021-06-14 21:08:26 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2021-08-09 19:57:59 +03:00
|
|
|
FMT_PKG ?= cni cns npm
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
fmt: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm").
|
2021-08-09 19:57:59 +03:00
|
|
|
$(GOFUMPT) -s -w $(FMT_PKG)
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2022-04-25 21:42:29 +03:00
|
|
|
workspace: ## Set up the Go workspace.
|
|
|
|
go work init
|
|
|
|
go work use .
|
2022-09-01 21:35:01 +03:00
|
|
|
go work use ./azure-ipam
|
2022-04-25 21:42:29 +03:00
|
|
|
go work use ./build/tools
|
2022-07-16 00:56:02 +03:00
|
|
|
go work use ./dropgz
|
2022-04-25 21:42:29 +03:00
|
|
|
go work use ./zapai
|
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
##@ Test
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2021-09-17 04:25:40 +03:00
|
|
|
COVER_PKG ?= .
|
2023-06-09 03:17:32 +03:00
|
|
|
#Restart case is used for cni load test pipeline for restarting the nodes cluster.
|
|
|
|
RESTART_CASE ?= false
|
2023-08-08 21:27:45 +03:00
|
|
|
# CNI type is a key to direct the types of state validation done on a cluster.
|
|
|
|
CNI_TYPE ?= cilium
|
2021-09-17 04:25:40 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
test-all: ## run all unit tests.
|
2024-08-27 23:15:23 +03:00
|
|
|
@$(eval COVER_FILTER=`go list $(COVER_PKG)/... | tr '\n' ','`)
|
2021-09-18 01:29:40 +03:00
|
|
|
@echo Test coverpkg: $(COVER_FILTER)
|
2024-01-31 01:03:56 +03:00
|
|
|
go test -mod=readonly -buildvcs=false -tags "unit" --skip 'TestE2E*' -coverpkg=$(COVER_FILTER) -race -covermode atomic -coverprofile=coverage.out $(COVER_PKG)/...
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
test-integration: ## run all integration tests.
|
2023-11-21 06:59:16 +03:00
|
|
|
AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \
|
|
|
|
CNI_VERSION=$(CNI_VERSION) \
|
2022-09-01 21:35:01 +03:00
|
|
|
CNS_VERSION=$(CNS_VERSION) \
|
2024-01-31 01:03:56 +03:00
|
|
|
go test -mod=readonly -buildvcs=false -timeout 1h -coverpkg=./... -race -covermode atomic -coverprofile=coverage.out -tags=integration --skip 'TestE2E*' ./test/integration...
|
2021-05-05 09:51:45 +03:00
|
|
|
|
2023-09-22 19:18:30 +03:00
|
|
|
test-load: ## run all load tests
|
2023-11-21 06:59:16 +03:00
|
|
|
AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \
|
2024-01-11 06:11:42 +03:00
|
|
|
CNI_VERSION=$(CNI_VERSION)
|
2023-09-22 19:18:30 +03:00
|
|
|
CNS_VERSION=$(CNS_VERSION) \
|
2024-01-11 06:11:42 +03:00
|
|
|
go test -timeout 30m -race -tags=load ./test/integration/load... -v
|
2023-09-22 19:18:30 +03:00
|
|
|
|
2023-06-09 03:17:32 +03:00
|
|
|
test-validate-state:
|
2024-01-31 01:03:56 +03:00
|
|
|
cd test/integration/load && go test -mod=readonly -count=1 -timeout 30m -tags load --skip 'TestE2E*' -run ^TestValidateState
|
2023-06-09 03:17:32 +03:00
|
|
|
cd ../../..
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
test-cyclonus: ## run the cyclonus test for npm.
|
2021-05-05 09:51:45 +03:00
|
|
|
cd test/cyclonus && bash ./test-cyclonus.sh
|
|
|
|
cd ..
|
|
|
|
|
2022-08-08 20:43:44 +03:00
|
|
|
test-cyclonus-windows: ## run the cyclonus test for npm.
|
|
|
|
cd test/cyclonus && bash ./test-cyclonus.sh windows
|
|
|
|
cd ..
|
|
|
|
|
2022-03-05 01:01:05 +03:00
|
|
|
test-extended-cyclonus: ## run the cyclonus test for npm.
|
|
|
|
cd test/cyclonus && bash ./test-cyclonus.sh extended
|
|
|
|
cd ..
|
|
|
|
|
2022-10-18 00:13:35 +03:00
|
|
|
test-azure-ipam: ## run the unit test for azure-ipam
|
|
|
|
cd $(AZURE_IPAM_DIR) && go test
|
|
|
|
|
2021-05-05 09:51:45 +03:00
|
|
|
kind:
|
|
|
|
kind create cluster --config ./test/kind/kind.yaml
|
2021-05-28 19:34:04 +03:00
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
test-k8se2e: test-k8se2e-build test-k8se2e-only ## Alias to run build and test
|
|
|
|
|
|
|
|
test-k8se2e-build: ## Build k8s e2e test suite
|
|
|
|
cd hack/scripts && bash ./k8se2e.sh $(GROUP) $(CLUSTER)
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
test-k8se2e-only: ## Run k8s network conformance test, use TYPE=basic for only datapath tests
|
|
|
|
cd hack/scripts && bash ./k8se2e-tests.sh $(OS) $(TYPE)
|
|
|
|
cd ../..
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2021-11-22 21:56:58 +03:00
|
|
|
##@ Utilities
|
|
|
|
|
|
|
|
$(REPO_ROOT)/.git/hooks/pre-push:
|
|
|
|
@ln -s $(REPO_ROOT)/.hooks/pre-push $(REPO_ROOT)/.git/hooks/
|
|
|
|
@echo installed pre-push hook
|
|
|
|
|
|
|
|
install-hooks: $(REPO_ROOT)/.git/hooks/pre-push ## installs git hooks
|
|
|
|
|
2022-09-13 00:00:51 +03:00
|
|
|
gitconfig: ## configure the local git repository
|
|
|
|
@git config commit.gpgsign true
|
|
|
|
@git config pull.rebase true
|
|
|
|
@git config fetch.prune true
|
|
|
|
@git config core.fsmonitor true
|
|
|
|
@git config core.untrackedcache true
|
|
|
|
|
|
|
|
setup: tools install-hooks gitconfig ## performs common required repo setup
|
2021-07-21 02:06:35 +03:00
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
##@ Tools
|
2021-09-18 01:05:32 +03:00
|
|
|
|
2021-05-28 19:34:04 +03:00
|
|
|
$(TOOLS_DIR)/go.mod:
|
|
|
|
cd $(TOOLS_DIR); go mod init && go mod tidy
|
|
|
|
|
2021-06-03 19:18:21 +03:00
|
|
|
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
|
2021-05-28 19:34:04 +03:00
|
|
|
|
2021-06-03 19:18:21 +03:00
|
|
|
controller-gen: $(CONTROLLER_GEN) ## Build controller-gen
|
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
protoc:
|
2021-12-14 22:52:28 +03:00
|
|
|
source ${REPO_ROOT}/scripts/install-protoc.sh
|
|
|
|
|
2021-06-03 19:18:21 +03:00
|
|
|
$(GOCOV): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/gocov github.com/axw/gocov/gocov
|
2021-06-03 19:18:21 +03:00
|
|
|
|
|
|
|
gocov: $(GOCOV) ## Build gocov
|
|
|
|
|
|
|
|
$(GOCOV_XML): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/gocov-xml github.com/AlekSi/gocov-xml
|
2021-06-03 19:18:21 +03:00
|
|
|
|
|
|
|
gocov-xml: $(GOCOV_XML) ## Build gocov-xml
|
|
|
|
|
2021-08-09 19:57:59 +03:00
|
|
|
$(GOFUMPT): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/gofumpt mvdan.cc/gofumpt
|
2021-06-03 19:18:21 +03:00
|
|
|
|
2021-12-13 22:18:08 +03:00
|
|
|
gofumpt: $(GOFUMPT) ## Build gofumpt
|
2021-06-03 19:18:21 +03:00
|
|
|
|
2021-06-14 21:08:26 +03:00
|
|
|
$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
|
2021-06-14 21:08:26 +03:00
|
|
|
|
|
|
|
golangci-lint: $(GOLANGCI_LINT) ## Build golangci-lint
|
|
|
|
|
2021-08-09 19:57:59 +03:00
|
|
|
$(GO_JUNIT_REPORT): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/go-junit-report github.com/jstemmer/go-junit-report
|
2021-08-09 19:57:59 +03:00
|
|
|
|
|
|
|
go-junit-report: $(GO_JUNIT_REPORT) ## Build go-junit-report
|
|
|
|
|
2021-07-30 20:28:21 +03:00
|
|
|
$(MOCKGEN): $(TOOLS_DIR)/go.mod
|
2023-05-03 20:25:21 +03:00
|
|
|
cd $(TOOLS_DIR); go mod download; go build -o bin/mockgen github.com/golang/mock/mockgen
|
2021-07-30 20:28:21 +03:00
|
|
|
|
|
|
|
mockgen: $(MOCKGEN) ## Build mockgen
|
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
clean-tools:
|
2021-11-30 04:05:32 +03:00
|
|
|
rm -r build/tools/bin
|
|
|
|
|
2022-02-16 04:00:04 +03:00
|
|
|
tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Build bins for build tools
|
|
|
|
|
|
|
|
|
2023-07-28 19:44:11 +03:00
|
|
|
##@ Help
|
2022-02-16 04:00:04 +03:00
|
|
|
|
|
|
|
help: ## Display this help
|
2023-07-28 19:44:11 +03:00
|
|
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
2024-05-31 20:02:11 +03:00
|
|
|
|
|
|
|
proto-gen: ## Generates source code from protobuf files
|
|
|
|
protoc --go_out=. --go-grpc_out=. cns/grpc/proto/server.proto
|