tiancheng92 commented on issue #2648:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/2648#issuecomment-3539950035

   @bzp2010 
   
   I want to subscribe to changes in the Apisix component using the traditional 
Kubernetes client-go Informer approach, and hopefully be able to add, delete, 
and modify Apisix resources using `clientSet`. In version 1.x.x, I could 
achieve this using the following code, but I'm stuck in version 2.0.0.
   
   ```golang
   // if I want to delete ApisixPluginConfigs
   err := 
k8sclient.GetClient().ApiSixClient.ApisixV2().ApisixPluginConfigs(namespace).Delete(context.Background(),
 name, metav1.DeleteOptions{})
   ```
   
   ```golang
   // if I want to subscribe ApisixPluginConfigs changes
   func (is *apisixPluginConfigInformer) Informer(factory 
apisixinformers.SharedInformerFactory) 
(apisixinformersconfigv2.ApisixPluginConfigInformer, error) {
        informer := factory.Apisix().V2().ApisixPluginConfigs()
        _, err := 
informer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
                AddFunc:    is.add,
                UpdateFunc: is.update,
                DeleteFunc: is.delete,
        })
        if err != nil {
                return nil, errors.WithStack(err)
        }
        return informer, nil
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to