Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.64 KB | None | 0 0
  1. #### Usage:
  2.  
  3. `conffigen.py test01 | int01 | prod01 `
  4.  
  5. ```base
  6. $ configgen.py int01
  7. ```
  8.  
  9. Input:
  10. ```
  11. {
  12. "static_resources": {
  13. "listeners": [
  14. {
  15. "address": {
  16. "socket_address": {
  17. "address": "0.0.0.0",
  18. "port_value": 10000
  19. }
  20. },
  21. "listener_filters": {
  22. "name": "envoy.listener.tls_inspector",
  23. "config": {}
  24. },
  25. "filter_chains": [
  26. {
  27. "filter_chain_match": {
  28. "sni_domains": "ams.int01.aws.xfinityhome.com"
  29. },
  30. "filters": [
  31. {
  32. "name": "envoy.tcp_proxy",
  33. "config": {
  34. "stat_prefix": "ams_tcp",
  35. "cluster": "ams"
  36. }
  37. }
  38. ]
  39. },
  40. {
  41. "filter_chain_match": {
  42. "sni_domains": "releasedb.int01.aws.xfinityhome.com"
  43. },
  44. "filters": [
  45. {
  46. "name": "envoy.tcp_proxy",
  47. "config": {
  48. "stat_prefix": "releasedb_tcp",
  49. "cluster": "releasedb"
  50. }
  51. }
  52. ]
  53. },
  54. {
  55. "filter_chain_match": {
  56. "sni_domains": "ams-qa3.int01.aws.xfinityhome.com"
  57. },
  58. "filters": [
  59. {
  60. "name": "envoy.tcp_proxy",
  61. "config": {
  62. "stat_prefix": "ams_qa3_tcp",
  63. "cluster": "ams-qa3"
  64. }
  65. }
  66. ]
  67. },
  68. {
  69. "filter_chain_match": {
  70. "sni_domains": "ams-qa6.int01.aws.xfinityhome.com"
  71. },
  72. "filters": [
  73. {
  74. "name": "envoy.tcp_proxy",
  75. "config": {
  76. "stat_prefix": "ams_qa6_tcp",
  77. "cluster": "ams-qa6"
  78. }
  79. }
  80. ]
  81. },
  82. {
  83. "filter_chain_match": {
  84. "sni_domains": "insert.int01.aws.xfinityhome.com"
  85. },
  86. "filters": [
  87. {
  88. "name": "envoy.tcp_proxy",
  89. "config": {
  90. "stat_prefix": "insert_tcp",
  91. "cluster": "insert"
  92. }
  93. }
  94. ]
  95. }
  96. ]
  97. }
  98. ],
  99. "clusters": {{clusterBlock}}
  100. },
  101. "admin": {
  102. "access_log_path": "/dev/null",
  103. "address": {
  104. "socket_address": {
  105. "address": "0.0.0.0",
  106. "port_value": 8001
  107. }
  108. }
  109. },
  110. "stats_sinks": [
  111. {
  112. "name": "envoy.statsd",
  113. "config": {
  114. "tcp_cluster_name": "statsd"
  115. }
  116. }
  117. ]
  118. }
  119.  
  120. ```
  121.  
  122.  
  123. Output:
  124. ```
  125. {
  126. "static_resources": {
  127. "listeners": [
  128. {
  129. "address": {
  130. "socket_address": {
  131. "address": "0.0.0.0",
  132. "port_value": 10000
  133. }
  134. },
  135. "listener_filters": {
  136. "name": "envoy.listener.tls_inspector",
  137. "config": {}
  138. },
  139. "filter_chains": [
  140. {
  141. "filter_chain_match": {
  142. "sni_domains": "ams.int01.aws.xfinityhome.com"
  143. },
  144. "filters": [
  145. {
  146. "name": "envoy.tcp_proxy",
  147. "config": {
  148. "stat_prefix": "ams_tcp",
  149. "cluster": "ams"
  150. }
  151. }
  152. ]
  153. },
  154. {
  155. "filter_chain_match": {
  156. "sni_domains": "ams-qa3.int01.aws.xfinityhome.com"
  157. },
  158. "filters": [
  159. {
  160. "name": "envoy.tcp_proxy",
  161. "config": {
  162. "stat_prefix": "ams_qa3_tcp",
  163. "cluster": "ams-qa3"
  164. }
  165. }
  166. ]
  167. },
  168. {
  169. "filter_chain_match": {
  170. "sni_domains": "ams-qa6.int01.aws.xfinityhome.com"
  171. },
  172. "filters": [
  173. {
  174. "name": "envoy.tcp_proxy",
  175. "config": {
  176. "stat_prefix": "ams_qa6_tcp",
  177. "cluster": "ams-qa6"
  178. }
  179. }
  180. ]
  181. },
  182. {
  183. "filter_chain_match": {
  184. "sni_domains": "insert.int01.aws.xfinityhome.com"
  185. },
  186. "filters": [
  187. {
  188. "name": "envoy.tcp_proxy",
  189. "config": {
  190. "stat_prefix": "insert_tcp",
  191. "cluster": "insert"
  192. }
  193. }
  194. ]
  195. }
  196. ]
  197. }
  198. ],
  199. "clusters": [
  200. {
  201. "name": "statsd",
  202. "connect_timeout": "1.00s",
  203. "type": "strict_dns",
  204. "lb_policy": "round_robin",
  205. "hosts": [
  206. {
  207. "socket_address": {
  208. "address": "telegraf.service",
  209. "port_value": 8125
  210. }
  211. }
  212. ]
  213. },
  214. {
  215. "name": "zipkin",
  216. "connect_timeout": "1.00s",
  217. "type": "LOGICAL_DNS",
  218. "lb_policy": "round_robin",
  219. "dns_lookup_family": "V4_ONLY",
  220. "hosts": [
  221. {
  222. "socket_address": {
  223. "address": "zipkin.service",
  224. "port_value": 8000
  225. }
  226. }
  227. ]
  228. },
  229. {
  230. "name": "telegraf",
  231. "connect_timeout": "1.00s",
  232. "type": "LOGICAL_DNS",
  233. "lb_policy": "round_robin",
  234. "dns_lookup_family": "V4_ONLY",
  235. "hosts": [
  236. {
  237. "socket_address": {
  238. "address": "telegraf.service",
  239. "port_value": 8000
  240. }
  241. }
  242. ]
  243. },
  244. {
  245. "name": "ams-qa6",
  246. "connect_timeout": "1.00s",
  247. "type": "LOGICAL_DNS",
  248. "lb_policy": "round_robin",
  249. "dns_lookup_family": "V4_ONLY",
  250. "hosts": [
  251. {
  252. "socket_address": {
  253. "address": "ams-qa6.service",
  254. "port_value": 8000
  255. }
  256. }
  257. ]
  258. },
  259. {
  260. "name": "insert",
  261. "connect_timeout": "1.00s",
  262. "type": "LOGICAL_DNS",
  263. "lb_policy": "round_robin",
  264. "dns_lookup_family": "V4_ONLY",
  265. "hosts": [
  266. {
  267. "socket_address": {
  268. "address": "insert.service",
  269. "port_value": 8000
  270. }
  271. }
  272. ]
  273. },
  274. {
  275. "name": "ams-qa3",
  276. "connect_timeout": "1.00s",
  277. "type": "LOGICAL_DNS",
  278. "lb_policy": "round_robin",
  279. "dns_lookup_family": "V4_ONLY",
  280. "hosts": [
  281. {
  282. "socket_address": {
  283. "address": "ams-qa3.service",
  284. "port_value": 8000
  285. }
  286. }
  287. ]
  288. },
  289. {
  290. "name": "releasedb",
  291. "connect_timeout": "1.00s",
  292. "type": "LOGICAL_DNS",
  293. "lb_policy": "round_robin",
  294. "dns_lookup_family": "V4_ONLY",
  295. "hosts": [
  296. {
  297. "socket_address": {
  298. "address": "releasedb.service",
  299. "port_value": 8000
  300. }
  301. }
  302. ]
  303. },
  304. {
  305. "name": "ams",
  306. "connect_timeout": "1.00s",
  307. "type": "LOGICAL_DNS",
  308. "lb_policy": "round_robin",
  309. "dns_lookup_family": "V4_ONLY",
  310. "hosts": [
  311. {
  312. "socket_address": {
  313. "address": "ams.service",
  314. "port_value": 8000
  315. }
  316. }
  317. ]
  318. }
  319. ]
  320. },
  321. "admin": {
  322. "access_log_path": "/dev/null",
  323. "address": {
  324. "socket_address": {
  325. "address": "0.0.0.0",
  326. "port_value": 8001
  327. }
  328. }
  329. },
  330. "stats_sinks": [
  331. {
  332. "name": "envoy.statsd",
  333. "config": {
  334. "tcp_cluster_name": "statsd"
  335. }
  336. }
  337. ]
  338. }
  339. ```
Add Comment
Please, Sign In to add comment