0

I can't seem to perform any parameter substitution.

oc new-app -f template.yaml -p MEMORY_REQUEST=2G
oc new-app -f template.yaml -p MEMORY_REQUEST="2G"
oc new-app -f template.yaml --param=MEMORY_REQUEST=2G
oc new-app -f template.yaml --param=MEMORY_REQUEST="2G"
oc new-app -f template.yaml --param-file=myapp.properties (contains MEMORY_REQUEST=2G)

All result in

error: unexpected parameter name "MEMORY_REQUEST".

The yaml template looks like this:

apiVersion: v1
kind: Template
metadata:
  name: template
objects:
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    labels:
      app: myapp
    name: myapp
  spec:
    replicas: 1
    selector:
      app: myapp
      deploymentconfig: myapp
    template:
      metadata:
        labels:
          app: myapp
          deploymentconfig: myapp
      spec:
        containers:
          - image: myapp:1.1.1
            imagePullPolicy: IfNotPresent
            name: myapp
            ports:
              - containerPort: 8888
            resources:
              requests:
                memory: ${MEMORY_REQUEST}
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        terminationGracePeriodSeconds: 30
His
  • 5,891
  • 15
  • 61
  • 82

1 Answers1

3

You don't define a parameters section in your template, so it will reject any parameters you try and give it.

Best to see the documentation on templates and parameters at:

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • Right. Thanks Graham. It wasn't clear to me from the documentation that I had to also define the parameters section. I thought it would just pick things up automatically from the parameters file or parameters arguments. Ps. I might come back with more questions! :) (currently, in the middle of the learning stage.) – His Jul 10 '18 at 04:54