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 2021/09/06 13:20:36 UTC

[GitHub] [apisix-ingress-controller] sober-wang opened a new pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

sober-wang opened a new pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [ x ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   - Related issues
   #73 
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   
   You can used the plugin quickly show the apisix routes and upstreams in a kubernetes cluster.


-- 
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] tokers commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703542230



##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       Why?




-- 
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] sober-wang closed pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang closed pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666


   


-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703134408



##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh

Review comment:
       oh, right. I add the execcutable permission.




-- 
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 a change in pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r756026218



##########
File path: docs/en/latest/concepts/annotations.md
##########
@@ -1,133 +0,0 @@
----

Review comment:
       Why do you want to delete these documents?




-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703252113



##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"

Review comment:
       beacuse the project not used sort the imports.




-- 
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] codecov-commenter commented on pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-965908860


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#666](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a7f938c) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/a01888bd195f59ae08a5e1399dd26f2ac438880a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a01888b) will **decrease** coverage by `0.01%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head a7f938c differs from pull request most recent head 7f7e5fd. Consider uploading reports for the commit 7f7e5fd to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #666      +/-   ##
   ==========================================
   - Coverage   32.36%   32.35%   -0.02%     
   ==========================================
     Files          65       64       -1     
     Lines        6488     6487       -1     
   ==========================================
   - Hits         2100     2099       -1     
     Misses       4137     4137              
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [test/e2e/e2e.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-dGVzdC9lMmUvZTJlLmdv) | | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a290f12...7f7e5fd](https://codecov.io/gh/apache/apisix-ingress-controller/pull/666?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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 a change in pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r774670163



##########
File path: docs/en/latest/concepts/annotations.md
##########
@@ -1,133 +0,0 @@
----

Review comment:
       @sober-wang If you need some help, please ping me.  I have too much news, easy to miss.




-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703134408



##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh

Review comment:
       oh, right. I add the execcutable permission.




-- 
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 pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-1000407013


   > I can't fix the conflicts. so I will close the PR next resubmit.
   
   Looking forward to your PR! Thanks!


-- 
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] tokers commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703541765



##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       It's not reasonable to specify the port, we cannot sure whether this port is already in use.




-- 
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] tokers commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703127659



##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh
+```
+
+```shell 
+# Show your routes in kubernetes.
+kubectl apisix-ingress-controller routes -n <APISIX_INGRESS_NS>

Review comment:
       IMHO `apisix-ingress-controller` is too long, maybe `ingress-apisix` is more concise.

##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+

Review comment:
       Add some comments for exportable functions.

##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh

Review comment:
       Why not assign the executable permission?

##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"

Review comment:
       Please sort the imports, we should put the 3rd parties in the middle, and put our own packages at the bottom.

##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       Cannot assume the APISIX address is just `127.0.0.1:9180`.

##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       Also, we have a full-featured APISIX Go SDK, we don't have to create another one here. See `pkg/apisix` for more details.




-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703132992



##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       no, I browse the `pkg/apisix` so the code can't resued. I can only rewrite.




-- 
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] sober-wang commented on pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-1000319956


   I can't fix the conflicts. so I will close the PR next resubmit.


-- 
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] sober-wang commented on a change in pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r773579807



##########
File path: docs/en/latest/concepts/annotations.md
##########
@@ -1,133 +0,0 @@
----

Review comment:
       > Can you resolve the conflicts? Thanks!
   
   Sorry, I'm afraid I don't know how to operate it. Can you help me? 




-- 
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 pull request #666: feat: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-965906280


   Can you resolve the conflicts? Thanks!


-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703133617



##########
File path: cmd/plugin/commands/routes/routes.go
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package routes
+
+import (
+	"strings"
+
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/common"
+	"github.com/apache/apisix-ingress-controller/cmd/plugin/kubectl"
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+	jsoniter "github.com/json-iterator/go"
+	"github.com/spf13/cobra"
+	"k8s.io/cli-runtime/pkg/genericclioptions"
+)
+
+func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
+	var routeId string
+	cmd := &cobra.Command{
+		Use:   "routes",
+		Short: "Show the apisix routes",
+		Run: func(cmd *cobra.Command, args []string) {
+			getRoutes(flags, routeId)
+			return
+		},
+	}
+	cmd.Flags().StringVar(&routeId, "route-id", "", "apisix route id")
+	return cmd
+}
+
+// getRoutes get apisix route informations.
+func getRoutes(flags *genericclioptions.ConfigFlags, routeId string) {
+	pconf := common.NewPluginConfig(flags)
+	log.Infof("namespaces: %v \n", pconf.NameSpace)
+	pconf.GetConfigMapsData()
+
+	svcName, _ := pconf.GetApisixSvcName()
+	pid := kubectl.OpenPortForward(pconf.Ctx, pconf.NameSpace, svcName)
+	header := []string{
+		"ID",
+		"Name",
+		"Host",
+		"URI",
+		"Status",
+		"UpstreamId",
+		"CreateTime",
+		"UpdateTime",
+	}
+
+	for {
+		if common.CheckPort() {
+			log.Info("the k8s port-forward is ready")
+			break
+		}
+		log.Error("the k8s port-forward is not ready")
+	}
+	var reqApisix common.RequestConf
+	reqApisix.AdminKey = pconf.Cfg.APISIX.AdminKey
+	reqApisix.URL = "http://127.0.0.1:9180/apisix/admin"

Review comment:
       Beacuse I used the kubernetes port-forward feature in the machine on which this command is run. So just visit the `127.0.0.1:9180`




-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703134221



##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh
+```
+
+```shell 
+# Show your routes in kubernetes.
+kubectl apisix-ingress-controller routes -n <APISIX_INGRESS_NS>

Review comment:
       no, I think our project is `apache/apisix-ingress-controller` , so I think used 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



[GitHub] [apisix-ingress-controller] tao12345666333 commented on pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-913744334


   Thanks! Good job!
   
   Can you please rebase your PR from master?


-- 
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] tokers commented on pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#issuecomment-914335393


   > beacuse . I used sh executable the install-plugin.sh file. so I don't need executable permission.
   
   I mean, add the shebang line, let users run the scripts like `./scripts.sh`. 


-- 
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] sober-wang commented on a change in pull request #666: Add the apisix-ingress-controller plugin for kubernetes.

Posted by GitBox <gi...@apache.org>.
sober-wang commented on a change in pull request #666:
URL: https://github.com/apache/apisix-ingress-controller/pull/666#discussion_r703251522



##########
File path: cmd/plugin/README.md
##########
@@ -0,0 +1,23 @@
+# apisix-ingress-controller plugin
+
+The apisix-ingress-controoler plugin can quikly show the apisix routes and upstreams in kubernetes cluster.
+
+# Quikly start 
+
+```shell
+git clone http://github.com/apache/apisix-ingress-controller 
+cd cmd/plugin
+sh install-plugin.sh

Review comment:
       beacuse . I used sh executable the install-plugin.sh file. so I don't need executable permission.




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