You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2022/12/26 09:23:37 UTC

[apisix-ingress-controller] branch master updated: fix: bad configuration item: apisix-admin-api-version (#1551)

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 1c429936 fix: bad configuration item: apisix-admin-api-version (#1551)
1c429936 is described below

commit 1c429936f5d6c1851c34b7bffdeaa38c6f4bc834
Author: Xin Rong <al...@gmail.com>
AuthorDate: Mon Dec 26 17:23:31 2022 +0800

    fix: bad configuration item: apisix-admin-api-version (#1551)
    
    
    Co-authored-by: Jintao Zhang <zh...@apache.org>
---
 conf/config-default.yaml  | 3 ++-
 pkg/config/config.go      | 4 ++++
 pkg/config/config_test.go | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 8cad9f25..7610ded4 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -49,7 +49,6 @@ ingress_status_address: []   # when there is no available information on the Ser
                              # For example, no available LB exists in the bare metal environment.
 enable_profiling: true # enable profiling via web interfaces
                        # host:port/debug/pprof, default is true.
-apisix-admin-api-version: "v2" # the APISIX admin API version. can be "v2" or "v3"
 apisix-resource-sync-interval: "300s" # Default interval for synchronizing Kubernetes resources to APISIX
 # Kubernetes related configurations.
 kubernetes:
@@ -85,6 +84,8 @@ kubernetes:
   plugin_metadata_cm: plugin-metadata-config-map
 # APISIX related configurations.
 apisix:
+  admin_api_version: v3  # the APISIX admin API version. can be "v2" or "v3"
+
   default_cluster_base_url: "http://127.0.0.1:9080/apisix/admin" # The base url of admin api / manager api
                                                                  # of the default APISIX cluster
 
diff --git a/pkg/config/config.go b/pkg/config/config.go
index fd255c79..c5718e49 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -142,6 +142,10 @@ func NewDefaultConfig() *Config {
 			WatchEndpointSlices: false,
 			EnableGatewayAPI:    false,
 		},
+		APISIX: APISIXConfig{
+			AdminAPIVersion:    "v3",
+			DefaultClusterName: "default",
+		},
 	}
 }
 
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index b26c3575..dfb7dc10 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -50,6 +50,7 @@ func TestNewConfigFromFile(t *testing.T) {
 			APIVersion:     DefaultAPIVersion,
 		},
 		APISIX: APISIXConfig{
+			AdminAPIVersion:        "v2",
 			DefaultClusterName:     "apisix",
 			DefaultClusterBaseURL:  "http://127.0.0.1:8080/apisix",
 			DefaultClusterAdminKey: "123456",
@@ -94,6 +95,7 @@ kubernetes:
   ingress_version: networking/v1
   api_version: apisix.apache.org/v2
 apisix:
+  admin_api_version: v2
   default_cluster_base_url: http://127.0.0.1:8080/apisix
   default_cluster_admin_key: "123456"
   default_cluster_name: "apisix"
@@ -138,6 +140,7 @@ func TestConfigWithEnvVar(t *testing.T) {
 			APIVersion:     DefaultAPIVersion,
 		},
 		APISIX: APISIXConfig{
+			AdminAPIVersion:        "v2",
 			DefaultClusterName:     "apisix",
 			DefaultClusterBaseURL:  "http://127.0.0.1:8080/apisix",
 			DefaultClusterAdminKey: "123456",
@@ -173,6 +176,7 @@ func TestConfigWithEnvVar(t *testing.T) {
         "ingress_version": "networking/v1"
     },
     "apisix": {
+        "admin_api_version": "v2",
         "default_cluster_base_url": "{{.DEFAULT_CLUSTER_BASE_URL}}",
         "default_cluster_admin_key": "{{.DEFAULT_CLUSTER_ADMIN_KEY}}",
         "default_cluster_name": "{{.DEFAULT_CLUSTER_NAME}}"
@@ -209,6 +213,7 @@ kubernetes:
   ingress_class: apisix
   ingress_version: networking/v1
 apisix:
+  admin_api_version: v2
   default_cluster_base_url: {{.DEFAULT_CLUSTER_BASE_URL}}
   default_cluster_admin_key: "{{.DEFAULT_CLUSTER_ADMIN_KEY}}"
   default_cluster_name: "{{.DEFAULT_CLUSTER_NAME}}"