Skip to content

Commit

Permalink
Move Win antrea log dir
Browse files Browse the repository at this point in the history
Signed-off-by: wgrayson <wgrayson@vmware.com>
  • Loading branch information
GraysonWu committed Mar 9, 2022
1 parent b147eb2 commit b59c5fb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ endif
build-windows:
@echo "===> Building Antrea bins and antrea/antrea-windows Docker image <==="
ifneq ($(NO_PULL),)
docker build -t antrea/antrea-windows:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.windows $(DOCKER_BUILD_ARGS) .
docker build -t antrea/antrea-windows:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.windows $(DOCKER_BUILD_ARGS) . --network host
else
docker build --pull -t antrea/antrea-windows:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.windows $(DOCKER_BUILD_ARGS) .
docker build --pull -t antrea/antrea-windows:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.windows $(DOCKER_BUILD_ARGS) . --network host
endif
docker tag antrea/antrea-windows:$(DOCKER_IMG_VERSION) antrea/antrea-windows
docker tag antrea/antrea-windows:$(DOCKER_IMG_VERSION) projects.registry.vmware.com/antrea/antrea-windows
Expand Down
1 change: 0 additions & 1 deletion build/images/scripts/Install-WindowsCNI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ $ErrorActionPreference = "Stop";
mkdir -force /host/var/run/secrets/kubernetes.io/serviceaccount
cp -force /var/run/secrets/kubernetes.io/serviceaccount/* /host/var/run/secrets/kubernetes.io/serviceaccount/
mkdir -force /host/k/antrea/etc/
mkdir -force /host/k/antrea/logs/
cp /k/antrea/cni/* /host/opt/cni/bin/
cp /etc/antrea/antrea-agent.conf /host/k/antrea/etc/

Expand Down
14 changes: 11 additions & 3 deletions build/yamls/antrea-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ data:
# wins will rename the binary when executing it. So we need to copy the binary everytime before running it.
mkdir -force /host/k/antrea/bin
cp /k/antrea/bin/* /host/k/antrea/bin/
C:/k/antrea/utils/wins.exe cli process run --path /k/antrea/bin/antrea-agent.exe --args "--config=/k/antrea/etc/antrea-agent.conf --logtostderr=false --log_dir=/k/antrea/logs/ --alsologtostderr --log_file_max_size=100 --log_file_max_num=4 --v=0" --envs "KUBERNETES_SERVICE_HOST=$env:KUBERNETES_SERVICE_HOST KUBERNETES_SERVICE_PORT=$env:KUBERNETES_SERVICE_PORT ANTREA_SERVICE_HOST=$env:ANTREA_SERVICE_HOST ANTREA_SERVICE_PORT=$env:ANTREA_SERVICE_PORT NODE_NAME=$env:NODE_NAME KUBE_DNS_SERVICE_HOST=$env:KUBE_DNS_SERVICE_HOST KUBE_DNS_SERVICE_PORT=$env:KUBE_DNS_SERVICE_PORT"
C:/k/antrea/utils/wins.exe cli process run --path /k/antrea/bin/antrea-agent.exe --args "--config=/k/antrea/etc/antrea-agent.conf --logtostderr=false --log_dir=/var/log/antrea/ --alsologtostderr --log_file_max_size=100 --log_file_max_num=4 --v=0" --envs "KUBERNETES_SERVICE_HOST=$env:KUBERNETES_SERVICE_HOST KUBERNETES_SERVICE_PORT=$env:KUBERNETES_SERVICE_PORT ANTREA_SERVICE_HOST=$env:ANTREA_SERVICE_HOST ANTREA_SERVICE_PORT=$env:ANTREA_SERVICE_PORT NODE_NAME=$env:NODE_NAME KUBE_DNS_SERVICE_HOST=$env:KUBE_DNS_SERVICE_HOST KUBE_DNS_SERVICE_PORT=$env:KUBE_DNS_SERVICE_PORT"
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-agent-windows-d99k4g5264
name: antrea-agent-windows-kht6m7hthm
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -204,6 +204,8 @@ spec:
name: antrea-agent-windows
- mountPath: /host/k/antrea/
name: host-antrea-home
- mountPath: /host/var/log/antrea/
name: host-antrea-log
hostNetwork: true
initContainers:
- args:
Expand All @@ -224,6 +226,8 @@ spec:
name: host-cni-bin
- mountPath: /host/k/antrea/
name: host-antrea-home
- mountPath: /host/var/log/antrea/
name: host-antrea-log
- mountPath: /host
name: host
nodeSelector:
Expand All @@ -241,7 +245,7 @@ spec:
name: antrea-windows-config
- configMap:
defaultMode: 420
name: antrea-agent-windows-d99k4g5264
name: antrea-agent-windows-kht6m7hthm
name: antrea-agent-windows
- hostPath:
path: /etc/cni/net.d
Expand All @@ -255,6 +259,10 @@ spec:
path: /k/antrea
type: DirectoryOrCreate
name: host-antrea-home
- hostPath:
path: /var/log/antrea
type: DirectoryOrCreate
name: host-antrea-log
- hostPath:
path: /
name: host
Expand Down
8 changes: 8 additions & 0 deletions build/yamls/windows/base/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
name: antrea-agent-windows
- mountPath: /host/k/antrea/
name: host-antrea-home
- mountPath: /host/var/log/antrea/
name: host-antrea-log
hostNetwork: true
initContainers:
- command:
Expand All @@ -64,6 +66,8 @@ spec:
name: host-cni-bin
- mountPath: /host/k/antrea/
name: host-antrea-home
- mountPath: /host/var/log/antrea/
name: host-antrea-log
- mountPath: /host
name: host
nodeSelector:
Expand Down Expand Up @@ -95,6 +99,10 @@ spec:
path: /k/antrea
type: DirectoryOrCreate
name: host-antrea-home
- hostPath:
path: /var/log/antrea
type: DirectoryOrCreate
name: host-antrea-log
- hostPath:
path: /
name: host
Expand Down
2 changes: 1 addition & 1 deletion build/yamls/windows/base/conf/Run-AntreaAgent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ $ErrorActionPreference = "Stop"
# wins will rename the binary when executing it. So we need to copy the binary everytime before running it.
mkdir -force /host/k/antrea/bin
cp /k/antrea/bin/* /host/k/antrea/bin/
C:/k/antrea/utils/wins.exe cli process run --path /k/antrea/bin/antrea-agent.exe --args "--config=/k/antrea/etc/antrea-agent.conf --logtostderr=false --log_dir=/k/antrea/logs/ --alsologtostderr --log_file_max_size=100 --log_file_max_num=4 --v=0" --envs "KUBERNETES_SERVICE_HOST=$env:KUBERNETES_SERVICE_HOST KUBERNETES_SERVICE_PORT=$env:KUBERNETES_SERVICE_PORT ANTREA_SERVICE_HOST=$env:ANTREA_SERVICE_HOST ANTREA_SERVICE_PORT=$env:ANTREA_SERVICE_PORT NODE_NAME=$env:NODE_NAME KUBE_DNS_SERVICE_HOST=$env:KUBE_DNS_SERVICE_HOST KUBE_DNS_SERVICE_PORT=$env:KUBE_DNS_SERVICE_PORT"
C:/k/antrea/utils/wins.exe cli process run --path /k/antrea/bin/antrea-agent.exe --args "--config=/k/antrea/etc/antrea-agent.conf --logtostderr=false --log_dir=/var/log/antrea/ --alsologtostderr --log_file_max_size=100 --log_file_max_num=4 --v=0" --envs "KUBERNETES_SERVICE_HOST=$env:KUBERNETES_SERVICE_HOST KUBERNETES_SERVICE_PORT=$env:KUBERNETES_SERVICE_PORT ANTREA_SERVICE_HOST=$env:ANTREA_SERVICE_HOST ANTREA_SERVICE_PORT=$env:ANTREA_SERVICE_PORT NODE_NAME=$env:NODE_NAME KUBE_DNS_SERVICE_HOST=$env:KUBE_DNS_SERVICE_HOST KUBE_DNS_SERVICE_PORT=$env:KUBE_DNS_SERVICE_PORT"
2 changes: 1 addition & 1 deletion hack/windows/Helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function Start-AntreaAgent {
$AntreaAgent = "$AntreaHome\bin\antrea-agent.exe"
$AntreaAgentConfigPath = "$AntreaHome\etc\antrea-agent.conf"
if ($LogDir -eq "") {
$LogDir = "$AntreaHome\logs"
$LogDir = "c:\var\log\antrea"
}
New-DirectoryIfNotExist $LogDir
[Environment]::SetEnvironmentVariable("NODE_NAME", (hostname).ToLower())
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/logdir/logdir_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

package logdir

const antreaWellKnownLogDir = `C:\k\antrea\logs`
const antreaWellKnownLogDir = `C:\var\log\antrea`

0 comments on commit b59c5fb

Please sign in to comment.