Hide Forgot
We should do this for sprint 35 if at all possible 1) Capability use in the api 2) Default to 1 if not set in the db (for N-1 compat during migration) 3) Write a migration 4) Add it to the plan config (need to figure out what to give silver users) 5) oo-admin-ctl-user needs --set-domain-max-count or similar
Also need to allow deleting domains via UI if we make that required to downgrade
Broker changes: - Updated the "max_domains" field for the user REST API to return the user's max_domains capability. - The API will return DEFAULT_MAX_DOMAINS for legacy users without "capabilities.max_domains" - The API will reject a plan change if the user has more domains than the plan's max_domains capability -- Free users are allowed 1 domain -- Silver users are allowed 3 domains Migration: Added a migration to add "capabilities.max_domains" for legacy users (1 for free users, 3 for silver users) UI additions: Users can now delete a domain via the UI (from the /domain/<id> page) Config additions: /etc/openshift/broker.conf now has a DEFAULT_MAX_DOMAINS setting Admin additions: oo-admin-ctl-user now takes a --setmaxdomains argument
Will merge in https://github.com/openshift/li/pull/2034
Tested on devenv_3944,result is as following: For broker changes: 1.Checked the user info using rest api /broker/rest/user, it displayed two max_domains value like following: <capabilities> <plan-upgrade-enabled>true</plan-upgrade-enabled> <subaccounts>false</subaccounts> <max-domains>3</max-domains> <gear-sizes> <gear-size>small</gear-size> <gear-size>medium</gear-size> </gear-sizes> <private-ssl-certificates>true</private-ssl-certificates> <max-storage-per-gear>5</max-storage-per-gear> </capabilities> <max-gears>16</max-gears> <max-domains>4</max-domains> The first <max-domains> value is the 'max_domains' => 3 in plugins/billing/aria/config/initializers/openshift-origin-billing-aria.rb file, the second <max-domains> value read from conf.get('MAX_DOMAINS_PER_USER', '4').to_i in var/www/openshift/broker/config/environments/development.rb 2. After upgraded to siver account, silver user still can not create more than 1 domains without changing the MAX_DOMAINS_PER_USER value. Silver user should be allowed to create 3 domains by default. 3.Tried to downgrade to free plan when user has more than 1 domains, error message "User nhnhnh has more domains (3) than the 'free' plan allows." prompt, this should be expected. For migration: After migration, checked in mongodb, the max_domains value has been added to users, 1 for free user, 3 for silver user. For UI additions: Checked on /domain/<id> page, did not find route to delete a domain. For Config additions: Checked in /etc/openshift/broker.conf , it now has a DEFAULT_MAX_DOMAINS setting. For Admin additions: Checked by trying to use oo-admin-ctl-user -l nhnhnh --setmaxdomains 10, it still does not have --setmaxdomains argument, also tried by using oo-admin-ctl-user -h/--help, same result. According to the above result, assign this bug back, thanks.
Required pull request https://github.com/openshift/origin-server/pull/3972 didn't get merged. Re-merging.
Tested on devenv_3953, result is as following: For broker changes: 1.Checked the user info using rest api /broker/rest/user, it displayed max_domains value like following: <capabilities> <gear-sizes> <gear-size>small</gear-size> <gear-size>medium</gear-size> </gear-sizes> <plan-upgrade-enabled>true</plan-upgrade-enabled> <private-ssl-certificates>true</private-ssl-certificates> <subaccounts>false</subaccounts> <max-storage-per-gear>5</max-storage-per-gear> </capabilities> <max-gears>16</max-gears> <max-domains>3</max-domains> max-domains value is 3 for silver account, and 1 for free account. 2. After upgraded to siver account, silver user can create 3 domains by default. 3.Tried to downgrade to free plan when user has more than 1 domains, error message "User nhnhnh has more domains (3) than the 'free' plan allows." prompt, this should be expected. For migration: After migration, checked in mongodb, the max_domains value has been added to users, 1 for free user, 3 for silver user, and silve user can create 3 domains successfully. For UI additions: Domains can be deleted successfully from console now. For Config additions: Checked in /etc/openshift/broker.conf , it now has a DEFAULT_MAX_DOMAINS setting. For Admin additions: [root@ip-10-239-2-225 ~]# oo-admin-ctl-user -l bvbvb --setmaxdomains 6 Setting max_domains to 6... Done. User bvbvb: plan: silver consumed domains: 3 max domains: 6 consumed gears: 0 max gears: 16 max tracked storage per gear: 0 max untracked storage per gear: 5 plan upgrade enabled: true gear sizes: small, medium sub accounts allowed: false private SSL certificates allowed: true And user can create 6 domains successfully after setting the max-domains value. According to the above result, verify this bug, thanks.