Skip to content

Commit

Permalink
Merge pull request #684 from l1b0k/release-1.8
Browse files Browse the repository at this point in the history
backport to 1.8
  • Loading branch information
BSWANG authored Sep 10, 2024
2 parents 3ace63a + 5fd541d commit e6468c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,12 @@ func (n *networkService) GetIPInfo(ctx context.Context, r *rpc.GetInfoRequest) (
Msg: "Unexpected network type, maybe daemon mode changed",
}
}

if oldRes.ContainerID != nil {
if r.K8SPodInfraContainerId != *oldRes.ContainerID {
log.Info("cni request not match stored resource, ignored", "old", *oldRes.ContainerID)
return reply, nil
}
}
netConf := make([]*rpc.NetConf, 0)

err = json.Unmarshal([]byte(oldRes.NetConf), &netConf)
Expand Down
9 changes: 7 additions & 2 deletions plugin/driver/utils/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net"
"os"

terwayIP "github.com/AliyunContainerService/terway/pkg/ip"
terwaySysctl "github.com/AliyunContainerService/terway/pkg/sysctl"
Expand Down Expand Up @@ -354,15 +355,19 @@ func EnsureNetConfSet(ipv4, ipv6 bool) error {
for _, cfg := range ipv4NetConfig {
innerErr := terwaySysctl.EnsureConf(fmt.Sprintf(cfg[0], link.Attrs().Name), cfg[1])
if innerErr != nil {
err = fmt.Errorf("%v, %w", err, innerErr)
if !os.IsNotExist(innerErr) {
err = fmt.Errorf("%v, %w", err, innerErr)
}
}
}
}
if ipv6 {
for _, cfg := range ipv6NetConfig {
innerErr := terwaySysctl.EnsureConf(fmt.Sprintf(cfg[0], link.Attrs().Name), cfg[1])
if innerErr != nil {
err = fmt.Errorf("%v, %w", err, innerErr)
if !os.IsNotExist(innerErr) {
err = fmt.Errorf("%v, %w", err, innerErr)
}
}
}
}
Expand Down

0 comments on commit e6468c1

Please sign in to comment.