His
His

Reputation: 6053

OpenShift OC new-app parameter substitutions not working

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

Upvotes: 0

Views: 1288

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58563

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:

Upvotes: 3

Related Questions