porter icon indicating copy to clipboard operation
porter copied to clipboard

wip: mixin schema configuration in porter's schema

Open carolynvs opened this issue 2 years ago • 1 comments

What does this change

Porter now allows mixins to be declared by name only or additionally provide some configuration.

mixins:
  - exec
  - kubernetes:
       clientVersion: 1.2.3

Porter determines if configuration is allowed (and its schema) by checking for a definition returned by the mixin's schema command named "config".

{
"definitions": {
    "config": {
      "description": "Configuration that can be set when the mixin is declared",
      "type": "object",
      "properties": {
        "kubernetes": {
          "description": "kubernetes mixin configuration",
          "type": "object",
          "properties": {
            "clientVersion": {
              "description": "Version of kubectl to install in the bundle",
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "installStep": {}
}
  • The config subdocument above can be used as a template by other mixins, just replace clientVersion with the configuration properties supported by your mixin.
  • The config must have a single property of type object named after the mixin. So replace "kubernetes" with the name of your mixin.

What issue does it fix

Closes #1341

Notes for the reviewer

Put any questions or notes for the reviewer here.

Checklist

  • [ ] Did you write tests?
  • [ ] Did you write documentation?
  • [ ] Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • [ ] If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

carolynvs avatar Aug 08 '22 20:08 carolynvs

I have tested this against the kubernetes mixin (https://github.com/getporter/kubernetes-mixin/pull/32) but I would like to add a test mixin in this repo so that I can test it better without relying on manual testing with a real mixin.

carolynvs avatar Aug 16 '22 21:08 carolynvs

The test are failing due to #2320. I'm going to manually merge since my efforts to fix that bug is slow going.

carolynvs avatar Sep 02 '22 19:09 carolynvs