Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bad configuration item: apisix-admin-api-version #1551

Merged
merged 4 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conf/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func NewDefaultConfig() *Config {
WatchEndpointSlices: false,
EnableGatewayAPI: false,
},
APISIX: APISIXConfig{
AdminAPIVersion: "v3",
DefaultClusterName: "default",
},
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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}}"
Expand Down Expand Up @@ -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}}"
Expand Down