-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [dropgz] Dropgz for windows (#2075)
* feat: [dropgz] Dropgz for windows * Removing the code for killing the process from dropgz for windows (cherry picked from commit 7a41178)
- Loading branch information
1 parent
b59476a
commit 1004c83
Showing
9 changed files
with
187 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG ARCH | ||
ARG OS_VERSION | ||
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS azure-vnet | ||
ARG VERSION | ||
WORKDIR /azure-container-networking | ||
COPY . . | ||
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go | ||
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-telemetry.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go | ||
RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-ipam.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go | ||
|
||
FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor | ||
ARG OS | ||
WORKDIR /dropgz | ||
COPY dropgz . | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/telemetry/azure-vnet-telemetry.config pkg/embed/fs | ||
RUN cd pkg/embed/fs/ && sha256sum * > sum.txt | ||
RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done | ||
|
||
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz | ||
ARG VERSION | ||
WORKDIR /dropgz | ||
COPY --from=compressor /dropgz . | ||
RUN GOOS=windows CGO_ENABLED=0 go build -a -o bin/dropgz.exe -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go | ||
|
||
FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} | ||
COPY --from=dropgz /dropgz/bin/dropgz.exe dropgz.exe | ||
ENTRYPOINT [ "dropgz.exe" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ARG ARCH | ||
ARG OS_VERSION | ||
FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS tar | ||
RUN tdnf install -y tar | ||
RUN tdnf install -y unzip | ||
RUN tdnf upgrade -y && tdnf install -y ca-certificates | ||
|
||
FROM tar AS azure-vnet | ||
ARG AZCNI_VERSION=v1.5.4 | ||
ARG VERSION | ||
ARG OS | ||
ARG ARCH | ||
WORKDIR /azure-container-networking | ||
COPY . . | ||
RUN curl -LO --cacert /etc/ssl/certs/ca-certificates.crt https://github.com/Azure/azure-container-networking/releases/download/$AZCNI_VERSION/azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip && unzip -o azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip | ||
|
||
FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor | ||
ARG OS | ||
WORKDIR /dropgz | ||
COPY dropgz . | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam.exe pkg/embed/fs | ||
COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.config pkg/embed/fs | ||
RUN cd pkg/embed/fs/ && sha256sum * > sum.txt | ||
RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done | ||
|
||
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.20 AS dropgz | ||
ARG VERSION | ||
WORKDIR /dropgz | ||
COPY --from=compressor /dropgz . | ||
RUN GOOS=windows CGO_ENABLED=0 go build -a -o bin/dropgz.exe -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go | ||
|
||
FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} | ||
COPY --from=dropgz /dropgz/bin/dropgz.exe dropgz.exe | ||
ENTRYPOINT [ "dropgz.exe" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
test/integration/manifests/cni/cni-installer-v1-windows.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: azure-cni-windows | ||
labels: | ||
tier: node | ||
app: azure-cni | ||
namespace: kube-system | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: azure-cni | ||
template: | ||
metadata: | ||
labels: | ||
tier: node | ||
app: azure-cni | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/os | ||
operator: In | ||
values: | ||
- windows | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- amd64 | ||
securityContext: | ||
windowsOptions: | ||
hostProcess: true | ||
runAsUserName: "NT AUTHORITY\\system" | ||
hostNetwork: true | ||
serviceAccountName: azure-cni | ||
tolerations: | ||
- key: CriticalAddonsOnly | ||
operator: Exists | ||
- operator: "Exists" | ||
effect: NoExecute | ||
- operator: "Exists" | ||
effect: NoSchedule | ||
initContainers: | ||
- name: delete-azure-vnet-telemetry | ||
image: mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022 | ||
command: ["powershell.exe", "-command"] | ||
args: ["if (Get-Process -Name 'azure-vnet-telemetry' -ErrorAction SilentlyContinue) { Stop-Process -Name 'azure-vnet-telemetry' -Force }"] | ||
- name: cni-drop | ||
image: ${DROP_GZ_URL} | ||
imagePullPolicy: Always | ||
command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/dropgz.exe"] | ||
args: | ||
- deploy | ||
- azure-vnet.exe | ||
- -o | ||
- /k/azurecni/bin/azure-vnet.exe | ||
- azure-vnet-ipam.exe | ||
- -o | ||
- /k/azurecni/bin/azure-vnet-ipam.exe | ||
- azure-vnet-telemetry.exe | ||
- -o | ||
- /k/azurecni/bin/azure-vnet-telemetry.exe | ||
- azure-vnet-telemetry.config | ||
- -o | ||
- /k/azurecni/bin/azure-vnet-telemetry.config | ||
volumeMounts: | ||
- name: cni-bin | ||
mountPath: /k/azurecni/bin/ | ||
containers: | ||
- name: pause | ||
image: mcr.microsoft.com/oss/kubernetes/pause:3.6 | ||
command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/pause.exe"] | ||
volumes: | ||
- name: cni-bin | ||
hostPath: | ||
path: /k/azurecni/bin | ||
type: DirectoryOrCreate | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: azure-cni | ||
namespace: kube-system | ||
labels: | ||
addonmanager.kubernetes.io/mode: EnsureExists |