Skip to content

Conversation

@KevFan
Copy link
Contributor

@KevFan KevFan commented Apr 27, 2022

Description

Delete developer account when cr is deleted

Verification

  • Install CRDs and run 3scale operator
make install
oc new-project 3scale
make run
  • Create S3 secret for APIManager
oc apply -f - <<EOF   
---
apiVersion: v1
kind: Secret
metadata:
  creationTimestamp: null
  name: aws-auth
stringData:
  AWS_ACCESS_KEY_ID: something
  AWS_SECRET_ACCESS_KEY: something
  AWS_BUCKET: something
  AWS_REGION: us-east-1
type: Opaque
EOF
  • Create APIManager
oc apply -f - <<EOF                                                             
---             
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
  name: apimanager1
spec:
  wildcardDomain: apps.some-valid-domain
  resourceRequirementsEnabled: false
  system:
    fileStorage:
      simpleStorageService:
        configurationSecretRef:
          name: aws-auth
EOF
  • Create secret for tenant admin
oc apply -f - <<EOF                                                             
---             
apiVersion: v1
kind: Secret
metadata:
  name: ecorp-admin-secret
type: Opaque
stringData:
  admin_password: password
EOF
  • Create Tenant
oc apply -f - <<EOF                                                             
---             
apiVersion: capabilities.3scale.net/v1alpha1
kind: Tenant
metadata:
  name: tenant1
spec:
  email: test1@test.com
  masterCredentialsRef:
    name: system-seed
  organizationName: test1Org
  passwordCredentialsRef:
    name: ecorp-admin-secret
  systemMasterUrl: 'https://master. apps.some-valid-domain'
  tenantSecretRef:
    name: tenant-secret
  username: test1
EOF
  • Create secret for DeveleperUser
oc apply -f - <<EOF                                                             
---             
apiVersion: v1
kind: Secret
metadata:
  name: my-user-password
type: Opaque
stringData:
  password: password
EOF
  • Create DeveloperUser on the created tenant
oc apply -f - <<EOF                                                             
---             
apiVersion: capabilities.3scale.net/v1beta1
kind: DeveloperUser
metadata:
  name: devuser1
  namespace: 3scale
spec: 
  username: test1
  email: test1@example.com
  passwordCredentialsRef: 
    name: my-user-password
  developerAccountRef: 
    name: devaccount1
  providerAccountRef: 
    name: "tenant-secret"
  role: admin
EOF
  • Create DeveloperAccount on the created tenant
oc apply -f - <<EOF                                                             
---             
apiVersion: capabilities.3scale.net/v1beta1
kind: DeveloperAccount
metadata:
  name: devaccount1
  namespace: 3scale
spec: 
  orgName: "test1"
  monthlyBillingEnabled: false
  monthlyChargingEnabled: false
  providerAccountRef: 
    name: "tenant-secret"
EOF
  • Sign into the created tenant and verify that DeveloperAccount is present
  • Delete DeveloperAccount CR
oc delete developeraccount devaccount1
  • Refresh the UI and verify developer account is deleted from the UI
  • Create developer account again
  • Delete tenant
oc delete tenant tenant1
  • Verify DeveloperAccount CR is removed along with the Tenant CR

@KevFan KevFan changed the title [WIP] THREESCALE-7052 - feat: delete developer account THREESCALE-7052 - feat: delete developer account May 3, 2022
Copy link
Member

@eguzki eguzki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good.

Missing adding owner reference (if exists) to the owning tenantCR.

Missing mention in the doc, same as in the product or backends doc.

@KevFan KevFan force-pushed the THREESCALE-7052 branch from 12dfd23 to 03746de Compare May 6, 2022 11:57
@KevFan KevFan force-pushed the THREESCALE-7052 branch from 03746de to 46964ad Compare May 6, 2022 14:40
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 46964ad and detected 5 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 2

View more on Code Climate.

@KevFan
Copy link
Contributor Author

KevFan commented May 9, 2022

/retest

@thomasmaas thomasmaas requested a review from eguzki May 11, 2022 08:05
@eguzki
Copy link
Member

eguzki commented May 16, 2022

Verification steps well defined and after running them, it is working as expected.

Good job 🎖️

@eguzki eguzki merged commit d4b44f6 into 3scale:master May 16, 2022
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.

2 participants