itowlson / spin-variables

Inspect configuration variables of a Spin application
0 stars 0 forks source link

Output SpinKube YAML #3

Open itowlson opened 1 month ago

itowlson commented 1 month ago

Generate a YAML file or fragment (I don't know well enough to be clear yet) that sets the appropriate environment variables, which the user can easily edit values into and use in their deployment. E.g. spin variables -f ... -o kube >vars.yaml.

technosophos commented 1 month ago

At it's most primitive, it's something like this (plus whatever the secrets/configmap variety is)

variables:
  - name: "title" 
    value: "Luxor Demo"
  - name: "about"
    value: "Example of the Luxor platform distributed over 3 working groups"
  - name: "proxy_upstream_repository_host"
    value: "http://luxor-backend.default.svc.cluster.local"

I figure that with output like that, one could copy it into the appropriate SpinApp yaml

itowlson commented 1 month ago

@technosophos My current stab is:

kind: ConfigMap
apiVersion: v1
metadata:
  name: spinapp-cfg
data:
  # databaseUrl: http://example.com
---
kind: Secret
apiVersion: v1
metadata:
  name: spinapp-secret
data:
  databasePassword: TO-DO
---
spec:
  variables:
    - name: database_url
      valueFrom:
        configMapKeyRef:
          name: spinapp-cfg
          key: databaseUrl
          optional: true
    - name: database_password
      valueFrom:
        secretKeyRef:
          name: spinapp-secret
          key: databasePassword
          optional: false

Do you prefer the name-value form, or should I emit both, or offer them as separate options?