From 2e020c4c490f42851aeccf793ef9a48634616b3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 22:25:03 +0000 Subject: [PATCH 1/9] Initial plan for issue From 139b87e61f74be801321fc2f3cf34f06c0b7dcbb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 22:31:40 +0000 Subject: [PATCH 2/9] Add Docker image generation documentation to README Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- README.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/README.md b/README.md index 75630fdbbb..d9f79c011c 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,82 @@ $ make all-binaries Then follow the instructions for the plugin in [Documentation](docs/). +## Docker Image Generation +This repository supports building Docker container images for the core networking components. The build system uses Docker or Podman to create multi-platform images. + +### Prerequisites +- Docker or Podman installed and running +- For multi-platform builds: `make qemu-user-static` (Linux only) + +### Available Components + +#### Container Network Service (CNS) +```bash +# Build CNS container image +$ make cns-image + +# View image name and tag +$ make cns-image-name-and-tag +``` + +#### Container Network Interface (CNI) +```bash +# Build CNI container image +$ make cni-image + +# View image name and tag +$ make cni-image-name-and-tag +``` + +#### Network Policy Manager (NPM) +```bash +# Build NPM container image +$ make npm-image + +# View image name and tag +$ make npm-image-name-and-tag +``` + +#### Azure IP Address Management (Azure-IPAM) +```bash +# Build Azure-IPAM container image +$ make azure-ipam-image + +# View image name and tag +$ make azure-ipam-image-name-and-tag +``` + +### Customization Options +You can customize the build by setting environment variables: + +```bash +# Build for different platform/architecture +$ PLATFORM=linux/arm64 make cns-image + +# Use custom image registry +$ IMAGE_REGISTRY=myregistry.azurecr.io make cns-image + +# Use Podman instead of Docker +$ CONTAINER_BUILDER=podman make cns-image +``` + +### Image Operations +Each component supports additional operations: + +```bash +# Push image to registry +$ make cns-image-push + +# Pull image from registry +$ make cns-image-pull + +# Build multi-platform manifest +$ make cns-manifest-build +$ make cns-manifest-push +``` + +Images are tagged with platform and version information (e.g., `linux-amd64-v1.2.3`) and published to the `acnpublic.azurecr.io` registry by default. + ## Contributions Contributions in the form of bug reports, feature requests and PRs are always welcome. From cecb16b638013f2e89bdbe94d7530e582331e506 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 22:41:33 +0000 Subject: [PATCH 3/9] Make Docker image generation documentation generic as requested Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- README.md | 85 ++++++++++++++++++++++--------------------------------- 1 file changed, 34 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index d9f79c011c..dc5073f34a 100644 --- a/README.md +++ b/README.md @@ -39,80 +39,63 @@ $ make all-binaries Then follow the instructions for the plugin in [Documentation](docs/). ## Docker Image Generation -This repository supports building Docker container images for the core networking components. The build system uses Docker or Podman to create multi-platform images. +This repository supports building Docker container images for networking components using standardized make recipes. The build system uses Docker or Podman to create multi-platform images. ### Prerequisites - Docker or Podman installed and running - For multi-platform builds: `make qemu-user-static` (Linux only) ### Available Components +- **acncli** - CNI manager +- **azure-ipam** - Azure IP Address Management +- **cni** - Container Network Interface +- **cns** - Container Network Service +- **npm** - Network Policy Manager +- **ipv6-hp-bpf** - IPv6 Host Policy BPF -#### Container Network Service (CNS) -```bash -# Build CNS container image -$ make cns-image +### Generic Build Pattern +All components follow the same make recipe pattern: -# View image name and tag -$ make cns-image-name-and-tag -``` - -#### Container Network Interface (CNI) ```bash -# Build CNI container image -$ make cni-image +# Build container image +$ make -image # View image name and tag -$ make cni-image-name-and-tag -``` +$ make -image-name-and-tag -#### Network Policy Manager (NPM) -```bash -# Build NPM container image -$ make npm-image - -# View image name and tag -$ make npm-image-name-and-tag -``` +# Push image to registry +$ make -image-push -#### Azure IP Address Management (Azure-IPAM) -```bash -# Build Azure-IPAM container image -$ make azure-ipam-image +# Pull image from registry +$ make -image-pull -# View image name and tag -$ make azure-ipam-image-name-and-tag +# Build multi-platform manifest +$ make -manifest-build +$ make -manifest-push ``` -### Customization Options -You can customize the build by setting environment variables: - +### Example Usage ```bash -# Build for different platform/architecture -$ PLATFORM=linux/arm64 make cns-image +# Build CNS image +$ make cns-image -# Use custom image registry -$ IMAGE_REGISTRY=myregistry.azurecr.io make cns-image +# Build NPM image with custom platform +$ PLATFORM=linux/arm64 make npm-image + +# Build Azure-IPAM image with custom registry +$ IMAGE_REGISTRY=myregistry.azurecr.io make azure-ipam-image # Use Podman instead of Docker -$ CONTAINER_BUILDER=podman make cns-image +$ CONTAINER_BUILDER=podman make cni-image ``` -### Image Operations -Each component supports additional operations: - -```bash -# Push image to registry -$ make cns-image-push - -# Pull image from registry -$ make cns-image-pull - -# Build multi-platform manifest -$ make cns-manifest-build -$ make cns-manifest-push -``` +### Customization +Environment variables for customizing builds: +- `PLATFORM` - Target platform/architecture (default: linux/amd64) +- `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) +- `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) -Images are tagged with platform and version information (e.g., `linux-amd64-v1.2.3`) and published to the `acnpublic.azurecr.io` registry by default. +Images are tagged with platform and version information and published to the configured registry. ## Contributions Contributions in the form of bug reports, feature requests and PRs are always welcome. From 9aadc9e5453a98e0590a71f10d9ae5c9b0dda581 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 22:54:49 +0000 Subject: [PATCH 4/9] Move Docker image generation documentation to doc/README.md Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- README.md | 58 +------------------------------------------------- doc/README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 doc/README.md diff --git a/README.md b/README.md index dc5073f34a..26040f0632 100644 --- a/README.md +++ b/README.md @@ -39,63 +39,7 @@ $ make all-binaries Then follow the instructions for the plugin in [Documentation](docs/). ## Docker Image Generation -This repository supports building Docker container images for networking components using standardized make recipes. The build system uses Docker or Podman to create multi-platform images. - -### Prerequisites -- Docker or Podman installed and running -- For multi-platform builds: `make qemu-user-static` (Linux only) - -### Available Components -- **acncli** - CNI manager -- **azure-ipam** - Azure IP Address Management -- **cni** - Container Network Interface -- **cns** - Container Network Service -- **npm** - Network Policy Manager -- **ipv6-hp-bpf** - IPv6 Host Policy BPF - -### Generic Build Pattern -All components follow the same make recipe pattern: - -```bash -# Build container image -$ make -image - -# View image name and tag -$ make -image-name-and-tag - -# Push image to registry -$ make -image-push - -# Pull image from registry -$ make -image-pull - -# Build multi-platform manifest -$ make -manifest-build -$ make -manifest-push -``` - -### Example Usage -```bash -# Build CNS image -$ make cns-image - -# Build NPM image with custom platform -$ PLATFORM=linux/arm64 make npm-image - -# Build Azure-IPAM image with custom registry -$ IMAGE_REGISTRY=myregistry.azurecr.io make azure-ipam-image - -# Use Podman instead of Docker -$ CONTAINER_BUILDER=podman make cni-image -``` - -### Customization -Environment variables for customizing builds: -- `PLATFORM` - Target platform/architecture (default: linux/amd64) -- `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) -- `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) - -Images are tagged with platform and version information and published to the configured registry. +See [Docker Image Generation](doc/README.md) for instructions on building container images for networking components. ## Contributions Contributions in the form of bug reports, feature requests and PRs are always welcome. diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000000..0912b05238 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,59 @@ +# Docker Image Generation + +This repository supports building Docker container images for networking components using standardized make recipes. The build system uses Docker or Podman to create multi-platform images. + +## Prerequisites +- Docker or Podman installed and running +- For multi-platform builds: `make qemu-user-static` (Linux only) + +## Available Components +- **acncli** - CNI manager +- **azure-ipam** - Azure IP Address Management +- **cni** - Container Network Interface +- **cns** - Container Network Service +- **npm** - Network Policy Manager +- **ipv6-hp-bpf** - IPv6 Host Policy BPF + +## Generic Build Pattern +All components follow the same make recipe pattern: + +```bash +# Build container image +$ make -image + +# View image name and tag +$ make -image-name-and-tag + +# Push image to registry +$ make -image-push + +# Pull image from registry +$ make -image-pull + +# Build multi-platform manifest +$ make -manifest-build +$ make -manifest-push +``` + +## Example Usage +```bash +# Build CNS image +$ make cns-image + +# Build NPM image with custom platform +$ PLATFORM=linux/arm64 make npm-image + +# Build Azure-IPAM image with custom registry +$ IMAGE_REGISTRY=myregistry.azurecr.io make azure-ipam-image + +# Use Podman instead of Docker +$ CONTAINER_BUILDER=podman make cni-image +``` + +## Customization +Environment variables for customizing builds: +- `PLATFORM` - Target platform/architecture (default: linux/amd64) +- `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) +- `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) + +Images are tagged with platform and version information and published to the configured registry. \ No newline at end of file From f99a9befdc153c123e5be1d96bb2b9eecef98482 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 22:59:20 +0000 Subject: [PATCH 5/9] Move Docker image generation documentation to docs/README.md as requested Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- README.md | 2 +- doc/README.md | 59 ------------------------------------------------- docs/README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 60 deletions(-) delete mode 100644 doc/README.md diff --git a/README.md b/README.md index 26040f0632..725b61f46d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ $ make all-binaries Then follow the instructions for the plugin in [Documentation](docs/). ## Docker Image Generation -See [Docker Image Generation](doc/README.md) for instructions on building container images for networking components. +See [Docker Image Generation](docs/README.md#docker-image-generation) for instructions on building container images for networking components. ## Contributions Contributions in the form of bug reports, feature requests and PRs are always welcome. diff --git a/doc/README.md b/doc/README.md deleted file mode 100644 index 0912b05238..0000000000 --- a/doc/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Docker Image Generation - -This repository supports building Docker container images for networking components using standardized make recipes. The build system uses Docker or Podman to create multi-platform images. - -## Prerequisites -- Docker or Podman installed and running -- For multi-platform builds: `make qemu-user-static` (Linux only) - -## Available Components -- **acncli** - CNI manager -- **azure-ipam** - Azure IP Address Management -- **cni** - Container Network Interface -- **cns** - Container Network Service -- **npm** - Network Policy Manager -- **ipv6-hp-bpf** - IPv6 Host Policy BPF - -## Generic Build Pattern -All components follow the same make recipe pattern: - -```bash -# Build container image -$ make -image - -# View image name and tag -$ make -image-name-and-tag - -# Push image to registry -$ make -image-push - -# Pull image from registry -$ make -image-pull - -# Build multi-platform manifest -$ make -manifest-build -$ make -manifest-push -``` - -## Example Usage -```bash -# Build CNS image -$ make cns-image - -# Build NPM image with custom platform -$ PLATFORM=linux/arm64 make npm-image - -# Build Azure-IPAM image with custom registry -$ IMAGE_REGISTRY=myregistry.azurecr.io make azure-ipam-image - -# Use Podman instead of Docker -$ CONTAINER_BUILDER=podman make cni-image -``` - -## Customization -Environment variables for customizing builds: -- `PLATFORM` - Target platform/architecture (default: linux/amd64) -- `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) -- `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) - -Images are tagged with platform and version information and published to the configured registry. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 438ff3a584..0ae91d0c4d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,5 +10,65 @@ * [NPM](npm.md) - describes how to setup Azure-NPM (Azure Network Policy Manager). * [Scripts](scripts.md) - describes how to use the scripts in this repository. +## Docker Image Generation + +This repository supports building Docker container images for networking components using standardized make recipes. The build system uses Docker or Podman to create multi-platform images. + +### Prerequisites +- Docker or Podman installed and running +- For multi-platform builds: `make qemu-user-static` (Linux only) + +### Available Components +- **acncli** - CNI manager +- **azure-ipam** - Azure IP Address Management +- **cni** - Container Network Interface +- **cns** - Container Network Service +- **npm** - Network Policy Manager +- **ipv6-hp-bpf** - IPv6 Host Policy BPF + +### Generic Build Pattern +All components follow the same make recipe pattern: + +```bash +# Build container image +$ make -image + +# View image name and tag +$ make -image-name-and-tag + +# Push image to registry +$ make -image-push + +# Pull image from registry +$ make -image-pull + +# Build multi-platform manifest +$ make -manifest-build +$ make -manifest-push +``` + +### Example Usage +```bash +# Build CNS image +$ make cns-image + +# Build NPM image with custom platform +$ PLATFORM=linux/arm64 make npm-image + +# Build Azure-IPAM image with custom registry +$ IMAGE_REGISTRY=myregistry.azurecr.io make azure-ipam-image + +# Use Podman instead of Docker +$ CONTAINER_BUILDER=podman make cni-image +``` + +### Customization +Environment variables for customizing builds: +- `PLATFORM` - Target platform/architecture (default: linux/amd64) +- `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) +- `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) + +Images are tagged with platform and version information and published to the configured registry. + ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From 7a9616820fed09b2ebc3f6ba679b65923dc8c587 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:31:21 +0000 Subject: [PATCH 6/9] docs: Add Windows (GOOS) impact documentation for image generation Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- docs/README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/README.md b/docs/README.md index 0ae91d0c4d..dbb7fbd9e8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -67,8 +67,44 @@ Environment variables for customizing builds: - `PLATFORM` - Target platform/architecture (default: linux/amd64) - `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) - `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) +- `GOOS` - Target operating system for cross-compilation (default: linux) Images are tagged with platform and version information and published to the configured registry. +### Windows Image Generation +The `GOOS` environment variable has specific impacts on image generation: + +#### Operating System Targeting +- **Linux (default)**: `GOOS=linux` builds Linux container images using Ubuntu/Mariner base images +- **Windows**: `GOOS=windows` builds Windows container images using Windows Server Core base images + +#### Cross-compilation Behavior +When `GOOS=windows` is set: +- Go binaries are cross-compiled for Windows with `.exe` extensions +- Docker builds use Windows-specific base images (Windows Server Core, Host Process Containers) +- Different Dockerfiles may be used (e.g., `npm/windows.Dockerfile` vs `npm/linux.Dockerfile`) +- The Docker `--target` parameter selects the appropriate build stage (e.g., `windows` vs `linux`) + +#### Examples +```bash +# Build Linux image (default) +$ make npm-image + +# Build Windows image +$ GOOS=windows make npm-image + +# Build Windows image for ARM64 +$ GOOS=windows PLATFORM=windows/arm64 make npm-image + +# Cross-compile Windows binary in Linux container +$ GOOS=windows make cns-image +``` + +#### Component-Specific Considerations +- **NPM**: Uses separate Dockerfiles (`linux.Dockerfile`, `windows.Dockerfile`) +- **CNS**: Uses multi-stage Dockerfile with `linux` and `windows` targets +- **CNI**: Supports both Linux and Windows builds from the same Dockerfile +- **Azure-IPAM**: Primarily Linux-focused but supports Windows cross-compilation + ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From 987ee10622589eefe60b74476de706fe0cc57a2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:50:01 +0000 Subject: [PATCH 7/9] docs: Change Windows image example from ARM64 to AMD64 Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com> --- docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index dbb7fbd9e8..d6d3ad8b90 100644 --- a/docs/README.md +++ b/docs/README.md @@ -93,8 +93,8 @@ $ make npm-image # Build Windows image $ GOOS=windows make npm-image -# Build Windows image for ARM64 -$ GOOS=windows PLATFORM=windows/arm64 make npm-image +# Build Windows image for AMD64 +$ GOOS=windows PLATFORM=windows/amd64 make npm-image # Cross-compile Windows binary in Linux container $ GOOS=windows make cns-image From cd8dfda2fb1542380e5108599d7f612d7c35eff9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Jun 2025 18:40:27 +0000 Subject: [PATCH 8/9] Changes before error encountered Co-authored-by: rbtr <2940321+rbtr@users.noreply.github.com> --- docs/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index d6d3ad8b90..7e614705a1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,6 @@ This repository supports building Docker container images for networking compone - For multi-platform builds: `make qemu-user-static` (Linux only) ### Available Components -- **acncli** - CNI manager - **azure-ipam** - Azure IP Address Management - **cni** - Container Network Interface - **cns** - Container Network Service @@ -67,7 +66,6 @@ Environment variables for customizing builds: - `PLATFORM` - Target platform/architecture (default: linux/amd64) - `IMAGE_REGISTRY` - Custom registry (default: acnpublic.azurecr.io) - `CONTAINER_BUILDER` - Container builder (default: docker, alternative: podman) -- `GOOS` - Target operating system for cross-compilation (default: linux) Images are tagged with platform and version information and published to the configured registry. From f0767b33ee2a121dd7d65cc530b3a977741492ee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Jun 2025 19:59:51 +0000 Subject: [PATCH 9/9] docs: Remove GOOS documentation as requested in review Co-authored-by: rbtr <2940321+rbtr@users.noreply.github.com> --- docs/README.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/docs/README.md b/docs/README.md index 7e614705a1..72ca170352 100644 --- a/docs/README.md +++ b/docs/README.md @@ -69,40 +69,5 @@ Environment variables for customizing builds: Images are tagged with platform and version information and published to the configured registry. -### Windows Image Generation -The `GOOS` environment variable has specific impacts on image generation: - -#### Operating System Targeting -- **Linux (default)**: `GOOS=linux` builds Linux container images using Ubuntu/Mariner base images -- **Windows**: `GOOS=windows` builds Windows container images using Windows Server Core base images - -#### Cross-compilation Behavior -When `GOOS=windows` is set: -- Go binaries are cross-compiled for Windows with `.exe` extensions -- Docker builds use Windows-specific base images (Windows Server Core, Host Process Containers) -- Different Dockerfiles may be used (e.g., `npm/windows.Dockerfile` vs `npm/linux.Dockerfile`) -- The Docker `--target` parameter selects the appropriate build stage (e.g., `windows` vs `linux`) - -#### Examples -```bash -# Build Linux image (default) -$ make npm-image - -# Build Windows image -$ GOOS=windows make npm-image - -# Build Windows image for AMD64 -$ GOOS=windows PLATFORM=windows/amd64 make npm-image - -# Cross-compile Windows binary in Linux container -$ GOOS=windows make cns-image -``` - -#### Component-Specific Considerations -- **NPM**: Uses separate Dockerfiles (`linux.Dockerfile`, `windows.Dockerfile`) -- **CNS**: Uses multi-stage Dockerfile with `linux` and `windows` targets -- **CNI**: Supports both Linux and Windows builds from the same Dockerfile -- **Azure-IPAM**: Primarily Linux-focused but supports Windows cross-compilation - ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.