2023-11-10 19:22:06 +00:00
|
|
|
resource "docker_container" "{{.Node.DockerName}}-{{.Workload.ID.TFString}}" {
|
|
|
|
name = "{{.Node.DockerName}}-{{.Workload.ID.TFString}}"
|
2023-09-06 23:46:34 +00:00
|
|
|
network_mode = "container:${docker_container.{{.PodName}}.id}"
|
2023-11-02 19:25:48 +00:00
|
|
|
image = docker_image.{{.ImageResource}}.image_id
|
2023-09-06 23:46:34 +00:00
|
|
|
restart = "on-failure"
|
|
|
|
|
|
|
|
{{- range $k, $v := .Labels }}
|
|
|
|
labels {
|
|
|
|
label = "{{ $k }}"
|
|
|
|
value = "{{ $v }}"
|
|
|
|
}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
volumes {
|
|
|
|
volume_name = "{{.TLSVolumeName}}"
|
|
|
|
container_path = "/consul/config/certs"
|
|
|
|
read_only = true
|
|
|
|
}
|
|
|
|
|
|
|
|
env = [
|
|
|
|
"DP_CONSUL_ADDRESSES=server.{{.Node.Cluster}}-consulcluster.lan",
|
|
|
|
"DP_SERVICE_NODE_NAME={{.Node.PodName}}",
|
2023-11-10 19:22:06 +00:00
|
|
|
"DP_PROXY_SERVICE_ID={{.Workload.ID.Name}}",
|
2023-09-06 23:46:34 +00:00
|
|
|
{{ if .Enterprise }}
|
2023-11-10 19:22:06 +00:00
|
|
|
"DP_SERVICE_NAMESPACE={{.Workload.ID.Namespace}}",
|
|
|
|
"DP_SERVICE_PARTITION={{.Workload.ID.Partition}}",
|
2023-09-06 23:46:34 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ if .Token }}
|
|
|
|
"DP_CREDENTIAL_TYPE=static",
|
|
|
|
"DP_CREDENTIAL_STATIC_TOKEN={{.Token}}",
|
|
|
|
{{ end }}
|
|
|
|
// for demo purposes
|
|
|
|
"DP_ENVOY_ADMIN_BIND_ADDRESS=0.0.0.0",
|
|
|
|
"DP_ENVOY_ADMIN_BIND_PORT=19000",
|
|
|
|
"DP_LOG_LEVEL=trace",
|
|
|
|
"DP_CA_CERTS=/consul/config/certs/consul-agent-ca.pem",
|
|
|
|
"DP_CONSUL_GRPC_PORT=8503",
|
|
|
|
"DP_TLS_SERVER_NAME=server.{{.Node.Datacenter}}.consul",
|
|
|
|
]
|
|
|
|
|
|
|
|
command = [
|
|
|
|
"/usr/local/bin/consul-dataplane",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|