Skip to content

Commit

Permalink
Fix the base image cannot run in the arm64 and address in the access …
Browse files Browse the repository at this point in the history
…log module
  • Loading branch information
mrproliu committed Oct 22, 2024
1 parent e0fc8f7 commit 2352fb9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ Changes by Version
==================
Release Notes.

0.8.0
------------------
#### Features

#### Bug Fixes
* Fix the base image cannot run in the arm64.

#### Documentation

#### Issues and PR
- All issues are [here](https://github.com/apache/skywalking/milestone/228?closed=1)
- All and pull requests are [here](https://github.com/apache/skywalking-rover/milestone/8?closed=1)

0.7.0
------------------
#### Features
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

FROM golang:1.21

RUN apt update && \
RUN apt update -y && apt upgrade -y && \
git clone --depth 1 --branch v1.1.0 https://github.com/libbpf/libbpf.git && \
mkdir -p /usr/include/bpf && cp libbpf/src/*.h /usr/include/bpf && \
apt install -y lsb-release wget software-properties-common "$([ $(uname -m) = "x86_64" ] && echo "libc6-dev-i386" || echo "libc6-dev-armhf-cross")" && \
Expand Down
17 changes: 12 additions & 5 deletions pkg/accesslog/common/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (c *ConnectionManager) Find(event events.Event) *ConnectionInfo {
if e, socket := getSocketPairFromConnectEvent(event); e != nil && socket != nil {
var localAddress, remoteAddress *v3.ConnectionAddress
localPID, _ := events.ParseConnectionID(event.GetConnectionID())
localAddress = c.buildAddressFromLocalKubernetesProcess(localPID, socket.SrcPort)
localAddress = c.buildLocalAddress(localPID, socket.SrcPort, socket)
remoteAddress = c.buildRemoteAddress(e, socket)
if localAddress == nil || remoteAddress == nil {
return nil
Expand Down Expand Up @@ -287,12 +287,12 @@ func (c *ConnectionManager) buildRemoteAddress(e *events.SocketConnectEvent, soc
if addrInfo != nil {
log.Debugf("building the remote address from %s process, pid: %d, connection: %d-%d, role: %s, local: %s:%d, remote: %s:%d",
fromType, addrInfo.pid, e.GetConnectionID(), e.GetRandomID(), socket.Role, socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
return c.buildAddressFromLocalKubernetesProcess(addrInfo.pid, socket.DestPort)
return c.buildLocalAddress(addrInfo.pid, socket.DestPort, socket)
} else if tp == addressProcessTypeKubernetes {
if p := c.localIPWithPid[socket.DestIP]; p != 0 {
log.Debugf("building the remote address from kubernetes process, connection: %d-%d, role: %s, pid: %d, local: %s:%d, remote: %s:%d",
e.GetConnectionID(), e.GetRandomID(), socket.Role, p, socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
return c.buildAddressFromLocalKubernetesProcess(uint32(p), socket.DestPort)
return c.buildLocalAddress(uint32(p), socket.DestPort, socket)
}
}

Expand Down Expand Up @@ -364,7 +364,7 @@ func (c *ConnectionManager) buildConnection(event *events.SocketConnectEvent, so
}
}

func (c *ConnectionManager) buildAddressFromLocalKubernetesProcess(pid uint32, port uint16) *v3.ConnectionAddress {
func (c *ConnectionManager) buildLocalAddress(pid uint32, port uint16, socket *ip.SocketPair) *v3.ConnectionAddress {
c.monitoringProcessLock.RLock()
defer c.monitoringProcessLock.RUnlock()
for _, pi := range c.monitoringProcesses[int32(pid)] {
Expand All @@ -384,7 +384,14 @@ func (c *ConnectionManager) buildAddressFromLocalKubernetesProcess(pid uint32, p
}
}
}
return nil
return &v3.ConnectionAddress{
Address: &v3.ConnectionAddress_Ip{
Ip: &v3.IPAddress{
Host: socket.SrcIP,
Port: int32(port),
},
},
}
}

func (c *ConnectionManager) buildAddressFromRemote(ipHost string, port uint16) *v3.ConnectionAddress {
Expand Down

0 comments on commit 2352fb9

Please sign in to comment.