Closed renatomattos2912 closed 1 year ago
@tao12345666333 Same here. Here's what I've configured.
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: openapi-alimi-route
namespace: ingress-apisix
spec:
http:
- name: rule-***
priority: 1
match:
hosts:
{{- include "openapi.hosts" . | indent 8 }}
paths:
- ***
upstreams:
- name: cv-upstream
plugin_config_name: openapi-plugin-config
apiVersion: apisix.apache.org/v2
kind: ApisixPluginConfig
metadata:
name: openapi-plugin-config
namespace: ingress-apisix
spec:
plugins:
- name: forward-auth
enable: true
config:
request_method: GET
uri: ***
request_headers: ***
upstream_headers: ***
- name: prometheus
enable: true
config:
disable: false
prefer_name: true
- name: http-logger
enable: true
config:
uri: ***
- name: proxy-rewrite
enable: true
config:
uri: ***
headers:
***
When I call check a route using ADMIN API neither plugin_config_name
nor plugin_config_id
appears.
curl 10.192.145.209:9180/apisix/admin/routes/31ceeb97 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' | jq
{
"value": {
"labels": {
"managed-by": "apisix-ingress-controller"
},
"hosts": [
***
],
"desc": "Created by apisix-ingress-controller, DO NOT modify it manually",
"id": "31ceeb97",
"update_time": 1679539025,
"status": 1,
"create_time": 1679536996,
"uris": [
***
],
"upstream_id": "281b5cf0",
"name": "ingress-apisix_openapi-alimi-route_rule-alimi",
"priority": 1
},
"modifiedIndex": 62324,
"key": "/apisix/routes/31ceeb97",
"createdIndex": 62188
}
However, when I describe ApisixRoute
using kubectl, plugin_config_name
appears.
k describe apisixroute openapi-alimi-route
Name: openapi-alimi-route
Namespace: ingress-apisix
Labels: argocd.argoproj.io/instance=dev-apisix
Annotations: <none>
API Version: apisix.apache.org/v2
Kind: ApisixRoute
Metadata:
Creation Timestamp: 2023-03-23T02:03:16Z
Generation: 3
Managed Fields:
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:status:
.:
f:conditions:
Manager: apisix-ingress-controller
Operation: Update
Time: 2023-03-23T02:03:16Z
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.:
f:kubectl.kubernetes.io/last-applied-configuration:
f:labels:
.:
f:argocd.argoproj.io/instance:
f:spec:
.:
f:http:
Manager: argocd-application-controller
Operation: Update
Time: 2023-03-23T02:03:16Z
Resource Version: 542685578
UID: 9be6e2bc-1b42-4942-91cd-fc5118743cfe
Spec:
Http:
Match:
Hosts:
***
Paths:
***
Name: ***
plugin_config_name: openapi-plugin-config
Priority: 1
Upstreams:
Name: cv-upstream
Status:
Conditions:
Message: Sync Successfully
Observed Generation: 3
Reason: ResourcesSynced
Status: True
Type: ResourcesAvailable
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ResourcesSynced 4m32s (x15 over 48m) ApisixIngress ApisixIngress synced successfully
Also, when I manually copied configuration in ApisixPluginConfig and pasted it in ApisixRoute, it works fine.
You need to create an ApisixPluginConfig before creating an ApisixRoute, otherwise this may be due to ApisixRoute not being able to find an ApisixPluginConfig, which may not work properly.
@AlinsRan
I've just tried like you suggested (Create ApisixPluginConfig first and then ApisixRoute) However, it isn't working. Here's what I've tried.
k describe apisixpluginconfig openapi-alimi-plugin-config
Name: openapi-alimi-plugin-config
Namespace: ingress-apisix
Labels: argocd.argoproj.io/instance=dev-apisix
Annotations: <none>
API Version: apisix.apache.org/v2
Kind: ApisixPluginConfig
Metadata:
Creation Timestamp: 2023-03-23T05:42:39Z # created first.
Generation: 1
Managed Fields:
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:status:
.:
f:conditions:
Manager: apisix-ingress-controller
Operation: Update
Time: 2023-03-23T05:42:39Z
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.:
f:kubectl.kubernetes.io/last-applied-configuration:
f:labels:
.:
f:argocd.argoproj.io/instance:
f:spec:
.:
f:plugins:
Manager: argocd-application-controller
Operation: Update
Time: 2023-03-23T05:42:39Z
Resource Version: 542795381
UID: 36adc3ef-1b45-456d-9d08-3d1ce4ba36a5
Spec:
Plugins:
Config:
request_headers:
***
request_method: GET
upstream_headers:
***
Uri: ***
Enable: true
Name: forward-auth
Config:
Disable: false
prefer_name: true
Enable: true
Name: prometheus
Config:
Uri: http://openapi-logging.openapi-logging.svc.cluster.local:8080/v1/logging
Enable: true
Name: http-logger
Config:
Headers:
***
Uri: ***
Enable: true
Name: proxy-rewrite
Status:
Conditions:
Message: Sync Successfully
Observed Generation: 1
Reason: ResourcesSynced
Status: True
Type: ResourcesAvailable
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ResourcesSynced 2m4s (x4 over 11m) ApisixIngress ApisixIngress synced successfully
k describe apisixroute openapi-alimi-route
Name: openapi-alimi-route
Namespace: ingress-apisix
Labels: argocd.argoproj.io/instance=dev-apisix
Annotations: <none>
API Version: apisix.apache.org/v2
Kind: ApisixRoute
Metadata:
Creation Timestamp: 2023-03-23T05:53:13Z
Generation: 1
Managed Fields:
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:status:
.:
f:conditions:
Manager: apisix-ingress-controller
Operation: Update
Time: 2023-03-23T05:53:13Z
API Version: apisix.apache.org/v2
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.:
f:kubectl.kubernetes.io/last-applied-configuration:
f:labels:
.:
f:argocd.argoproj.io/instance:
f:spec:
.:
f:http:
Manager: argocd-application-controller
Operation: Update
Time: 2023-03-23T05:53:13Z
Resource Version: 542802079
UID: b8e9a2e9-29d1-42c6-83c9-a866b52b010e
Spec:
Http:
Match:
Hosts:
***
Paths:
***
Name: rule-alimi
plugin_config_name: openapi-alimi-plugin-config
Priority: 1
Upstreams:
Name: cv-upstream
Status:
Conditions:
Message: Sync Successfully
Observed Generation: 1
Reason: ResourcesSynced
Status: True
Type: ResourcesAvailable
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ResourcesSynced 29s (x2 over 29s) ApisixIngress ApisixIngress synced successfully
Even though ApisixRoute created first, I think it should work normally after ApisixPluginConfig is created. Also, it would be good if i could know that kind of situation through events or at least logs. I can't find any logs related with that.
@yujinchoi-94 I saw that you referenced upstream in ApisixRoute, and I think it's related to this issue.
@renatomattos2912 I saw that you referenced upstream in ApisixRoute, and I think it's related to this issue.
Great, it is exactly that, but i think the fix was not released yet cause as we can see in ingress controller helm and in docker repo, it is still in version 1.6.0 that is the buggy version:
https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix-ingress-controller/values.yaml
https://hub.docker.com/r/apache/apisix-ingress-controller/tags
I hope it will be fixed in version 1.6.1 soon.
This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.
Current Behavior
When applying CRD for ApisixPluginConfig and ApisixRoute using plugin_config_name field to bound plugins to route, the bound is not being made after all, so each CRD is applied individually in kubernetes, no errors on that, but the plugin_config_name field is being ignored on route.
This problem is very similar to that one: https://github.com/apache/apisix-ingress-controller/issues/1003, but the solution pointed not worked for me.
Expected Behavior
I expect that ApisixRoute bound with ApisixPluginConfig works when plugin_config_name is correctly added to route.
Error Logs
No errors logs
Steps to Reproduce
Apply CRD to create ApisixPluginConfig
Apply CRD to create ApisixRoute bounded to ApisixPluginConfig
Check if plugins is applied or not.
Environment
apisix version
): 3.1.0uname -a
): Kubernetes 1.22 in AWS EKScurl http://127.0.0.1:9090/v1/server_info
): 3.5.0