Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Configurable shared instance ports #40

Open
wants to merge 1 commit into
base: v426
Choose a base branch
from

Conversation

ArthurHlt
Copy link

As documented in #36, this PR adds control to the choice of the port in the precise range.

This is in complement of this PR: pivotal-cf/cf-redis-broker#3

Details over the end-to-end tests performed:


Scenario: shared instance uses a port in the preferred range

  • given a redis deployment with
    • redis.broker.shared_min_port=60000 redis.broker.shared_max_port=60000
  • when
    • cf bind-service redis-instance app
  • then
    • returned port within VCAP_SERVICES is 60000

Test:

$ cf cs redis shared-vm myredis
$ cf create-service-key myredis mykey
Creating service key mykey for service instance myredis as ahalet...
OK

$ cf service-key myredis mykey
Getting key mykey for service instance myredis as ahalet...

{
 "host": "10.234.250.160",
 "password": "9babfc50-630e-4f26-bbee-97f1b16ff2a3",
 "port": 60000
}

Result: OK


Scenario: shared instances rejects service binding when not available port in the preferred range, providing clear error message to service operators and possibly end-users

  • given a redis deployment with
    • redis.broker.shared_min_port=40000 redis.broker.shared_max_port=40000
  • when
    • cf bind-service redis-instance1 app
    • cf bind-service redis-instance2 app
  • then
    • cf bind-service redis-instance2 app fails with error message
    • redis operator logs contains log entry:

Test:

$ cf cs redis shared-vm myredis
Creating service instance myredis in org dfy / space etherpad as ahalet...
OK

$ cf cs redis shared-vm myredis2
Creating service instance myredis2 in org dfy / space etherpad as ahalet...
FAILED
Server error, status code: 502, error code: 10001, message: Service broker error: No port is available in the range. Please ask help to your Operator

Result: OK


Scenario: operator misconfigurations of preferred port range, fail deployment with clear error message.

  • given a redis deployment descriptor with
    • redis.broker.shared_min_port=60000 redis.broker.shared_max_port=30000
  • when
    • the bosh deploy is requested
  • Then
    • the redis-dedicated-job fails to start
    • and the redis-dedicated-job log entry indicates ""

Test:

Deploying
---------
bosh-master$ bosh deploy
[...]
  Started updating instance cf-redis-broker > cf-redis-broker/e54249ca-63a8-467a-869c-9c0c992ee26e (0) (canary). Failed: 'cf-redis-broker/0 (e54249ca-63a8-467a-869c-9c0c992ee26e)' is not running after update. Review logs for failed jobs: process-watcher, cf-redis-broker, broker-nginx, route_registrar, syslog-configurator (00:01:58)

Error 400007: 'cf-redis-broker/0 (e54249ca-63a8-467a-869c-9c0c992ee26e)' is not running after update. Review logs for failed jobs: process-watcher, cf-redis-broker, broker-nginx, route_registrar, syslog-configurator

bosh-master$ bosh ssh cf-redis-broker/0

redis-broker$ cat /var/vcap/sys/log/cf-redis-broker/cf-redis-configmigrator.stderr.log
[...]
panic: Not valid range port: minimum port is higher than maximum port

Result: OK


Scenario: User ask multiple redis

  • given a redis deployment with
    • redis.broker.shared_min_port=1024 redis.broker.shared_max_port=65535
  • when
    • cf bind-service redis-instance1 app
    • cf bind-service redis-instance2 app
  • then
    • we should have port 1024 and 1025 taken

Test:

$ cf cs redis shared-vm myredis
Creating service instance myredis in org dfy / space etherpad as ahalet...
OK

$ cf cs redis shared-vm myredis2
Creating service instance myredis2 in org dfy / space etherpad as ahalet...
OK

$ cf create-service-key myredis mykey
Creating service key mykey for service instance myredis as ahalet...
OK

$ cf create-service-key myredis2 mykey
Creating service key mykey for service instance myredis2 as ahalet...
OK

$ cf service-key myredis mykey
Getting key mykey for service instance myredis as ahalet...

{
 "host": "10.234.250.160",
 "password": "e062facf-f591-49c0-b75b-d7b474fc70c6",
 "port": 1024
}

$ cf service-key myredis2 mykey
Getting key mykey for service instance myredis2 as ahalet...

{
 "host": "10.234.250.160",
 "password": "c712a7ce-0fcd-477f-afc2-568bb0b2ea3e",
 "port": 1025
}

Result: OK

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants