You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/31 12:52:11 UTC

[GitHub] [apisix-ingress-controller] apit opened a new issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

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/controller-runtime@v0.11.0/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/controller-runtime@v0.11.0/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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1026429022


   my installation from #851, using helm 0.9 on k3s  1.21


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1030852499


   i did. still "failed to create typed patch object: .spec.http[0].authentication.keyauth: field not declared in schema". wasnt it because of json tag of ApisixRouteAuthentication.KeyAuth?


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tao12345666333 commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1026423717


   What are your installation steps?


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit closed issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit closed issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852


   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1026416408


   If my Reconciler `Create()`-d the resource using
   
   ```go
   Authentication: apisixv2beta3.ApisixRouteAuthentication{
       Enable: true,
       Type:   "keyAuth",
       KeyAuth: apisixv2beta3.ApisixRouteAuthenticationKeyAuth{
           Header: "XX",
       },
   },
   ```
   the resulting `k describe ar my-shiny-app` said:
   
   ```yaml
   Http:
       Authentication:
         Enable:  true
         Type:    keyAuth
   ```
   
   Note missing `AuthKey` field there. Though with the equivalen cli,  `kubectl appy -f my-shiny-app-route.yaml`, 
   ```yaml
   # my-shiny-app-route.yaml
       authentication:
         type: keyAuth
         enable: true
         keyAuth: 
           header: "XX"
   ```
   
   will result in 
   
   ```yaml
   Http:
       Authentication:
         Enable:  true
         Key Auth:
           Header:  XX
         Type:      keyAuth
   ```
   
   Another one is Reconciler `Patch()` will failed on *default* `Authentication` value with message `failed to create typed patch object: .spec.http[0].authentication.keyauth: field not declared in schema"`. The same error if i changed `my-shiny-app-route.yaml` key of `keyAuth` to `keyauth`. So, why `Create()` succeed because it ignore `Authentication` field?
   
   
   
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tao12345666333 commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1030840844


   @apit Did you try this way https://github.com/apache/apisix-ingress-controller/issues/851#issuecomment-1026306420


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1025990359


   i missed adding it to scheme :speak_no_evil:
   
   ```go
   // main.go
   func init() {
     apisixv2beta3.AddToScheme(scheme)
   }
   ```
   
   Updated controller that works:
   
   ```go
   ingressRoute := &apisixv2beta3.ApisixRoute{
     TypeMeta: metav1.TypeMeta{APIVersion: apisixv2beta3.SchemeGroupVersion.String(), Kind: "ApisixRoute"},
     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{"/"},
           },
           Authentication: apisixv2beta3.ApisixRouteAuthentication{
             Enable: false,
             Type: "keyAuth",
             KeyAuth: apisixv2beta3.ApisixRouteAuthenticationKeyAuth{
               Header: "",
             },
           },
           Backends: []apisixv2beta3.ApisixRouteHTTPBackend{
             {
               ServiceName: dapp.Name,
               ServicePort: intstr.FromInt(8080),
             },
           },
         },
       },
     },
   }
   ```
   Though `Authentication` is mandatory even when the spec isn't marked so. 
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] apit edited a comment on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
apit edited a comment on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1026416408


   If my Reconciler `Create()`-d the resource using
   
   ```go
   Authentication: apisixv2beta3.ApisixRouteAuthentication{
       Enable: true,
       Type:   "keyAuth",
       KeyAuth: apisixv2beta3.ApisixRouteAuthenticationKeyAuth{
           Header: "XX",
       },
   },
   ```
   the resulting `k describe ar my-shiny-app` said:
   
   ```yaml
   Http:
       Authentication:
         Enable:  true
         Type:    keyAuth
   ```
   
   Note missing `AuthKey` field there. Though with the equivalen cli,  `kubectl appy -f my-shiny-app-route.yaml`, 
   ```yaml
   # my-shiny-app-route.yaml
       authentication:
         type: keyAuth
         enable: true
         keyAuth: 
           header: "XX"
   ```
   
   will result in 
   
   ```yaml
   Http:
       Authentication:
         Enable:  true
         Key Auth:
           Header:  XX
         Type:      keyAuth
   ```
   
   Another one is Reconciler `Patch()` will failed on *default* `Authentication` value with message `failed to create typed patch object: .spec.http[0].authentication.keyauth: field not declared in schema"`. The same error if i changed `my-shiny-app-route.yaml` key of `keyAuth` to `keyauth`. So, `Create()` succeed because it ignore `Authentication` field?
   
   
   
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tao12345666333 commented on issue #852: request help: on crd controller: error no kind is registered for the type v2beta3.ApisixRoute in scheme

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on issue #852:
URL: https://github.com/apache/apisix-ingress-controller/issues/852#issuecomment-1041157268


   Thanks for report. Let me check it.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org