0

我似乎无法执行任何参数替换。

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)

所有结果

error: unexpected parameter name "MEMORY_REQUEST".

yaml 模板如下所示:

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
4

1 回答 1

3

您没有在模板中定义参数部分,因此它将拒绝您尝试提供的任何参数。

最好在以下位置查看有关模板和参数的文档:

于 2018-07-10T04:48:38.963 回答