Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-10875

Fix DeveloperAccount backup and restore

XMLWordPrintable

    • RHOAM Sprint 66, RHOAM Sprint 67, RHOAM Sprint 68, RHOAM Sprint 69

      WHAT
      While testing the backup and restore functionality of the 3scale capabilities it was discovered that the DeveloperAccount CR implementation needs to be hardened.

      Currently if you attempt to backup and restore a DeveloperAccount CR using the steps below you will get the following error:

      error calling 3scale system - reason: {"billing_address_address1":[],"billing_address_city":[],"billing_address_country":[],"billing_address_name":[],"email":["has already been taken"],"username":["has already been taken"],"users":["invalid"]} - code: 422
      

      HOW
      Steps to reproduce:
      1. Install 3scale
      2. Create the following DeveloperAccount CR (will also need to create a DeveloperUser CR and its Secret)

      ---
      apiVersion: capabilities.3scale.net/v1beta1
      kind: DeveloperAccount
      metadata:  
        name: developeraccount03
      spec:  
        orgName: Ecorp
      ---
      apiVersion: v1
      kind: Secret
      metadata:  
        name: developeruserpassword
      stringData:  
        password: developeruserpassword
      ---
      apiVersion: capabilities.3scale.net/v1beta1
      kind: DeveloperUser
      metadata:  
        name: developeruser03
      spec:  
        username: myusername3
        email: myusername3@example.com
        role: admin
        passwordCredentialsRef:    
          name: developeruserpassword
        developerAccountRef:    
          name: developeraccount03
      

      3. Ensure the developer account is successfully created in 3scale - you can confirm this by logging into the 3scale-admin portal and checking the Accounts->Listing page
      4. Pull the DeveloperAccount and DeveloperUser CRs to your local machine (either by using oc get or downloading the yaml in the OpenShift UI)
      5. Scale down the 3scale-operator
      6. Delete the DeveloperAccount and DeveloperUser CRs (you will need to remove their finalizers to ensure they actually delete)
      7. Scale 3scale back up
      8. Attempt to create the DeveloperAccount CR again (remember to remove managedFields, .status, etc.)
      9. The DeveloperAccount CR should have the following error message in its .status block:

      error calling 3scale system - reason: {"billing_address_address1":[],"billing_address_city":[],"billing_address_country":[],"billing_address_name":[],"email":["has already been taken"],"username":["has already been taken"],"users":["invalid"]} - code: 422
      

      Instead of getting this error, the operator should be able to recognize that the developer account is already present in the 3scale system and rather than attempt to create a new developer account, it should match the DeveloperAccount CR to its existing developer account resource - similar to how we currently reconcile Tenant CRs to tenant resources.

      DONE

      • Able to backup and restore DeveloperAccount CRs without errors

              Unassigned Unassigned
              ckyrillo@redhat.com Carl Kyrillos
              Carl Kyrillos Carl Kyrillos
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: