jianghushinian commented on issue #2153:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/2153#issuecomment-1920369570

   if wrote:
   ```go
   func buildK8sApisixRoute(name, namespace string, port int32) 
*apisixv2.ApisixRoute {
        return &apisixv2.ApisixRoute{
                TypeMeta: metav1.TypeMeta{
                        APIVersion: "apisix.apache.org/v2",
                        Kind:       "ApisixRoute",
                },
                ObjectMeta: metav1.ObjectMeta{
                        Name:      name,
                        Namespace: namespace,
                },
                Spec: apisixv2.ApisixRouteSpec{
                        HTTP: []apisixv2.ApisixRouteHTTP{
                                {
                                        Name: name,
                                        Match: apisixv2.ApisixRouteHTTPMatch{
                                                Hosts: 
[]string{fmt.Sprintf("%s.%s", name, config.GlobalConfig.Apisix.Endpoint)},
                                                Paths: []string{"/*"},
                                        },
                                        Backends: 
[]apisixv2.ApisixRouteHTTPBackend{
                                                {
                                                        ServiceName: name,
                                                        ServicePort: 
intstr.IntOrString{
                                                                Type:   
intstr.Int,
                                                                IntVal: port,
                                                        },
                                                },
                                        },
                                        Authentication: 
apisixv2.ApisixRouteAuthentication{
                                                Enable: false,
                                                Type:   "basicAuth",
                                        },
                                },
                        },
                },
        }
   }
   ```
   will success.
   
   the following code is necessary, but useless, if we should use pointers to 
avoid mandatory parameters?
   
   ```go
   Authentication: apisixv2.ApisixRouteAuthentication{
                Enable: false,
                Type:   "basicAuth",
        }
   ```


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