84 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HCL
		
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HCL
		
	
	
	
| job "nfs-multi-type-example" {
 | |
|   datacenters = ["dc1"]
 | |
|   type = "service"
 | |
| 
 | |
|   # 为本地LXC容器配置的任务组
 | |
|   group "lxc-apps" {
 | |
|     count = 2
 | |
|     
 | |
|     constraint {
 | |
|       attribute = "${attr.unique.hostname}"
 | |
|       operator = "regexp"
 | |
|       value = "(influxdb|hcp)"
 | |
|     }
 | |
| 
 | |
|     volume "lxc-nfs" {
 | |
|       type      = "host"
 | |
|       source    = "nfs-shared"
 | |
|       read_only = false
 | |
|     }
 | |
| 
 | |
|     task "lxc-app" {
 | |
|       driver = "podman"
 | |
| 
 | |
|       config {
 | |
|         image = "alpine:latest"
 | |
|         args = ["tail", "-f", "/dev/null"]
 | |
|       }
 | |
| 
 | |
|       volume_mount {
 | |
|         volume      = "lxc-nfs"
 | |
|         destination = "/shared/lxc"
 | |
|         read_only   = false
 | |
|       }
 | |
| 
 | |
|       resources {
 | |
|         cpu    = 100
 | |
|         memory = 64
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   # 为海外PVE容器配置的任务组
 | |
|   group "pve-apps" {
 | |
|     count = 3
 | |
|     
 | |
|     constraint {
 | |
|       attribute = "${attr.unique.hostname}"
 | |
|       operator = "regexp"
 | |
|       value = "(ash1d|ash2e|ash3c|ch2|ch3)"
 | |
|     }
 | |
| 
 | |
|     volume "pve-nfs" {
 | |
|       type      = "host"
 | |
|       source    = "nfs-shared"
 | |
|       read_only = false
 | |
|     }
 | |
| 
 | |
|     task "pve-app" {
 | |
|       driver = "podman"
 | |
| 
 | |
|       config {
 | |
|         image = "alpine:latest"
 | |
|         args = ["tail", "-f", "/dev/null"]
 | |
|         
 | |
|         # 为海外节点添加网络优化参数
 | |
|         network_mode = "host"
 | |
|       }
 | |
| 
 | |
|       volume_mount {
 | |
|         volume      = "pve-nfs"
 | |
|         destination = "/shared/pve"
 | |
|         read_only   = false
 | |
|       }
 | |
| 
 | |
|       resources {
 | |
|         cpu    = 100
 | |
|         memory = 64
 | |
|         network {
 | |
|           mbits = 5
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| } |