atlassian / smith

Smith is a Kubernetes workflow engine / resource manager
Apache License 2.0
285 stars 24 forks source link

Consider making plugins even purer functions #205

Open wryun opened 6 years ago

wryun commented 6 years ago

If we support #194 and #195, and we want to do #186 and #187, then one option would be to stop supporting plugins as a separate top-level 'thing' and instead allow references to call user provided functions.

e.g. rather than doing:

  - name: compute--secretenvvar
    dependsOn:
    - compute--basic--binding
    - compute--mykinesis--binding

    spec:
      plugin:
        name: secretenvvar
        objectName: compute--secretenvvar
        spec:
          outputJsonKey: secretEnvVars
          outputSecretKey: ec2ComputeEnvVars

One would instead do:

  - name: compute--secretenvvar
    dependsOn:
    - compute--basic--binding
    - compute--mykinesis--binding
    spec:
      metadata:
        name: b
      apiVersion: v1
      kind: Secret
      stringData:
        ec2ComputeEnvVars: {{buildSecretObject(*#*)}}

i.e. plugins simply provide some set of simple functions which you can pass parameters to. Here # is shorthand for all outputs of all dependencies, but for most plugins you're likely to want more specific values (for either deps or outputs).

Why is this useful?

Yes, we do make the references more complex, and yes, this is looking more like what RPS does (in terms of jmespath functions and more complex references)... we could just use jmespath here ;) Just saying.