This is an automated email from the ASF dual-hosted git repository.

mfordjody pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 33c3dcc7 fixed dubbo cni bug and typo (#935)
33c3dcc7 is described below

commit 33c3dcc7968261626bd8657ddae0bf6725081ea7
Author: mfordjody <[email protected]>
AuthorDate: Wed Jul 8 16:17:24 2026 +0800

    fixed dubbo cni bug and typo (#935)
---
 .asf.yaml                                          | 23 +++++----
 .codecov.yml                                       | 11 ++--
 CONTRIBUTING.md                                    |  2 +-
 README.md                                          |  1 -
 cni/main.go                                        |  5 +-
 .../charts/dubbod/templates/cni-daemonset.yaml     |  5 +-
 manifests/charts/dubbod/templates/cni-rbac.yaml    | 58 ++++++++++++++++++++++
 pkg/cni/plugin.go                                  | 17 +++++--
 pkg/cni/plugin_test.go                             | 49 ++++++++++++++++++
 tools/grpc-inbound/sample/grpc-bootstrap.json      |  6 +--
 10 files changed, 150 insertions(+), 27 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index a57176f4..199366fa 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -17,24 +17,27 @@ notifications:
     commits:      [email protected]
     issues:       [email protected]
     pullrequests: [email protected]
-    jira_options: link label
 
 github:
   homepage: "https://kdubbo.github.io";
-  description: "Build a native mesh using gRPC and xDS."
+  description: "Build a native mesh using gRPC and xDS"
+  labels:
+    - dubbo
+    - consul
+    - kubernetes
+    - service-mesh
+    - microservice
+    - microservices
   features:
-    # Enable wiki for documentation
-    wiki: false
     # Enable issue management
     issues: true
     # Enable projects for project management boards
     projects: false
+    # Enable wiki for documentation
+    wiki: false
   protected_branches:
     master: {}
-      # only disable force push
-      # foo: bar
-  labels:
-    - dubbo
-    - kubernetes
-    - service-mesh
+    # only disable force push
+    # foo: bar
+
 
diff --git a/.codecov.yml b/.codecov.yml
index f49dd894..250ec99e 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -25,9 +25,14 @@ coverage:
     # Pull requests only
     patch:
       default:
-        threshold: 0.1%
+        informational: true
+        # Commits pushed to master should not make the overall
+        # project coverage decrease:
+        target: auto
+        threshold: 0%
     project:
       default:
+        informational: true
         threshold: 0%
 
 ignore:
@@ -40,9 +45,5 @@ ignore:
   # Test files
   - "**/*_test.go"
   
-  # Dependencies
-  - "**/vendor/**"
-  - "**/node_modules/**"
-  
   # Build artifacts
   - "**/*.sum"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 549a4b4f..8eb0a013 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,4 +1,4 @@
-# Contributing to Kdubbo
+# Contribution guidelines
 
 Dubbo Kubernetes is released under the non-restrictive Apache 2.0 license and 
follows a very standard GitHub development process, using GitHub tracker for 
issues and merging pull requests into master. Contributions of all forms to 
this repository are acceptable, as long as they follow the prescribed community 
guidelines enumerated below.
 
diff --git a/README.md b/README.md
index e741f6f2..de489cf8 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@
 
 [![Go 
Reference](https://pkg.go.dev/badge/github.com/apache/dubbo-kubernetes.svg)](https://pkg.go.dev/github.com/apache/dubbo-kubernetes)
 [![Go Report 
Card](https://goreportcard.com/badge/github.com/apache/dubbo-kubernetes)](https://goreportcard.com/report/github.com/apache/dubbo-kubernetes)
-[![Codecov](https://codecov.io/gh/apache/dubbo-kubernetes/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-kubernetes)
 
[![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](https://www.apache.org/licenses/LICENSE-2.0)
 
 Dubbo inherent mesh implemented for the underlying cluster management platform 
can directly receive policies from the control plane and obtain features such 
as load balancing, service discovery, and observability without requiring a 
sidecar proxy.
diff --git a/cni/main.go b/cni/main.go
index 09437269..1f23cee7 100644
--- a/cni/main.go
+++ b/cni/main.go
@@ -71,10 +71,9 @@ func main() {
        }
        if (env.Command == "ADD" || env.Command == "CHECK") && 
cni.EnvHasKubernetesPod(env) {
                provider, err := 
cni.NewKubernetesPodInfoProvider(conf.KubeConfigPath())
-               if err != nil {
-                       exitErr(err)
+               if err == nil {
+                       plugin.PodInfoProvider = provider
                }
-               plugin.PodInfoProvider = provider
        }
        out, err := plugin.Run(context.Background(), env, conf)
        if err != nil {
diff --git a/manifests/charts/dubbod/templates/cni-daemonset.yaml 
b/manifests/charts/dubbod/templates/cni-daemonset.yaml
index fd898616..93315724 100644
--- a/manifests/charts/dubbod/templates/cni-daemonset.yaml
+++ b/manifests/charts/dubbod/templates/cni-daemonset.yaml
@@ -57,8 +57,11 @@ spec:
       labels:
         app: dubbo-cni
         dubbo.apache.org/rev: default
+        proxyless.dubbo.apache.org/inject: "false"
     spec:
-      serviceAccountName: dubbod
+      serviceAccountName: dubbo-cni
+      hostNetwork: true
+      dnsPolicy: ClusterFirstWithHostNet
       tolerations:
         - operator: Exists
       containers:
diff --git a/manifests/charts/dubbod/templates/cni-rbac.yaml 
b/manifests/charts/dubbod/templates/cni-rbac.yaml
new file mode 100644
index 00000000..b1cec2bb
--- /dev/null
+++ b/manifests/charts/dubbod/templates/cni-rbac.yaml
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- $defaults := .Values._internal_default_values_not_set | default dict }}
+{{- $defaultGlobal := $defaults.global | default dict }}
+{{- $defaultProxyless := $defaultGlobal.proxyless | default dict }}
+{{- $defaultCNI := $defaultProxyless.cni | default dict }}
+{{- $global := .Values.global | default dict }}
+{{- $proxyless := $global.proxyless | default dict }}
+{{- $cni := $proxyless.cni | default dict }}
+{{- $enabled := false }}
+{{- if hasKey $defaultCNI "enabled" }}
+{{- $enabled = $defaultCNI.enabled }}
+{{- end }}
+{{- if hasKey $cni "enabled" }}
+{{- $enabled = $cni.enabled }}
+{{- end }}
+{{- if $enabled }}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: dubbo-cni
+  namespace: dubbo-system
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  name: dubbo-cni-clusterrole-dubbo-system
+rules:
+  - apiGroups: [""]
+    resources: ["pods"]
+    verbs: ["get"]
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  name: dubbo-cni-clusterrole-dubbo-system
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: dubbo-cni-clusterrole-dubbo-system
+subjects:
+  - kind: ServiceAccount
+    name: dubbo-cni
+    namespace: dubbo-system
+{{- end }}
diff --git a/pkg/cni/plugin.go b/pkg/cni/plugin.go
index 99818923..f193695a 100644
--- a/pkg/cni/plugin.go
+++ b/pkg/cni/plugin.go
@@ -71,13 +71,17 @@ func (p Plugin) addOrCheck(ctx context.Context, env Env, 
conf NetConf) ([]byte,
                return out, nil
        }
        if p.PodInfoProvider == nil {
-               return nil, fmt.Errorf("pod info provider is required")
+               return out, nil
        }
        pod, err := p.PodInfoProvider.PodInfo(ctx, ref)
        if err != nil {
-               return nil, err
+               if ctxErr := ctx.Err(); ctxErr != nil {
+                       return nil, ctxErr
+               }
+               // Ownership is not proven until the managed label is read.
+               return out, nil
        }
-       if pod.Labels[conf.ManagedLabel] != conf.ManagedLabelValue {
+       if !isManagedPod(conf, pod) {
                return out, nil
        }
        podIP := firstPodIP(conf, pod)
@@ -122,6 +126,13 @@ func (p Plugin) del(ctx context.Context, env Env) error {
        return p.StateStore.Delete(env.ContainerID)
 }
 
+func isManagedPod(conf NetConf, pod PodInfo) bool {
+       if conf.ManagedLabel == "" {
+               return false
+       }
+       return pod.Labels[conf.ManagedLabel] == conf.ManagedLabelValue
+}
+
 func firstPodIP(conf NetConf, pod PodInfo) string {
        if ips := PodIPsFromPrevResult(conf.PrevResult); len(ips) > 0 {
                return ips[0]
diff --git a/pkg/cni/plugin_test.go b/pkg/cni/plugin_test.go
index 91904a33..9f733100 100644
--- a/pkg/cni/plugin_test.go
+++ b/pkg/cni/plugin_test.go
@@ -18,6 +18,7 @@ package cni
 import (
        "context"
        "encoding/json"
+       "errors"
        "testing"
 
        "github.com/apache/dubbo-kubernetes/pkg/kube/inject"
@@ -79,6 +80,54 @@ func TestPluginAddSkipsUnmanagedPod(t *testing.T) {
        }
 }
 
+func TestPluginAddSkipsWhenPodInfoIsUnavailable(t *testing.T) {
+       conf := testConf(t)
+       rules := &fakeRuleManager{}
+       plugin := Plugin{
+               PodInfoProvider: fakePodInfoProvider{err: errors.New("get pod 
app/nginx: Unauthorized")},
+               RuleManager:     rules,
+               StateStore:      NewFileStateStore(t.TempDir()),
+       }
+
+       out, err := plugin.Run(context.Background(), Env{
+               Command:     "ADD",
+               ContainerID: "container-a",
+               Args:        "K8S_POD_NAMESPACE=app;K8S_POD_NAME=nginx",
+       }, conf)
+       if err != nil {
+               t.Fatalf("Run(ADD) failed: %v", err)
+       }
+       if len(out) == 0 {
+               t.Fatal("Run(ADD) returned empty result")
+       }
+       if len(rules.added) != 0 {
+               t.Fatalf("added rules = %v, want none", rules.added)
+       }
+       if _, err := plugin.StateStore.Read("container-a"); !IsNotFound(err) {
+               t.Fatalf("state read err = %v, want not found", err)
+       }
+}
+
+func TestPluginAddSkipsWithoutPodInfoProvider(t *testing.T) {
+       conf := testConf(t)
+       rules := &fakeRuleManager{}
+       plugin := Plugin{
+               RuleManager: rules,
+               StateStore:  NewFileStateStore(t.TempDir()),
+       }
+
+       if _, err := plugin.Run(context.Background(), Env{
+               Command:     "ADD",
+               ContainerID: "container-a",
+               Args:        "K8S_POD_NAMESPACE=app;K8S_POD_NAME=nginx",
+       }, conf); err != nil {
+               t.Fatalf("Run(ADD) failed: %v", err)
+       }
+       if len(rules.added) != 0 {
+               t.Fatalf("added rules = %v, want none", rules.added)
+       }
+}
+
 func TestPluginDeleteCleansStoredRules(t *testing.T) {
        store := NewFileStateStore(t.TempDir())
        if err := store.Write(PodState{ContainerID: "container-a", Namespace: 
"app", Name: "nginx", IP: "10.244.0.12"}); err != nil {
diff --git a/tools/grpc-inbound/sample/grpc-bootstrap.json 
b/tools/grpc-inbound/sample/grpc-bootstrap.json
index fbad2cca..7c2c2e63 100644
--- a/tools/grpc-inbound/sample/grpc-bootstrap.json
+++ b/tools/grpc-inbound/sample/grpc-bootstrap.json
@@ -19,9 +19,9 @@
     "default": {
       "plugin_name": "file_watcher",
       "config": {
-        "certificate_file": 
"tools/virtualfacility/grpc-inbound/sample/cert-chain.pem",
-        "private_key_file": 
"tools/virtualfacility/grpc-inbound/sample/key.pem",
-        "ca_certificate_file": 
"tools/virtualfacility/grpc-inbound/sample/root-cert.pem"
+        "certificate_file": "tools/grpc-inbound/sample/cert-chain.pem",
+        "private_key_file": "tools/grpc-inbound/sample/key.pem",
+        "ca_certificate_file": "tools/grpc-inbound/sample/root-cert.pem"
       }
     }
   }

Reply via email to