Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 70 for defer (0.19 sec)

  1. cni/pkg/nodeagent/pod_cache.go

    func (p *podNetnsCache) Get(uid string) Netns {
    	// lock current snapshot pod map
    	p.mu.RLock()
    	defer p.mu.RUnlock()
    	if info, f := p.currentPodCache[uid]; f {
    		return info.Netns
    	}
    	return nil
    }
    
    // make sure uid is in the cache, even if we don't have a netns
    func (p *podNetnsCache) Ensure(uid string) {
    	p.mu.Lock()
    	defer p.mu.Unlock()
    	if _, ok := p.currentPodCache[uid]; !ok {
    		p.currentPodCache[uid] = WorkloadInfo{}
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 4.5K bytes
    - Viewed (0)
  2. cni/pkg/nodeagent/netns_linux.go

    		threadNS, err := netns.GetCurrentNS()
    		if err != nil {
    			return fmt.Errorf("failed to open current netns: %v", err)
    		}
    		defer threadNS.Close()
    
    		// switch to target namespace
    		if err = NetnsSet(fdable); err != nil {
    			return err
    		}
    		defer func() {
    			err := threadNS.Set() // switch back
    			if err == nil {
    				// Unlock the current thread only when we successfully switched back
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Wed Jan 31 10:05:36 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  3. cni/pkg/nodeagent/ztunnelserver_test.go

    func TestZtunnelSendsPodSnapshot(t *testing.T) {
    	ztunnelKeepAliveCheckInterval = time.Second / 10
    	mt := monitortest.New(t)
    	setupLogging()
    	ctx, cancel := context.WithCancel(context.Background())
    	defer cancel()
    
    	fixture := connect(ctx)
    	ztunClient := fixture.ztunClient
    	uid := fixture.uid
    
    	m, fds := readRequest(t, ztunClient)
    	// we got am essage from ztun, so it should have observed us being connected
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 8.6K bytes
    - Viewed (0)
  4. cni/pkg/nodeagent/server_test.go

    	if f.testWG != nil {
    		defer f.testWG.Done()
    	}
    	args := f.Called(ctx, pod, podIPs, netNs)
    	return args.Error(0)
    }
    
    func (f *fakeServer) RemovePodFromMesh(ctx context.Context, pod *corev1.Pod) error {
    	if f.testWG != nil {
    		defer f.testWG.Done()
    	}
    	args := f.Called(ctx, pod)
    	return args.Error(0)
    }
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  5. istioctl/pkg/admin/istiodconfig.go

    	}
    	req, err := http.NewRequest(http.MethodPut, c.baseURL.String()+"/"+scope.Name, &jsonScopeInfo)
    	if err != nil {
    		return err
    	}
    	defer req.Body.Close()
    
    	resp, err := c.httpClient.Do(req)
    	if err != nil {
    		return err
    	}
    	defer resp.Body.Close()
    
    	if resp.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("cannot update resource %s, got status %s", scope.Name, resp.Status)
    	}
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Sat Apr 13 05:23:38 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  6. cni/pkg/plugin/sidecar_iptables_linux.go

    	}
    
    	netNs, err := getNs(netns)
    	if err != nil {
    		err = fmt.Errorf("failed to open netns %q: %s", netns, err)
    		return err
    	}
    	defer netNs.Close()
    
    	return netNs.Do(func(_ ns.NetNS) error {
    		log.Infof("============= Start iptables configuration for %v =============", podName)
    		defer log.Infof("============= End iptables configuration for %v =============", podName)
    		return cmd.ProgramIptables(cfg)
    	})
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Thu Apr 18 17:36:41 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  7. cni/pkg/nodeagent/net_test.go

    		},
    		Spec: corev1.PodSpec{
    			Containers: containers,
    		},
    		Status: podStatus,
    	}
    }
    
    func TestServerAddPod(t *testing.T) {
    	ctx, cancel := context.WithCancel(context.Background())
    	defer cancel()
    	setupLogging()
    	fixture := getTestFixure(ctx)
    	netServer := fixture.netServer
    	ztunnelServer := fixture.ztunnelServer
    	podMeta := metav1.ObjectMeta{
    		Name:      "foo",
    		Namespace: "bar",
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Tue Apr 30 22:24:38 GMT 2024
    - 16.4K bytes
    - Viewed (0)
  8. cni/pkg/nodeagent/informers_test.go

    	"istio.io/istio/pkg/test/util/assert"
    )
    
    func TestExistingPodAddedWhenNsLabeled(t *testing.T) {
    	setupLogging()
    	NodeName = "testnode"
    	ctx, cancel := context.WithCancel(context.Background())
    	defer cancel()
    
    	pod := &corev1.Pod{
    		ObjectMeta: metav1.ObjectMeta{
    			Name:      "test",
    			Namespace: "test",
    		},
    		Spec: corev1.PodSpec{
    			NodeName: NodeName,
    		},
    		Status: corev1.PodStatus{
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Thu Feb 08 01:03:24 GMT 2024
    - 15.8K bytes
    - Viewed (0)
  9. cni/pkg/pluginlistener/listener_test.go

    )
    
    func TestCNIListener(t *testing.T) {
    	f := filepath.Join(t.TempDir(), "test")
    	l, err := NewListener(f)
    	if err != nil {
    		t.Fatalf("unexpected error %v", err)
    	}
    	defer l.Close()
    	conn, err := connect(f)
    	if err != nil {
    		t.Fatalf("failed to connect %v", err)
    	}
    	conn.Close()
    }
    
    func connect(socket string) (*grpc.ClientConn, error) {
    	var opts []grpc.DialOption
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Thu Feb 08 21:58:32 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  10. cni/pkg/nodeagent/ztunnelserver.go

    }
    
    func (c *connMgr) addConn(conn *ZtunnelConnection) {
    	log.Debug("ztunnel connected")
    	c.mu.Lock()
    	defer c.mu.Unlock()
    	c.connectionSet[conn] = struct{}{}
    	c.latestConn = conn
    	ztunnelConnected.RecordInt(int64(len(c.connectionSet)))
    }
    
    func (c *connMgr) LatestConn() *ZtunnelConnection {
    	c.mu.Lock()
    	defer c.mu.Unlock()
    	return c.latestConn
    }
    
    func (c *connMgr) deleteConn(conn *ZtunnelConnection) {
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 12.4K bytes
    - Viewed (0)
Back to top