lgy1027 commented on issue #646:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/646#issuecomment-904289813


   > > > @lgy1027 Please use the latest version of ingress-controller,now it is 
1.2.0
   > > 
   > > 
   > > 现在不报错了,直接build1.2镜像,但是我在使用client创建router时还是报错
   > > ```
   > > ApisixRoute.apisix.apache.org "httpbin-route" is invalid: [<nil>: 
Invalid value: "": "spec.http" must validate one and only one schema (oneOf). 
Found 2 valid alternatives, spec.http.authentication.type: Unsupported value: 
"": supported values: "basicAuth", "keyAuth", spec.http.backend.serviceName: 
Invalid value: "": spec.http.backend.serviceName in body shouldbe at least 1 
chars long, spec.http.backend.servicePort: Invalid value: 0: 
spec.http.backend.servicePort in body should be greater than or equal to 1, 
spec.http.backend.weight: Invalid value: "null": spec.http.backend.weight in 
body mustbe of type integer: "null"]
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > 代码如下:
   > > ```
   > > import 
"github.com/apache/apisix-ingress-controller/pkg/kube/apisix/client/clientset/versioned"
   > > 
   > > client,err = versioned.NewForConfig(config)
   > > 
   > > func BuildRoute()  {
   > >  w := int(100)
   > >  v2b := &v2beta1.ApisixRoute{
   > >          TypeMeta: metav1.TypeMeta{
   > >                  Kind:"ApisixRoute",
   > >                  APIVersion:"apisix.apache.org/v2beta1",
   > >          },
   > >          ObjectMeta:metav1.ObjectMeta{
   > >                  Name: "httpbin-route",
   > >                  Namespace: "lgy",
   > >          },
   > >          Spec: v2beta1.ApisixRouteSpec{
   > >                  HTTP:[]v2beta1.ApisixRouteHTTP{
   > >                          v2beta1.ApisixRouteHTTP{
   > >                                  Name: "httpbin",
   > >                                  Match: v2beta1.ApisixRouteHTTPMatch{
   > >                                          Hosts: 
[]string{"local.httpbin.org"},
   > >                                          Paths: []string{"/*"},
   > >                                  },
   > >                                  Backends: 
[]v2alpha1.ApisixRouteHTTPBackend{
   > >                                          v2alpha1.ApisixRouteHTTPBackend{
   > >                                                  ServiceName: "httpbin",
   > >                                                  ServicePort: 
intstr.IntOrString{
   > >                                                          Type: 
intstr.Int,
   > >                                                          IntVal: 80,
   > >                                                  },
   > >                                                  Weight:&w,
   > >                                          },
   > >                                  },
   > >                          },
   > >                  },
   > >          },
   > > 
   > >  }
   > >  _, err := 
client.ApisixV2beta1().ApisixRoutes("lgy").Create(context.Background(),v2b,v1.CreateOptions{})
   > >  fmt.Println(err)
   > > }
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > apisix-ingress-controller引得依赖是1.2.0的版本
   > > ```
   > > require (
   > >  bou.ke/monkey v1.0.2
   > >  github.com/apache/apisix-ingress-controller v1.2.0
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > 使用kubectl apply -f yaml 没问题
   > 
   > If I am correct, I have said that the data structure defined for 
ApisixRoute is not suitable to create objects programmatically.
   > There are some details that need to be fixed.
   > 
   > Here you may marshal the `v2b` and compare it with the YAML configuration 
and see the differences.
   
   
我这边试了下,创建v2alpha1版本的没问题,v2beta1问题可能出在spec.ApisixRouteHTTP中Backend和Backends使用指针类型,另外有个问题请教下,grpc请求代理怎么调试,我现在有个svc起的grpc服务,然后创建了tls,upstream等,但是不知道怎么测试,我看官网有grpc案例,但是不太清楚


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