OpenShift OC 新应用程序参数替换不起作用
OpenShift OC new-app parameter substitutions not working
我似乎无法执行任何参数替换。
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
您没有在模板中定义参数部分,因此它会拒绝您尝试提供的任何参数。
最好在以下位置查看有关模板和参数的文档:
我似乎无法执行任何参数替换。
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
您没有在模板中定义参数部分,因此它会拒绝您尝试提供的任何参数。
最好在以下位置查看有关模板和参数的文档: