Skip to content

Commit

Permalink
feat: windows hpc base image
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
  • Loading branch information
rbtr authored Nov 5, 2024
1 parent b5a7f14 commit 4cb6b5d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .pipelines/containers/container-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
- script: |
set -e
if [ ${{ parameters.os }} = 'windows' ]; then export BUILDX_ACTION='--push'; fi
make ${{ parameters.name }}-image OS=${{ parameters.os }} ARCH=${{ parameters.arch }} OS_VERSION=${{ parameters.os_version }}
make ${{ parameters.name }}-image OS=${{ parameters.os }} ARCH=${{ parameters.arch }}
name: image_build
displayName: Image Build
retryCountOnTaskFailure: 3
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/containers/manifest-template.steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
- script: |
set -e
make ${{ parameters.name }}-manifest-build PLATFORMS="${{ parameters.platforms }}" OS_VERSIONS="${{ parameters.os_versions }}"
make ${{ parameters.name }}-manifest-build PLATFORMS="${{ parameters.platforms }}"
workingDirectory: $(ACN_DIR)
name: manifest_build
displayName: Manifest Build
Expand Down
63 changes: 21 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOOSES ?= "linux windows" # To override at the cli do: GOOSES="\"darwin bsd\""
GOARCHES ?= "amd64 arm64" # To override at the cli do: GOARCHES="\"ppc64 mips\""
ltsc2019 = "10.0.17763.4010"
ltsc2022 = "10.0.20348.643"
ltsc2025 = "10.0.26244.5000"

# Windows specific extensions
# set these based on the GOOS, not the OS
Expand Down Expand Up @@ -266,15 +263,15 @@ CNS_IMAGE = azure-cns
NPM_IMAGE = azure-npm

## Image platform tags.
ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(ACN_VERSION)
AZURE_IPAM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(AZURE_IPAM_VERSION)
AZURE_IPAM_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(AZURE_IPAM_VERSION)-$(OS_SKU_WIN)
IPV6_HP_BPF_IMAGE_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(IPV6_HP_BPF_VERSION)
CNI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_VERSION)
CNI_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_VERSION)-$(OS_SKU_WIN)
CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNS_VERSION)
CNS_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNS_VERSION)-$(OS_SKU_WIN)
NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(NPM_VERSION)
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)


qemu-user-static: ## Set up the host to run qemu multiplatform container builds.
Expand All @@ -287,7 +284,6 @@ container-buildah: # util target to build container images using buildah. do not
buildah bud \
--build-arg ARCH=$(ARCH) \
--build-arg OS=$(OS) \
--build-arg OS_VERSION=$(OS_VERSION) \
--build-arg PLATFORM=$(PLATFORM) \
--build-arg VERSION=$(TAG) \
$(EXTRA_BUILD_ARGS) \
Expand All @@ -305,7 +301,6 @@ container-docker: # util target to build container images using docker buildx. d
$(BUILDX_ACTION) \
--build-arg ARCH=$(ARCH) \
--build-arg OS=$(OS) \
--build-arg OS_VERSION=$(OS_VERSION) \
--build-arg PLATFORM=$(PLATFORM) \
--build-arg VERSION=$(TAG) \
$(EXTRA_BUILD_ARGS) \
Expand All @@ -319,7 +314,6 @@ container: # util target to build container images. do not invoke directly.
$(MAKE) container-$(CONTAINER_BUILDER) \
ARCH=$(ARCH) \
OS=$(OS) \
OS_VERSION=$(OS_VERSION) \
PLATFORM=$(PLATFORM) \
TAG=$(TAG) \
TARGET=$(TARGET)
Expand Down Expand Up @@ -376,8 +370,7 @@ azure-ipam-image: ## build azure-ipam container image.
TAG=$(AZURE_IPAM_PLATFORM_TAG) \
TARGET=$(OS) \
OS=$(OS) \
ARCH=$(ARCH) \
OS_VERSION=$(OS_VERSION)
ARCH=$(ARCH)

azure-ipam-image-push: ## push azure-ipam container image.
$(MAKE) container-push \
Expand All @@ -401,13 +394,12 @@ 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) \
EXTRA_BUILD_ARGS='--build-arg OS=$(OS) --build-arg ARCH=$(ARCH) --build-arg OS_VERSION=$(OS_VERSION) --build-arg DEBUG=$(DEBUG)'\
EXTRA_BUILD_ARGS='--build-arg OS=$(OS) --build-arg ARCH=$(ARCH) --build-arg DEBUG=$(DEBUG)'\
PLATFORM=$(PLATFORM) \
TAG=$(IPV6_HP_BPF_IMAGE_PLATFORM_TAG) \
TARGET=$(OS) \
OS=$(OS) \
ARCH=$(ARCH) \
OS_VERSION=$(OS_VERSION)
ARCH=$(ARCH)

ipv6-hp-bpf-image-push: ## push ipv6-hp-bpf container image.
$(MAKE) container-push \
Expand Down Expand Up @@ -436,7 +428,6 @@ cni-image: ## build cni container image.
TARGET=$(OS) \
OS=$(OS) \
ARCH=$(ARCH) \
OS_VERSION=$(OS_VERSION) \
EXTRA_BUILD_ARGS='--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'

cni-image-push: ## push cni container image.
Expand Down Expand Up @@ -467,8 +458,7 @@ cns-image: ## build cns container image.
TAG=$(CNS_PLATFORM_TAG) \
TARGET=$(OS) \
OS=$(OS) \
ARCH=$(ARCH) \
OS_VERSION=$(OS_VERSION)
ARCH=$(ARCH)

cns-image-push: ## push cns container image.
$(MAKE) container-push \
Expand Down Expand Up @@ -497,8 +487,7 @@ npm-image: ## build the npm container image.
TAG=$(NPM_PLATFORM_TAG) \
TARGET=$(OS) \
OS=$(OS) \
ARCH=$(ARCH) \
OS_VERSION=$(OS_VERSION)
ARCH=$(ARCH)

npm-image-push: ## push npm container image.
$(MAKE) container-push \
Expand All @@ -518,17 +507,12 @@ manifest-create:
$(CONTAINER_BUILDER) manifest create $(IMAGE_REGISTRY)/$(IMAGE):$(TAG)

manifest-add:
$(CONTAINER_BUILDER) manifest add --os=$(OS) --os-version=$($(OS_VERSION)) $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(TAG)
$(CONTAINER_BUILDER) manifest add --os=$(OS) $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)

manifest-build: # util target to compose multiarch container manifests from platform specific images.
$(MAKE) manifest-create
$(foreach PLATFORM,$(PLATFORMS),\
$(if $(filter $(PLATFORM),windows/amd64),\
$(foreach OS_VERSION,$(OS_VERSIONS),\
$(MAKE) manifest-add CONTAINER_BUILDER=$(CONTAINER_BUILDER) OS=windows OS_VERSION=$(OS_VERSION) PLATFORM=$(PLATFORM);\
),\
$(MAKE) manifest-add PLATFORM=$(PLATFORM);\
)\
$(MAKE) manifest-add PLATFORM=$(PLATFORM);\
)\

manifest-push: # util target to push multiarch container manifest.
Expand Down Expand Up @@ -559,8 +543,7 @@ azure-ipam-manifest-build: ## build azure-ipam multiplat container manifest.
$(MAKE) manifest-build \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(AZURE_IPAM_IMAGE) \
TAG=$(AZURE_IPAM_VERSION) \
OS_VERSIONS="$(OS_VERSIONS)"
TAG=$(AZURE_IPAM_VERSION)

azure-ipam-manifest-push: ## push azure-ipam multiplat container manifest
$(MAKE) manifest-push \
Expand All @@ -576,8 +559,7 @@ ipv6-hp-bpf-manifest-build: ## build ipv6-hp-bpf multiplat container manifest.
$(MAKE) manifest-build \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(IPV6_HP_BPF_IMAGE) \
TAG=$(IPV6_HP_BPF_VERSION) \
OS_VERSIONS="$(OS_VERSIONS)"
TAG=$(IPV6_HP_BPF_VERSION)

ipv6-hp-bpf-manifest-push: ## push ipv6-hp-bpf multiplat container manifest
$(MAKE) manifest-push \
Expand All @@ -593,8 +575,7 @@ cni-manifest-build: ## build cni multiplat container manifest.
$(MAKE) manifest-build \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(CNI_IMAGE) \
TAG=$(CNI_VERSION) \
OS_VERSIONS="$(OS_VERSIONS)"
TAG=$(CNI_VERSION)

cni-manifest-push: ## push cni multiplat container manifest
$(MAKE) manifest-push \
Expand All @@ -610,8 +591,7 @@ cns-manifest-build: ## build azure-cns multiplat container manifest.
$(MAKE) manifest-build \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(CNS_IMAGE) \
TAG=$(CNS_VERSION) \
OS_VERSIONS="$(OS_VERSIONS)"
TAG=$(CNS_VERSION)

cns-manifest-push: ## push cns multiplat container manifest
$(MAKE) manifest-push \
Expand All @@ -627,8 +607,7 @@ npm-manifest-build: ## build azure-npm multiplat container manifest.
$(MAKE) manifest-build \
PLATFORMS="$(PLATFORMS)" \
IMAGE=$(NPM_IMAGE) \
TAG=$(NPM_VERSION) \
OS_VERSIONS="$(OS_VERSIONS)"
TAG=$(NPM_VERSION)

npm-manifest-push: ## push multiplat container manifest
$(MAKE) manifest-push \
Expand Down
12 changes: 2 additions & 10 deletions azure-ipam/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ FROM scratch AS linux
COPY --from=dropgz /go/bin/dropgz dropgz
ENTRYPOINT [ "/dropgz" ]

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2019 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:7f6649348a11655e3576463fd6d55c29248f97405f8e643cab2409009339f520 AS ltsc2019

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2022 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:244113e50a678a25a63930780f9ccafd22e1a37aa9e3d93295e4cebf0f170a11 AS ltsc2022

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2025 --format "{{.Name}}@{{.Digest}}" ## 2025 isn't tagged yet
FROM mcr.microsoft.com/windows/nanoserver/insider@sha256:67e0ab7f3a79cd73be4a18bae24659c03b294aed0dbeaa624feb3810931f0bd2 AS ltsc2025

FROM ${OS_VERSION} AS windows
# skopeo inspect docker://mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b as windows
COPY --from=dropgz /go/bin/dropgz dropgz.exe
ENTRYPOINT [ "/dropgz.exe" ]
12 changes: 2 additions & 10 deletions cni/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ FROM scratch AS linux
COPY --from=dropgz /go/bin/dropgz dropgz
ENTRYPOINT [ "/dropgz" ]

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2019 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:7f6649348a11655e3576463fd6d55c29248f97405f8e643cab2409009339f520 AS ltsc2019

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2022 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:244113e50a678a25a63930780f9ccafd22e1a37aa9e3d93295e4cebf0f170a11 AS ltsc2022

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2025 --format "{{.Name}}@{{.Digest}}" ## 2025 isn't tagged yet
FROM mcr.microsoft.com/windows/nanoserver/insider@sha256:67e0ab7f3a79cd73be4a18bae24659c03b294aed0dbeaa624feb3810931f0bd2 AS ltsc2025

FROM ${OS_VERSION} as windows
# skopeo inspect docker://mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b as windows
COPY --from=dropgz /go/bin/dropgz dropgz.exe
ENTRYPOINT [ "/dropgz.exe" ]
12 changes: 2 additions & 10 deletions cns/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,8 @@ COPY --from=builder /go/bin/azure-cns /usr/local/bin/azure-cns
ENTRYPOINT [ "/usr/local/bin/azure-cns" ]
EXPOSE 10090

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2019 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:7f6649348a11655e3576463fd6d55c29248f97405f8e643cab2409009339f520 AS ltsc2019

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2022 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/windows/nanoserver@sha256:244113e50a678a25a63930780f9ccafd22e1a37aa9e3d93295e4cebf0f170a11 AS ltsc2022

# skopeo inspect --override-os windows docker://mcr.microsoft.com/windows/nanoserver:ltsc2025 --format "{{.Name}}@{{.Digest}}" ## 2025 isn't tagged yet
FROM mcr.microsoft.com/windows/nanoserver/insider@sha256:67e0ab7f3a79cd73be4a18bae24659c03b294aed0dbeaa624feb3810931f0bd2 AS ltsc2025

FROM ${OS_VERSION} AS windows
# skopeo inspect docker://mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 --format "{{.Name}}@{{.Digest}}"
FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image@sha256:b4c9637e032f667c52d1eccfa31ad8c63f1b035e8639f3f48a510536bf34032b as windows
COPY --from=builder /azure-container-networking/cns/kubeconfigtemplate.yaml kubeconfigtemplate.yaml
COPY --from=builder /azure-container-networking/npm/examples/windows/setkubeconfigpath.ps1 setkubeconfigpath.ps1
COPY --from=builder /go/bin/azure-cns /azure-cns.exe
Expand Down
4 changes: 1 addition & 3 deletions npm/windows.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ COPY . .
RUN GOOS=windows CGO_ENABLED=0 go build -v -o /usr/local/bin/azure-npm.exe -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" npm/cmd/*.go

# intermediate for win-ltsc2022
FROM mcr.microsoft.com/windows/servercore@sha256:45952938708fbde6ec0b5b94de68bcdec3f8c838be018536b1e9e5bd95e6b943 as ltsc2022

FROM ${OS_VERSION} as windows
FROM mcr.microsoft.com/windows/servercore@sha256:45952938708fbde6ec0b5b94de68bcdec3f8c838be018536b1e9e5bd95e6b943 as windows
COPY --from=builder /usr/local/src/npm/examples/windows/kubeconfigtemplate.yaml kubeconfigtemplate.yaml
COPY --from=builder /usr/local/src/npm/examples/windows/setkubeconfigpath.ps1 setkubeconfigpath.ps1
COPY --from=builder /usr/local/src/npm/examples/windows/setkubeconfigpath-capz.ps1 setkubeconfigpath-capz.ps1
Expand Down

0 comments on commit 4cb6b5d

Please sign in to comment.