Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scanAll typo #4253

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion docs/concepts/coordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Spiderpool incorporates a CNI meta-plugin called `coordinator` that works after
- Check the reachability of Pod gateways
- Support fixed Mac address prefixes for Pods

Note: If your OS(such as Fedora, CentOS, etc.) uses NetworkManager, highly recommend configuring following configuration file at `/etc/NetworkManager/conf.d/spidernet.conf` to
Note: If your OS(such as Fedora, CentOS, etc.) uses NetworkManager, highly recommend configuring following configuration file at `/etc/NetworkManager/conf.d/spidernet.conf` to
prevent interference from NetworkManager with veth interfaces created through `coordinator`:

```shell
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 @@ -132,11 +132,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 @@
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)
}

Check warning on line 23 in pkg/ip/cidr.go

View check run for this annotation

Codecov / codecov/patch

pkg/ip/cidr.go#L22-L23

Added lines #L22 - L23 were not covered by tests
return ipNet, nil
}

Expand Down
Loading