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

bug: Update ApisixRoute has dirty configuration #351

Closed
gxthrj opened this issue Apr 9, 2021 · 3 comments · Fixed by #353
Closed

bug: Update ApisixRoute has dirty configuration #351

gxthrj opened this issue Apr 9, 2021 · 3 comments · Fixed by #353
Assignees

Comments

@gxthrj
Copy link
Contributor

gxthrj commented Apr 9, 2021

Issue description

Apply ApisixRoute one by one cause dirty configuration
step 1:

apiVersion: apisix.apache.org/v2alpha1
kind: ApisixRoute
metadata:
  name: httpbin-route
  namespace: xxx
spec:
  http:
  - name: rule1
    match:
      hosts:
      - httpbin.com
      paths:
      - /ip
    backends:
    - serviceName: httpbin-service-e2e-test
      servicePort: 80
      weight: 50
    - serviceName: httpbin-service-e2e-test-v2
      servicePort: 80
      weight: 100

The route in APISIX like this:

{"action":"get","node":{"nodes":[{"modifiedIndex":144,"value":{"priority":0,"status":1,"plugins":{"traffic-split":{"rules":[{"weighted_upstreams":[{"weight":100,"upstream_id":"cd3dc953"},{"weight":50}],"match":[{"vars":[["server_port",">",0]]}]}]}},"id":"3fc92fca","create_time":1617946799,"update_time":1617946924,"name":"szydpoc_httpbin-route_rule1","hosts":["httpbin.com"],"uris":["\/ip"],"desc":"szydpoc_httpbin-route_rule1","upstream_id":"d678a7ac"},"createdIndex":142,"key":"\/apisix\/routes\/3fc92fca"}],"key":"\/apisix\/routes","dir":true},"count":"2"}

step 2:

kubectl apply -f - <<EOF
apiVersion: apisix.apache.org/v2alpha1
kind: ApisixRoute
metadata:
  name: httpbin-route
  namespace: xxx
spec:
  http:
  - name: rule1
    priority: 1
    match:
      hosts:
      - httpbin.com
      paths:
      - /ip
    backend:
      serviceName: httpbin-service-e2e-test
      servicePort: 80
  - name: rule2
    priority: 2
    match:
      hosts:
      - httpbin.com
      paths:
      - /ip
      exprs:
      - subject:
          scope: Cookie
          name: X-Foo
        op: Equal
        value: v2
    backend:
      serviceName: httpbin-service-e2e-test-v2
      servicePort: 80
EOF

The route in APISIX like this, the plugin traffic-split should be removed.

{"action":"get","node":{"nodes":[{"modifiedIndex":144,"value":{"priority":0,"status":1,"plugins":{"traffic-split":{"rules":[{"weighted_upstreams":[{"weight":100,"upstream_id":"cd3dc953"},{"weight":50}],"match":[{"vars":[["server_port",">",0]]}]}]}},"id":"3fc92fca","create_time":1617946799,"update_time":1617946924,"name":"xxx_httpbin-route_rule1","hosts":["httpbin.com"],"uris":["\/ip"],"desc":"xxx_httpbin-route_rule1","upstream_id":"d678a7ac"},"createdIndex":142,"key":"\/apisix\/routes\/3fc92fca"}],"key":"\/apisix\/routes","dir":true},"count":"2"}
@gxthrj gxthrj changed the title bug: bug: Update ApisixRoute has dirty configuration Apr 9, 2021
@tokers
Copy link
Contributor

tokers commented Apr 9, 2021

The route in step1 doesn't contain traffic-split?

@gxthrj
Copy link
Contributor Author

gxthrj commented Apr 9, 2021

The route in step1 doesn't contain traffic-split?

mistake, I will modify the spec of this issue.

@tokers
Copy link
Contributor

tokers commented Apr 9, 2021

This bug is due to we use PATCH when updating, we should use PUT instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants