Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current parameter format in apb.yml doesn't allow merging of shared and plan-unique params #347

Closed
djwhatle opened this issue Aug 8, 2017 · 3 comments
Assignees
Labels
3.11 | release-1.3 Kubernetes 1.11 | Openshift 3.11 | Broker release-1.3

Comments

@djwhatle
Copy link
Contributor

djwhatle commented Aug 8, 2017

Bug: Current parameter format in apb.yml doesn't allow merging of shared and plan-unique params

What happened:

  • Was writing a multi-plan APB with high number of parameters (~30 params, 200 lines of code)
  • Wanted to share most parameters while making ~5 parameters unique to each plan
  • Tried merging "shared" and "unique" parameter variables using YAML's anchor/alias feature
shared_params: &shared_params
  - name: aws_access_key
    ...
  - name: aws_secret_key
    ...

plan_1_params: &plan_1_params
  - name: unique_param_X
    ...

plan_2_params: &plan_1_params
  - name: unique_param_Y
    ...

plans:
  - name: plan-1
    parameters:
      << : *shared_params
      << : *plan_1_params
    ...

  - name: plan-2
    parameters:
      << : *shared_params
      << : *plan_2_params
    ...

  • This approach doesn't work, service-catalog ends up showing no parameters for APB
  • This is a limitation of YAML (YAML is only capable of merging mappings, not lists)
  • Can be worked around in the service broker to provide a better APB authoring experience

What you expected to happen:

  • Parameters merge as expected
  • Able to write write an APB complying with DRY
  • Able to avoid multiplier on APB line count every time new plan is added

Proposed Fix:

  • Change ansible-service-broker to accept a different format in apb.yml which will allow param merging
  • Update all existing apb-examples to use this new format
shared_params: &shared_params
  aws_access_key:
    type: string
    required: true
    ...
  aws_secret_key:
    type: string
    required: true
    ...

plan_1_params: &plan_1_params
  unique_param_X:
    type: string
    required: true
  ...

plan_2_params: &plan_1_params
  unique_param_Y:
    type: string
    required: true
  ...

plans:
  - name: plan-1
    parameters: # map[string]PD
      << : *shared_params
      << : *plan_1_params
    ...

  - name: plan-2
    parameters: # map[string]PD
      << : *shared_params
      << : *plan_2_params
    ...
@djwhatle djwhatle changed the title Current parameter format in apb.yml doesn't allow merging of base/unique params Current parameter format in apb.yml doesn't allow merging of shared and unique params Aug 8, 2017
@djwhatle djwhatle changed the title Current parameter format in apb.yml doesn't allow merging of shared and unique params Current parameter format in apb.yml doesn't allow merging of shared and plan-unique params Aug 8, 2017
@jmrodri
Copy link
Contributor

jmrodri commented Aug 26, 2017

I still prefer the original format with the list of objects

  - name: aws_access_key
    ...
  - name: aws_secret_key
    ...

We need to figure out a better way to solve the inheritance if yaml itself doesn't support it natively.

@jmrodri
Copy link
Contributor

jmrodri commented Aug 26, 2017

The short term work around is to duplicate the keys until we solve this permanently.

@rthallisey rthallisey added 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2 bug and removed enhancement labels Jan 12, 2018
@rthallisey rthallisey added 3.11 | release-1.3 Kubernetes 1.11 | Openshift 3.11 | Broker release-1.3 and removed 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2 labels Mar 6, 2018
@jmrodri
Copy link
Contributor

jmrodri commented Jul 23, 2018

Closing since this is unlikely to ever get fixed.

@jmrodri jmrodri closed this as completed Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 | release-1.3 Kubernetes 1.11 | Openshift 3.11 | Broker release-1.3
Projects
None yet
Development

No branches or pull requests

4 participants