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

enum from configMapKeyRef, secretKeyRef #7172

Open
scott-grimes opened this issue Nov 4, 2021 · 0 comments
Open

enum from configMapKeyRef, secretKeyRef #7172

scott-grimes opened this issue Nov 4, 2021 · 0 comments
Labels

Comments

@scott-grimes
Copy link

scott-grimes commented Nov 4, 2021

Summary

Workflow spec.arguments.parameters should support an enumFrom argument that works in a similar manner to the valueFrom

Use Cases

We currently use workflows for CRUD operations involving ephemeral environments. "enum" is super helpful to provide developers with a list of options to select from. Our current workflows for upgrading and uninstalling applications within an env looks like:

kind: Workflow
metadata:
  generateName: upgrade-application-
spec:
  arguments:
    parameters:
    - name: destination
      enum:
      - us/prod 
      - us/uat 
      - us/qa-foobar
---
kind: Workflow
metadata:
  generateName: uninstall-application-
spec:
  arguments:
    parameters:
    - name: destination
      enum:
      - us/prod 
      - us/uat 
      - us/qa-foobar

Some developers can also create new environments using a create-environment workflow. In addition to other things the create-environment workflow modifies the workflow templates for uninstall-application and upgrade-application by adding the new destination to the list of enums. The destroy-environment workflow does the same, it modifies the workflow templates and removes a destination from the enum options.

It would be far easier if the workflow template could fetch the enum values from an external resource, similar to how the "value" can be fetched using valueFrom.configMapKeyRef.

Proposed Syntax

---
kind: Workflow
metadata:
  generateName: uninstall-application-
spec:
  arguments:
    parameters:
    - name: destination
      enumFrom:
        configMapKeyRef:
          name: simple-parameters
          key: my-destinations

The current way we do this is rather janky and prone to errors.

yq e -i "(.spec.arguments.parameters[] | select(.name == \"destination\") | .enum) |= . + [\"${NEW_DESTINATION}\"]" uninstall-application.yaml

This feature could be useful when many workflows have to share some common elements from a single source of truth (the configmap)


Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

@scott-grimes scott-grimes added the type/feature Feature request label Nov 4, 2021
@alexec alexec added the area/ui label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants