Skip to content

Commit

Permalink
Merge pull request #4253 from ty-dc/release-v0.8
Browse files Browse the repository at this point in the history
fix: scanAll typo
  • Loading branch information
weizhoublue authored Nov 4, 2024
2 parents f4cddb7 + dabd8f9 commit 98393cd
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmd/spiderpool-agent/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func DaemonMain() {

// Load spiderpool's global Comfigmap.
if err := agentContext.LoadConfigmap(); err != nil {
logger.Sugar().Fatal("Failed to load Configmap spiderpool-conf: %v", err)
logger.Sugar().Fatalf("Failed to load Configmap spiderpool-conf: %v", err)
}
logger.Sugar().Infof("Spiderpool-agent config: %+v", agentContext.Cfg)

Expand Down
2 changes: 1 addition & 1 deletion cmd/spiderpool-controller/cmd/crd_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ type _webhookHealthCheck struct{}
// ServeHTTP only serves for SpiderIPPool webhook health check, it will return http status code 200 for GET request
func (*_webhookHealthCheck) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
if request.Method == http.MethodGet {
//logger.Debug("SpiderIPPool webhook health check ready")
writer.WriteHeader(http.StatusOK)
logger.Info("Webhook health check successful")
}
}

Expand Down
22 changes: 11 additions & 11 deletions cmd/spiderpool-init/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ func (c *CoreClient) WaitForIPPoolCreated(ctx context.Context, ipPool *spiderpoo
logger := logutils.FromContext(ctx)

for {
err := c.Create(ctx, ipPool)
if err == nil {
logger.Sugar().Infof("Succeed to create default IPv%d IPPool: %+v", *ipPool.Spec.IPVersion, *ipPool)
return nil
}

if apierrors.IsAlreadyExists(err) {
logger.Sugar().Infof("Default IPv%d IPPool %s is already exists, ignore creating", *ipPool.Spec.IPVersion, ipPool.Name)
return nil
}

select {
case <-ctx.Done():
return ctx.Err()
default:
err := c.Create(ctx, ipPool)
if err == nil {
logger.Sugar().Infof("Succeed to create default IPv%d IPPool: %+v", *ipPool.Spec.IPVersion, *ipPool)
return nil
}

if apierrors.IsAlreadyExists(err) {
logger.Sugar().Infof("Default IPv%d IPPool %s is already exists, ignore creating", *ipPool.Spec.IPVersion, ipPool.Name)
return nil
}

interval := retryIntervalSec * time.Second
logger.Sugar().Infof("Failed to create default IPv%d IPPool %s, recreate in %s: %v", *ipPool.Spec.IPVersion, ipPool.Name, interval, err)
time.Sleep(interval)
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/arch-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Spiderpool 架构如上所示,包含了以下组件:
[RDMA shared device plugin](https://github.com/Mellanox/k8s-rdma-shared-dev-plugin): 用于发现主机上的共享 RDMA 设备,并上报给 Kubelet, 以供 RDMA CNI 使用,参考 [RDMA使用](../usage/rdma-zh_CN.md)

[RDMA CNI](https://github.com/k8snetworkplumbingwg/rdma-cni): 参考 [RDMA使用](../usage/rdma-zh_CN.md)

## 应用场景:Pod 接入一个 overlay CNI 和若干个 underlay CNI 网卡

![arch_underlay](../images/spiderpool-overlay.jpg)
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/coordinator-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Coordinator

[**English**](coordinator.md) | **简体中文**
**简体中文** | [**English**](coordinator.md)

Spiderpool 内置一个叫 `coordinator` 的 CNI meta-plugin, 它在 Main CNI 被调用之后再工作,它主要提供以下几个主要功能:

Expand Down
1 change: 1 addition & 0 deletions docs/usage/network-topology-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ spec:
{
"ipv4": ["test-ippool-6", "test-ippool-7"]
}
v1.multus-cni.io/default-network: kube-system/macvlan-conf
labels:
app: test-app
spec:
Expand Down
1 change: 1 addition & 0 deletions docs/usage/network-topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ spec:
{
"ipv4": ["test-ippool-6", "test-ippool-7"]
}
v1.multus-cni.io/default-network: kube-system/macvlan-conf
labels:
app: test-app
spec:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/route-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
我们也可为 SpiderIPPool 资源配置路由(`spec.routes`),创建 Pod 时会继承该路由:

> - 当 SpiderIPPool 资源配置了网关地址后,请勿为路由字段配置默认路由。
> - 当 SpiderIPPool 资源配置了网关地址后,请勿为路由字段配置默认路由。
> - `dst` 和 `gw` 字段都为必填

```yaml
Expand Down
6 changes: 1 addition & 5 deletions pkg/coordinatormanager/coordinator_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ func validateCoordinatorExtraCIDR(cidrs []string) *field.Error {
}

func validateCoordinatorPodMACPrefix(prefix *string) *field.Error {
if prefix == nil {
return nil
}

if *prefix == "" {
if prefix == nil || *prefix == "" {
return nil
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/gcmanager/scanAll_IPPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ func (s *SpiderGC) monitorGCSignal(ctx context.Context) {
// executeScanAll scans the whole pod and whole IPPoolList
func (s *SpiderGC) executeScanAll(ctx context.Context) {
poolList, err := s.ippoolMgr.ListIPPools(ctx, constant.UseCache)
if nil != err {
if err != nil {
if apierrors.IsNotFound(err) {
logger.Sugar().Warnf("scan all failed, ippoolList not found!")
return
}

logger.Sugar().Errorf("scan all failed: '%v'", err)
return
}
Expand Down Expand Up @@ -137,7 +136,7 @@ func (s *SpiderGC) executeScanAll(ctx context.Context) {
flagGCEndpoint = false
goto GCIP
} else {
scanAllLogger.Sugar().Errorf("pod %s/%s does not exist and failed to get endpoint %s/%s, ignore handle IP %s and endpoint, error: '%v'", podNS, podName, podNS, podName, poolIP, err)
scanAllLogger.Sugar().Errorf("pod %s/%s does not exist and failed to get endpoint %s/%s, ignore handle IP %s and endpoint, error: '%v'", podNS, podName, podNS, podName, poolIP, endpointErr)
continue
}
} else {
Expand All @@ -157,7 +156,7 @@ func (s *SpiderGC) executeScanAll(ctx context.Context) {
}
}
} else {
scanAllLogger.Sugar().Errorf("failed to get pod from kubernetes, error '%v'", err)
scanAllLogger.Sugar().Errorf("failed to get pod from kubernetes, error '%v'", podErr)
continue
}
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/ip/cidr.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ func ParseCIDR(version types.IPVersion, subnet string) (*net.IPNet, error) {
if err := IsCIDR(version, subnet); err != nil {
return nil, err
}
_, ipNet, _ := net.ParseCIDR(subnet)

_, ipNet, err := net.ParseCIDR(subnet)
if err != nil {
return nil, fmt.Errorf("failed to parse CIDR '%s': %v", subnet, err)
}
return ipNet, nil
}

Expand Down

0 comments on commit 98393cd

Please sign in to comment.