我正在尝试在.jinja文件中部署容器,我知道这可以使用.yaml文件来完成,但我希望从单个.yaml文件调用多个.jinja文件来完成我的部署。
这是我当前在用于容器部署的.jinja文件中的内容:
resources:
- name: test-cluster
type: container.v1.cluster
properties:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80而我现在收到了这个错误:
ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1542747397856-57b1edea09b01-d7bff680-2f96dfe0]: errors:
- code: CONDITION_NOT_MET
location: /deployments/deployment-test/resources/test-cluster->$.properties->$.cluster.name
message: |-
InputMapping for field [cluster.name] for method [create] could not be set from input, mapping was: [$.ifNull($.resource.properties.cluster.name, $.resource.name)发布于 2018-11-23 08:54:43
This github repo就是你想要完成的整体目标的一个例子。请注意,在文件cluster.jinja的属性下,有一个名为“集群”的列表,它指定了集群本身的属性,如节点计数等。在您所展示的文件中,您指定了cluster er.v1.cluster类型,但没有指定该类型所隐含的内容(创建集群所必需的内容)。该错误指示程序正在查找“present.You : name:{{ CLUSTER_NAME }}”,但它不是container.v1.cluster类型需要的类似于下面的内容。
resources:
- name: {{ CLUSTER_NAME }}
type: container.v1.cluster
properties:
zone: {{ properties['zone'] }}
cluster:
name: {{ CLUSTER_NAME }}
initialNodeCount: {{ properties['initialNodeCount'] }}
nodeConfig:...在github存储库中还有另一个名为deployment.jinja的文件,其中包含用于部署pods的语法。您应该尝试复制与该文件类似的内容以指定pod
https://stackoverflow.com/questions/53401450
复制相似问题