// process will read a single work item off the work queue and attempt to process it
process will read a single work item off the work queue and attempt to process it
// process will read a single work item off the work queue and attempt to process it
func (c *Controller) process(item interface{}) {
	defer c.queue.Done(item)
	key, ok := item.(string)
	if !ok {
		klog.Errorf("unexpected item in queue: %v", item)
		c.queue.Forget(item)
		return
	}
	tenant, name, err := parseKey(key)
	if err != nil {
		klog.Errorf("unexpected string in queue; discarding: %s", key)
		c.queue.Forget(item)
		return
	}
	net, err := c.store.NetworksWithMultiTenancy(tenant).Get(name)
	if err != nil {
		klog.Warningf("failed to retrieve network in local cache by tenant %s, name %s: %v", tenant, name, err)
		c.queue.Forget(item)
		return
	}
	klog.V(5).Infof("processing network %s/%s", net.Tenant, net.Name)
	if net.Spec.Type == flatNetworkType {
		err = manageFlatNetwork(net, c.netClientset, c.svcClientset, true, c.domainName, c.kubeAPIServerIP, c.kubeAPIServerPort, c.saltSuffix)
	} else {
		err = manageNonFlatNetwork(net, c.netClientset, c.svcClientset, true, c.domainName, c.kubeAPIServerIP, c.kubeAPIServerPort, c.saltSuffix)
	}
	if err != nil {
		c.queue.AddRateLimited(key)
		c.recorder.Eventf(net, corev1.EventTypeWarning, "FailedProvision", "failed to provision network %s/%s: %v", net.Tenant, net.Name, err)
		return
	}
	c.recorder.Eventf(net, corev1.EventTypeNormal, "SuccessfulProvision", "successfully provision network %s/%s", net.Tenant, net.Name)
	c.queue.Forget(item)
}
func ( c * Controller ) process ( item interface { } ) { defer c . queue . Done ( item ) key , ok := item . ( string ) if ! ok { klog . Errorf ( " " , item ) c . queue . Forget ( item ) return } tenant , name , err := parseKey ( key ) if err != nil { klog . Errorf ( " " , key ) c . queue . Forget ( item ) return } net , err := c . store . NetworksWithMultiTenancy ( tenant ) . Get ( name ) if err != nil { klog . Warningf ( " " , tenant , name , err ) c . queue . Forget ( item ) return } klog . V ( 5 ) . Infof ( " " , net . Tenant , net . Name ) if net . Spec . Type == flatNetworkType { err = manageFlatNetwork ( net , c . netClientset , c . svcClientset , true , c . domainName , c . kubeAPIServerIP , c . kubeAPIServerPort , c . saltSuffix ) } else { err = manageNonFlatNetwork ( net , c . netClientset , c . svcClientset , true , c . domainName , c . kubeAPIServerIP , c . kubeAPIServerPort , c . saltSuffix ) } if err != nil { c . queue . AddRateLimited ( key ) c . recorder . Eventf ( net , corev1 . EventTypeWarning , " " , " " , net . Tenant , net . Name , err ) return } c . recorder . Eventf ( net , corev1 . EventTypeNormal , " " , " " , net . Tenant , net . Name ) c . queue . Forget ( item ) }
process will read a single work item off the work queue and attempt to process it
process will read a single work item off the work queue and attempt to process it