apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
  name: webservice.testapps
  labels:
    usecase: forplugintest
spec:
  workload:
    definition:
      apiVersion: apps/v1
      kind: Deployment
  extension:
    template: |
      output: {
        apiVersion: "apps/v1"
        kind:       "Deployment"
        metadata: name: context.name
        spec: {
          replicas: 1
          podSpec: {
            containers: [{
              name:  context.name
              image: parameter.image
              env: parameter.env
              ports: [{
                containerPort: parameter.port
              }]
            }]
          }
        }
      }
      parameter: {
        // +usage=Which image would you like to use for your service
        // +short=i
        image: string

        // +usage=Which port do you want customer traffic sent to
        // +short=p
        port:  *6379 | int

        env: [...{
          name:  string
          value?: string
          valueFrom?: {
            secretKeyRef: {
              name: string
              key: string
            }
          }
        }]
      }