Skip to content

Conversation

@eguzki
Copy link
Member

@eguzki eguzki commented May 4, 2022

what

Fixes Jira issue: https://issues.redhat.com/browse/THREESCALE-8401

verification steps

Create 2 backends CR

k apply -f - <<EOF
---
apiVersion: capabilities.3scale.net/v1beta1
kind: Backend
metadata:
  name: backend-a
spec:
  name: "Operated Backend A"
  systemName: "backenda"
  privateBaseURL: "http://httpbin.org"
---
apiVersion: capabilities.3scale.net/v1beta1
kind: Backend
metadata:
  name: backend-b
spec:
  name: "Operated Backend B"
  systemName: "backendb"
  privateBaseURL: "http://httpbin.org"
EOF

Create product linking to the previous backend usages

k apply -f - <<EOF
---
apiVersion: capabilities.3scale.net/v1beta1
kind: Product
metadata:
  name: product1
spec:
  name: "OperatedProduct 1"
  backendUsages:
    backenda:
      path: /A
    backendb:
      path: /B
EOF

Delete Backend B from product's backend usage list and also delete the backend B from the backend list via UI

Add an annotation to the product to force reconciliation loop.

k annotate product product1 hello=1

Check the operator does not crash. Check the Product CR gets into a sync: false state:

k get product product1 -o jsonpath='{.status}' | yq e -P 
conditions:
  - lastTransitionTime: "2022-05-04T13:51:13Z"
    message: 'Task failed SyncBackendUsage: Backend SystemName backendb not found in 3scale backend index'
    status: "True"
    type: Failed
  - lastTransitionTime: "2022-05-04T13:48:38Z"
    status: "False"
    type: Invalid
  - lastTransitionTime: "2022-05-04T13:48:38Z"
    status: "False"
    type: Orphan
  - lastTransitionTime: "2022-05-04T13:51:13Z"
    status: "False"
    type: Synced
observedGeneration: 2
providerAccountHost: https://3scale-supertest-admin.3scale.net

One of the condition messages gives the clue: Task failed SyncBackendUsage: Backend SystemName backendb not found in 3scale backend index

eguzki added 2 commits May 4, 2022 15:38
//go:build is the new conditional compilation directive used to specify build constraints.
It was introduced in Go 1.17.

Currently 3scale operator is being compiled with go1.13
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 69e9b1a and detected 0 issues on this pull request.

View more on Code Climate.

@Patryk-Stefanski
Copy link
Contributor

Code change looks good. Condition type failed shows the error after removing backend usage in product and backends list through UI. The operator continues to run.
/lgtm

@eguzki eguzki merged commit 5e0d190 into master May 4, 2022
@eguzki eguzki deleted the fix-product-backend-usages-controller branch May 4, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants