apit opened a new issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852


   ### Issue description
   
   I must first declare that I'm very new to writing operators :-).
   
   I installed the latest apisix-ingress-controller (1.4) in my cluster. Beside 
for #851, all crds are looking fine: 
   
   ```sh
   > kubectl api-resources  --api-group=apisix.apache.org                       
                                                                                
                            (base) ⎈ (k3d-lab/kubebuilder)
   NAME                   SHORTNAMES   APIVERSION                  NAMESPACED   
KIND
   apisixclusterconfigs   acc          apisix.apache.org/v2beta3   false        
ApisixClusterConfig
   apisixconsumers        ac           apisix.apache.org/v2beta3   true         
ApisixConsumer
   apisixpluginconfigs    apc          apisix.apache.org/v2beta3   true         
ApisixPluginConfig
   apisixroutes           ar           apisix.apache.org/v2beta3   true         
ApisixRoute
   apisixtlses            atls         apisix.apache.org/v2beta3   true         
ApisixTls
   apisixupstreams        au           apisix.apache.org/v2beta3   true         
ApisixUpstream
   ```
   
   I then wrote a controller that in its reconciling method creates an 
ApisixRoute. 
   
   ```go
   import (
        apisixv2beta3 
"github.com/apache/apisix-ingress-controller/pkg/kube/apisix/apis/config/v2beta3"
          // ... others
   )
   
   // ..
   
   ingressRoute := &apisixv2beta3.ApisixRoute{
                TypeMeta: metav1.TypeMeta{APIVersion: 
corev1.SchemeGroupVersion.String(), Kind: "Ingress"},
                ObjectMeta: metav1.ObjectMeta{
                        Name:      dapp.Name,
                        Namespace: dapp.Namespace,
                        Labels:    map[string]string{"dapp": dapp.Name, 
"author": dapp.Labels["author"]},
                },
                Spec: apisixv2beta3.ApisixRouteSpec{
                        HTTP: []apisixv2beta3.ApisixRouteHTTP{
                                {
                                        Name: dapp.Name,
                                        Match: 
apisixv2beta3.ApisixRouteHTTPMatch{
                                                Hosts: []string{dapp.Name + 
".local"},
                                                Paths: []string{"/"},
                                        },
                                        Backends: 
[]apisixv2beta3.ApisixRouteHTTPBackend{
                                                {
                                                        ServiceName: dapp.Name,
                                                        ServicePort: 
intstr.FromInt(8080),
                                                },
                                        },
                                },
                        },
                },
        }
   
   ```
   the trouble is, 
   
   ```sh
   
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
        
/home/stupoh/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227
   1.643631557216485e+09        ERROR   controller.dapp Reconciler error        
{"reconciler group": "bidics.mydomain", "reconciler kind": "Dapp", "name": 
"my-shiny-app", "namespace": "kubebuilder", 
   "error": "no kind is registered for the type v2beta3.ApisixRoute in scheme 
\"pkg/runtime/scheme.go:100\""}
   
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
        
/home/stupoh/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266
   ```
   
   so, `no kind is registered for the type v2beta3.ApisixRoute`. My 
understanding is that `kubectl api-resources` output can be read as there is 
indeed a v2beta3.ApisixRoute registered.
   
   What did I miss? TIA  
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long): 1.4
   - your Kubernetes cluster version (output of kubectl version): v1.21.7+k3s1
   


-- 
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