This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 1466e892 feat: use HOSTNAME as controller name and add default value. 
(#1946)
1466e892 is described below

commit 1466e892e58af42ddfbb35ee2ab42e5570444dca
Author: Jintao Zhang <[email protected]>
AuthorDate: Thu Aug 31 15:52:41 2023 +0800

    feat: use HOSTNAME as controller name and add default value. (#1946)
    
    Signed-off-by: Jintao Zhang <[email protected]>
---
 pkg/providers/controller.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkg/providers/controller.go b/pkg/providers/controller.go
index aafca469..e753c01c 100644
--- a/pkg/providers/controller.go
+++ b/pkg/providers/controller.go
@@ -93,6 +93,12 @@ type Controller struct {
 // NewController creates an ingress apisix controller object.
 func NewController(cfg *config.Config) (*Controller, error) {
        podName := os.Getenv("POD_NAME")
+       if podName == "" {
+               podName = os.Getenv("HOSTNAME")
+       }
+       if podName == "" {
+               podName = "apisix-ingress-controller"
+       }
        podNamespace := os.Getenv("POD_NAMESPACE")
        if podNamespace == "" {
                podNamespace = "default"

Reply via email to