diff --git a/go.mod b/go.mod index 36edf58..c71601d 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,13 @@ module github.com/haproxytech/haproxy-consul-connect go 1.13 require ( - github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect github.com/criteo/haproxy-spoe-go v0.0.0-20190925130734-97891c13d324 github.com/d4l3k/messagediff v1.2.1 // indirect github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 - github.com/go-openapi/analysis v0.19.0 // indirect - github.com/go-openapi/jsonpointer v0.19.0 // indirect - github.com/go-openapi/jsonreference v0.19.0 // indirect - github.com/go-openapi/loads v0.19.0 // indirect - github.com/go-openapi/runtime v0.19.0 // indirect - github.com/go-openapi/spec v0.19.0 // indirect - github.com/haproxytech/models v1.2.4 + github.com/haproxytech/models/v2 v2.1.0 github.com/hashicorp/consul v1.7.2 github.com/hashicorp/consul/api v1.4.0 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect - github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983 // indirect github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v0.9.2 github.com/sirupsen/logrus v1.4.2 diff --git a/go.sum b/go.sum index 6c1d120..0001583 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,8 @@ github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIO github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= @@ -72,6 +74,7 @@ github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyG github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF+n1M6o= github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0 h1:ZoRgc53qJCfSLimXqJDrmBhnt5GChDsExMCK7t48o0Y= github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= github.com/envoyproxy/go-control-plane v0.8.0 h1:uE6Fp4fOcAJdc1wTQXLJ+SYistkbG1dNoi6Zs1+Ybvk= @@ -100,47 +103,65 @@ github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70t github.com/go-openapi/analysis v0.17.0 h1:8JV+dzJJiK46XqGLqqLav8ZfEiJECp8jlOFhpiCdZ+0= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.19.0 h1:sYEyyO7OKQvJX0z4OyHWoGt0uLuALxB/ZJ4Jb3I6KNU= -github.com/go-openapi/analysis v0.19.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI= +github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.0 h1:guf3T2lnCBKlODmERt4T9GtMWRpJOikgKGyIvi0xcb8= -github.com/go-openapi/errors v0.19.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.4 h1:fSGwO1tSYHFu70NKaWJt5Qh0qoBRtCm/mXS1yhf+0W0= +github.com/go-openapi/errors v0.19.4/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.0 h1:FTUMcX77w5rQkClIzDtTxvn6Bsa894CcrzNj2MMfeg8= -github.com/go-openapi/jsonpointer v0.19.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.17.0 h1:yJW3HCkTHg7NOA+gZ83IPHzUSnUzGXhGmsdiCcMexbA= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk= -github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/loads v0.17.0 h1:H22nMs3GDQk4SwAaFQ+jLNw+0xoFeCueawhZlv8MBYs= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0 h1:wCOBNscACI8L93tt5tvB2zOMkJ098XCw3fP0BY2ybDA= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/loads v0.19.4 h1:5I4CCSqoWzT+82bBkNIvmLc0UOsoKKQ4Fz+3VxOB7SY= +github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9 h1:zXd+rkzHwMIYVTJ/j/v8zUQ9j3Ir32gC5Dn9DzZVvCk= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0 h1:sU6pp4dSV2sGlNKKyHxZzi1m1kG4WnYtWcJ+HYbygjE= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4 h1:csnOgcgAiuGoM/Po7PEpKDoNulCcF3FGbSnbHfxgjMI= +github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/spec v0.17.0 h1:XNvrt8FlSVP8T1WuhbAFF6QDhJc0zsoWzX4wXARhhpE= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4= -github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= +github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0 h1:0Dn9qy1G9+UJfRU7TR8bmdGxb4uifB7HNrJjOnV0yPk= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM= +github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.19.0 h1:Kg7Wl7LkTPlmc393QZQ/5rQadPhi7pBVEMZxyTi0Ii8= -github.com/go-openapi/swag v0.19.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE= +github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= -github.com/go-openapi/validate v0.19.0 h1:SF5vyj6PBFM6D1cw2NJIFrlS8Su2YKk6ADPPjAH70Bw= -github.com/go-openapi/validate v0.19.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= +github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.8 h1:YFzsdWIDfVuLvIOF+ZmKjVg1MbPJ1QgY9PihMwei1ys= +github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= @@ -163,6 +184,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCy github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOFEFIOxY5BWLFLwh+cL8vOBW4XJ2aqLE/Tf0= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= @@ -178,8 +201,8 @@ github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSf github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/haproxytech/models v1.2.4 h1:KYWMzEVVRxAPI6F64xF6oISY10TGm6VWvo/T2rXp4x4= -github.com/haproxytech/models v1.2.4/go.mod h1:UXZVErm/XN6z10sM/enmxrdeEnwo7vz1JI+a8ycEvOQ= +github.com/haproxytech/models/v2 v2.1.0 h1:NH0pDR0Oxb0rwIVD9X1Zs6qOfqozcQQJAFPrP79vxXw= +github.com/haproxytech/models/v2 v2.1.0/go.mod h1:HjM8x+j1/j4nHUA5lqh159OPZ3zQ5iGz13vHo9xeEk0= github.com/hashicorp/consul v1.7.2 h1:pDEnRiUE8jOUlxIqzo8Jw3Zcsz6KSpygk2BjkrsASsk= github.com/hashicorp/consul v1.7.2/go.mod h1:vKfXmSQNl6HwO/JqQ2DDLzisBDV49y+JVTkrdW1cnSU= github.com/hashicorp/consul/api v1.4.0 h1:jfESivXnO5uLdH650JU/6AnjRoHrLhULq0FnC3Kp9EY= @@ -294,6 +317,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= @@ -308,8 +332,10 @@ github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZi github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983 h1:wL11wNW7dhKIcRCHSm4sHKPWz0tt4mwBsVodG7+Xyqg= -github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= @@ -395,6 +421,7 @@ github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkB github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880 h1:1Ge4j/3uB2rxzPWD3TC+daeCw+w91z8UCUL/7WH5gn8= github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= @@ -414,6 +441,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -422,13 +451,22 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible h1:8uRvJleFpqLsO77WaAh2UrasMOzd8MxXrNj20e7El+Q= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vmware/govmomi v0.18.0 h1:f7QxSmP7meCtoAmiKZogvVbLInT+CZx6Px6K5rYsJZo= github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA= +go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191106202628-ed6320f186d4 h1:PDpCLFAH/YIX0QpHPf2eO7L4rC2OOirBrKtXTLLiNTY= golang.org/x/crypto v0.0.0-20191106202628-ed6320f186d4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -448,7 +486,9 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20170807180024-9a379c6b3e95/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -475,6 +515,7 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/p golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190508220229-2d0786266e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -494,9 +535,12 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.0.0-20180829000535-087779f1d2c9 h1:z1TeLUmxf9ws9KLICfmX+KGXTs+rjm+aGWzfsv7MZ9w= @@ -540,6 +584,7 @@ gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/haproxy/dataplane/backend.go b/haproxy/dataplane/backend.go index 992b34c..90cd11d 100644 --- a/haproxy/dataplane/backend.go +++ b/haproxy/dataplane/backend.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func (c *Dataplane) Backends() ([]models.Backend, error) { @@ -14,7 +14,7 @@ func (c *Dataplane) Backends() ([]models.Backend, error) { var res resT - err := c.makeReq(http.MethodGet, "/v1/services/haproxy/configuration/backends", nil, &res) + err := c.makeReq(http.MethodGet, "/v2/services/haproxy/configuration/backends", nil, &res) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (c *Dataplane) Servers(beName string) ([]models.Server, error) { var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/servers?backend=%s", beName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/servers?backend=%s", beName), nil, &res) if err != nil { return nil, err } @@ -41,21 +41,21 @@ func (t *tnx) CreateBackend(be models.Backend) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/backends?transaction_id=%s", t.txID), be, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/backends?transaction_id=%s", t.txID), be, nil) } func (t *tnx) DeleteBackend(name string) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v1/services/haproxy/configuration/backends/%s?transaction_id=%s", name, t.txID), nil, nil) + return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v2/services/haproxy/configuration/backends/%s?transaction_id=%s", name, t.txID), nil, nil) } func (t *tnx) CreateServer(beName string, srv models.Server) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/servers?backend=%s&transaction_id=%s", beName, t.txID), srv, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/servers?backend=%s&transaction_id=%s", beName, t.txID), srv, nil) } func (t *tnx) ReplaceServer(beName string, srv models.Server) error { @@ -71,7 +71,7 @@ func (c *Dataplane) ReplaceServer(beName string, srv models.Server) error { return err } - err = c.makeReq(http.MethodPut, fmt.Sprintf("/v1/services/haproxy/configuration/servers/%s?backend=%s&version=%d", srv.Name, beName, v), srv, nil) + err = c.makeReq(http.MethodPut, fmt.Sprintf("/v2/services/haproxy/configuration/servers/%s?backend=%s&version=%d", srv.Name, beName, v), srv, nil) if err != nil { return err } @@ -83,5 +83,5 @@ func (t *tnx) DeleteServer(beName string, name string) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v1/services/haproxy/configuration/servers/%s?backend=%s&transaction_id=%s", name, beName, t.txID), nil, nil) + return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v2/services/haproxy/configuration/servers/%s?backend=%s&transaction_id=%s", name, beName, t.txID), nil, nil) } diff --git a/haproxy/dataplane/dataplane.go b/haproxy/dataplane/dataplane.go index 439d9ea..e9e13fc 100644 --- a/haproxy/dataplane/dataplane.go +++ b/haproxy/dataplane/dataplane.go @@ -9,7 +9,7 @@ import ( "net/http" "sync" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) @@ -53,7 +53,7 @@ func (t *tnx) ensureTnx() error { } res := models.Transaction{} - err = t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/transactions?version=%d", v), nil, &res) + err = t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/transactions?version=%d", v), nil, &res) if err != nil { return err } @@ -76,7 +76,7 @@ func (c *Dataplane) ConfigVersion() (int, error) { var res struct { Version int `json:"_version"` } - err := c.makeReq(http.MethodGet, "/v1/services/haproxy/configuration/frontends", nil, &res) + err := c.makeReq(http.MethodGet, "/v2/services/haproxy/configuration/frontends", nil, &res) if err != nil { return 0, err } @@ -86,17 +86,17 @@ func (c *Dataplane) ConfigVersion() (int, error) { } func (c *Dataplane) Ping() error { - return c.makeReq(http.MethodGet, "/v1/specification", nil, nil) + return c.makeReq(http.MethodGet, "/v2/specification", nil, nil) } func (c *Dataplane) Stats() (models.NativeStats, error) { res := models.NativeStats{} - return res, c.makeReq(http.MethodGet, "/v1/services/haproxy/stats/native", nil, &res) + return res, c.makeReq(http.MethodGet, "/v2/services/haproxy/stats/native", nil, &res) } func (t *tnx) Commit() error { if t.txID != "" { - err := t.client.makeReq(http.MethodPut, fmt.Sprintf("/v1/services/haproxy/transactions/%s", t.txID), nil, nil) + err := t.client.makeReq(http.MethodPut, fmt.Sprintf("/v2/services/haproxy/transactions/%s", t.txID), nil, nil) if err != nil { return err } diff --git a/haproxy/dataplane/filters.go b/haproxy/dataplane/filters.go index 963332a..732bfad 100644 --- a/haproxy/dataplane/filters.go +++ b/haproxy/dataplane/filters.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func (c *Dataplane) Filters(parentType, parentName string) ([]models.Filter, error) { @@ -14,7 +14,7 @@ func (c *Dataplane) Filters(parentType, parentName string) ([]models.Filter, err var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/filters?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/filters?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (c *Dataplane) TCPRequestRules(parentType, parentName string) ([]models.TCP var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/tcp_request_rules?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/tcp_request_rules?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) if err != nil { return nil, err } @@ -41,12 +41,12 @@ func (t *tnx) CreateFilter(parentType, parentName string, filter models.Filter) if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/filters?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), filter, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/filters?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), filter, nil) } func (t *tnx) CreateTCPRequestRule(parentType, parentName string, rule models.TCPRequestRule) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/tcp_request_rules?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/tcp_request_rules?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) } diff --git a/haproxy/dataplane/frontend.go b/haproxy/dataplane/frontend.go index 9450225..b8f43a6 100644 --- a/haproxy/dataplane/frontend.go +++ b/haproxy/dataplane/frontend.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func (c *Dataplane) Frontends() ([]models.Frontend, error) { @@ -14,7 +14,7 @@ func (c *Dataplane) Frontends() ([]models.Frontend, error) { var res resT - err := c.makeReq(http.MethodGet, "/v1/services/haproxy/configuration/frontends", nil, &res) + err := c.makeReq(http.MethodGet, "/v2/services/haproxy/configuration/frontends", nil, &res) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (c *Dataplane) Binds(feName string) ([]models.Bind, error) { var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/binds?frontend=%s", feName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/binds?frontend=%s", feName), nil, &res) if err != nil { return nil, err } @@ -41,19 +41,19 @@ func (t *tnx) CreateFrontend(fe models.Frontend) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/frontends?transaction_id=%s", t.txID), fe, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/frontends?transaction_id=%s", t.txID), fe, nil) } func (t *tnx) DeleteFrontend(name string) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v1/services/haproxy/configuration/frontends/%s?transaction_id=%s", name, t.txID), nil, nil) + return t.client.makeReq(http.MethodDelete, fmt.Sprintf("/v2/services/haproxy/configuration/frontends/%s?transaction_id=%s", name, t.txID), nil, nil) } func (t *tnx) CreateBind(feName string, bind models.Bind) error { if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/binds?frontend=%s&transaction_id=%s", feName, t.txID), bind, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/binds?frontend=%s&transaction_id=%s", feName, t.txID), bind, nil) } diff --git a/haproxy/dataplane/http_request_rule.go b/haproxy/dataplane/http_request_rule.go index a6b0356..6a328e7 100644 --- a/haproxy/dataplane/http_request_rule.go +++ b/haproxy/dataplane/http_request_rule.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func (c *Dataplane) HTTPRequestRules(parentType, parentName string) ([]models.HTTPRequestRule, error) { @@ -14,7 +14,7 @@ func (c *Dataplane) HTTPRequestRules(parentType, parentName string) ([]models.HT var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/http_request_rules?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/http_request_rules?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) if err != nil { return nil, err } @@ -26,5 +26,5 @@ func (t *tnx) CreateHTTPRequestRule(parentType, parentName string, rule models.H if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/http_request_rules?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/http_request_rules?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) } diff --git a/haproxy/dataplane/logs.go b/haproxy/dataplane/logs.go index c939e3b..a3764c4 100644 --- a/haproxy/dataplane/logs.go +++ b/haproxy/dataplane/logs.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func (c *Dataplane) LogTargets(parentType, parentName string) ([]models.LogTarget, error) { @@ -14,7 +14,7 @@ func (c *Dataplane) LogTargets(parentType, parentName string) ([]models.LogTarge var res resT - err := c.makeReq(http.MethodGet, fmt.Sprintf("/v1/services/haproxy/configuration/log_targets?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) + err := c.makeReq(http.MethodGet, fmt.Sprintf("/v2/services/haproxy/configuration/log_targets?parent_type=%s&parent_name=%s", parentType, parentName), nil, &res) if err != nil { return nil, err } @@ -26,5 +26,5 @@ func (t *tnx) CreateLogTargets(parentType, parentName string, rule models.LogTar if err := t.ensureTnx(); err != nil { return err } - return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v1/services/haproxy/configuration/log_targets?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) + return t.client.makeReq(http.MethodPost, fmt.Sprintf("/v2/services/haproxy/configuration/log_targets?parent_type=%s&parent_name=%s&transaction_id=%s", parentType, parentName, t.txID), rule, nil) } diff --git a/haproxy/dataplanelog/log.go b/haproxy/dataplanelog/log.go new file mode 100644 index 0000000..26a9560 --- /dev/null +++ b/haproxy/dataplanelog/log.go @@ -0,0 +1,63 @@ +package dataplanelog + +import ( + "bufio" + "bytes" + "encoding/json" + "io" + "strings" + + log "github.com/sirupsen/logrus" +) + +func New(r io.Reader) { + scan := bufio.NewScanner(r) + go func() { + for scan.Scan() { + logLine(scan.Bytes()) + } + }() +} + +func logLine(line []byte) { + // dataplane starts by logging stuff in text before switching to json + if bytes.HasPrefix(line, []byte("time=\"")) { + return + } + + f := log.Fields{} + err := json.Unmarshal(line, &f) + if err != nil { + log.Errorf("dataplane: failed to parse log line: %s", string(line)) + return + } + + msg := f["msg"].(string) + level := f["level"].(string) + + delete(f, "msg") + delete(f, "level") + delete(f, "time") + + e := log.WithFields(log.Fields(f)) + fn := e.Errorf + + switch strings.ToLower(level) { + case "panic": + fn = e.Panicf + case "fatal": + fn = e.Fatalf + case "error": + fn = e.Errorf + case "warn", "warning": + fn = e.Warnf + case "info": + fn = e.Infof + case "debug": + fn = e.Debugf + case "trace": + fn = e.Tracef + } + + fn("dataplane: %s", msg) +} diff --git a/haproxy/halog/log.go b/haproxy/halog/log.go index 9134322..73a7832 100644 --- a/haproxy/halog/log.go +++ b/haproxy/halog/log.go @@ -3,43 +3,28 @@ package halog import ( "bufio" "io" - "os/exec" "strings" log "github.com/sirupsen/logrus" ) -func New(prefix string, r io.Reader) { +func New(r io.Reader) { scan := bufio.NewScanner(r) go func() { for scan.Scan() { - haproxyLog(prefix, scan.Text()) + haproxyLog(scan.Text()) } }() } -func Cmd(prefix string, cmd *exec.Cmd) error { - stdout, err := cmd.StdoutPipe() - if err != nil { - return err - } - New(prefix, stdout) - stderr, err := cmd.StderrPipe() - if err != nil { - return err - } - New(prefix, stderr) - return nil -} - -func haproxyLog(prefix, l string) { +func haproxyLog(l string) { if len(l) == 0 { return } f := log.Errorf defer func() { - f("%s: %s", prefix, strings.TrimSpace(l)) + f("%s: %s", "haproxy", strings.TrimSpace(l)) }() if l[0] != '[' { diff --git a/haproxy/halog/log_test.go b/haproxy/halog/log_test.go index 62539fa..6a3d92f 100644 --- a/haproxy/halog/log_test.go +++ b/haproxy/halog/log_test.go @@ -29,7 +29,7 @@ func (h *fakeHook) Fire(e *logrus.Entry) error { } func ensureLogIsPresent(t *testing.T, hook *fakeHook, expectedLevel logrus.Level, prefix, msg string) { - haproxyLog("haproxy", fmt.Sprintf("%s%s", prefix, msg)) + haproxyLog(fmt.Sprintf("%s%s", prefix, msg)) require.Equal(t, fmt.Sprintf("haproxy: %s", msg), hook.lastMessage[expectedLevel]) } diff --git a/haproxy/haproxy_cmd/cmd.go b/haproxy/haproxy_cmd/cmd.go index 256d33f..e4ad4b9 100644 --- a/haproxy/haproxy_cmd/cmd.go +++ b/haproxy/haproxy_cmd/cmd.go @@ -2,24 +2,33 @@ package haproxy_cmd import ( "fmt" + "io" "os/exec" "path" "sync/atomic" "syscall" - "github.com/haproxytech/haproxy-consul-connect/haproxy/halog" "github.com/haproxytech/haproxy-consul-connect/lib" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) -func runCommand(sd *lib.Shutdown, cmdPath string, args ...string) (*exec.Cmd, error) { +type Logger func(io.Reader) + +func runCommand(sd *lib.Shutdown, logger Logger, cmdPath string, args ...string) (*exec.Cmd, error) { _, file := path.Split(cmdPath) cmd := exec.Command(cmdPath, args...) - err := halog.Cmd("haproxy", cmd) + + stdout, err := cmd.StdoutPipe() + if err != nil { + return nil, err + } + logger(stdout) + stderr, err := cmd.StderrPipe() if err != nil { return nil, err } + logger(stderr) sd.Add(1) err = cmd.Start() diff --git a/haproxy/haproxy_cmd/cmd_test.go b/haproxy/haproxy_cmd/cmd_test.go index d9437e8..8319746 100644 --- a/haproxy/haproxy_cmd/cmd_test.go +++ b/haproxy/haproxy_cmd/cmd_test.go @@ -1,16 +1,19 @@ package haproxy_cmd import ( + "io" "testing" "github.com/haproxytech/haproxy-consul-connect/lib" "github.com/stretchr/testify/require" ) +var nilLogger = func(io.Reader) {} + func Test_runCommand_ok(t *testing.T) { t.Parallel() sd := lib.NewShutdown() - cmd, err := runCommand(sd, "ls", ".") + cmd, err := runCommand(sd, nilLogger, "ls", ".") require.NoError(t, err) err = cmd.Wait() require.NoError(t, err) @@ -19,7 +22,7 @@ func Test_runCommand_ok(t *testing.T) { func Test_runCommand_nok_wrong_path(t *testing.T) { t.Parallel() sd := lib.NewShutdown() - cmd, err := runCommand(sd, "/path/to/nowhere/that/can/be/found/myExec", "--help") + cmd, err := runCommand(sd, nilLogger, "/path/to/nowhere/that/can/be/found/myExec", "--help") require.NotNil(t, err) require.Contains(t, err.Error(), "no such file or directory") require.Nil(t, cmd) diff --git a/haproxy/haproxy_cmd/run.go b/haproxy/haproxy_cmd/run.go index d14dd84..21cd05b 100644 --- a/haproxy/haproxy_cmd/run.go +++ b/haproxy/haproxy_cmd/run.go @@ -12,6 +12,8 @@ import ( "time" "github.com/haproxytech/haproxy-consul-connect/haproxy/dataplane" + "github.com/haproxytech/haproxy-consul-connect/haproxy/dataplanelog" + "github.com/haproxytech/haproxy-consul-connect/haproxy/halog" "github.com/haproxytech/haproxy-consul-connect/lib" ) @@ -33,7 +35,7 @@ type Config struct { } func Start(sd *lib.Shutdown, cfg Config) (*dataplane.Dataplane, error) { - haCmd, err := runCommand(sd, + haCmd, err := runCommand(sd, halog.New, cfg.HAProxyPath, "-f", cfg.HAProxyConfigPath, @@ -42,7 +44,7 @@ func Start(sd *lib.Shutdown, cfg Config) (*dataplane.Dataplane, error) { return nil, err } - cmd, err := runCommand(sd, + cmd, err := runCommand(sd, dataplanelog.New, cfg.DataplanePath, "--scheme", "unix", "--socket-path", cfg.DataplaneSock, @@ -52,6 +54,8 @@ func Start(sd *lib.Shutdown, cfg Config) (*dataplane.Dataplane, error) { "--reload-delay", "1", "--userlist", "controller", "--transaction-dir", cfg.DataplaneTransactionDir, + "--log-format", "JSON", + "--log-level", "info", ) cleanupHAProxy := func() { haCmd.Process.Signal(os.Kill) diff --git a/haproxy/state/apply.go b/haproxy/state/apply.go index 58710a9..c96cc0c 100644 --- a/haproxy/state/apply.go +++ b/haproxy/state/apply.go @@ -3,7 +3,7 @@ package state import ( "reflect" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func Apply(ha HAProxy, old, new State) error { diff --git a/haproxy/state/apply_backend_test.go b/haproxy/state/apply_backend_test.go index 0129f6e..b13ec2b 100644 --- a/haproxy/state/apply_backend_test.go +++ b/haproxy/state/apply_backend_test.go @@ -3,7 +3,7 @@ package state import ( "testing" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/stretchr/testify/require" ) diff --git a/haproxy/state/apply_frontend_test.go b/haproxy/state/apply_frontend_test.go index 9ce7fa8..ed8b232 100644 --- a/haproxy/state/apply_frontend_test.go +++ b/haproxy/state/apply_frontend_test.go @@ -3,7 +3,7 @@ package state import ( "testing" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/stretchr/testify/require" ) diff --git a/haproxy/state/downstream.go b/haproxy/state/downstream.go index 9b5007f..c6e4a69 100644 --- a/haproxy/state/downstream.go +++ b/haproxy/state/downstream.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/haproxytech/haproxy-consul-connect/consul" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Downstream, state State) (State, error) { @@ -46,7 +46,7 @@ func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Dow // Logging if opts.LogRequests && opts.LogSocket != "" { fe.LogTarget = &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: opts.LogSocket, Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, @@ -57,13 +57,13 @@ func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Dow if opts.EnableIntentions { fe.Filter = &FrontendFilter{ Filter: models.Filter{ - ID: int64p(0), + Index: int64p(0), Type: models.FilterTypeSpoe, SpoeEngine: "intentions", SpoeConfig: opts.SPOEConfigPath, }, Rule: models.TCPRequestRule{ - ID: int64p(0), + Index: int64p(0), Action: models.TCPRequestRuleActionReject, Cond: models.TCPRequestRuleCondUnless, CondTest: "{ var(sess.connect.auth) -m int eq 1 }", @@ -91,7 +91,7 @@ func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Dow Forwardfor: forwardFor, }, Servers: []models.Server{ - models.Server{ + { Name: "downstream_node", Address: cfg.TargetAddress, Port: int64p(cfg.TargetPort), @@ -102,7 +102,7 @@ func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Dow // Logging if opts.LogRequests && opts.LogSocket != "" { be.LogTarget = &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: opts.LogSocket, Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, @@ -112,7 +112,7 @@ func generateDownstream(opts Options, certStore CertificateStore, cfg consul.Dow // App name header if cfg.AppNameHeaderName != "" && beMode == models.BackendModeHTTP { be.HTTPRequestRules = append(be.HTTPRequestRules, models.HTTPRequestRule{ - ID: int64p(0), + Index: int64p(0), Type: models.HTTPRequestRuleTypeAddHeader, HdrName: cfg.AppNameHeaderName, HdrFormat: "%[var(sess.connect.source_app)]", diff --git a/haproxy/state/fake_ha_test.go b/haproxy/state/fake_ha_test.go index 25b6bde..0bb597a 100644 --- a/haproxy/state/fake_ha_test.go +++ b/haproxy/state/fake_ha_test.go @@ -3,7 +3,7 @@ package state import ( "testing" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/stretchr/testify/require" ) diff --git a/haproxy/state/from_ha.go b/haproxy/state/from_ha.go index 5034c63..816f2ce 100644 --- a/haproxy/state/from_ha.go +++ b/haproxy/state/from_ha.go @@ -4,7 +4,7 @@ import ( "fmt" "sort" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) type HAProxyRead interface { diff --git a/haproxy/state/from_ha_test.go b/haproxy/state/from_ha_test.go index 3fe11c0..4d5596a 100644 --- a/haproxy/state/from_ha_test.go +++ b/haproxy/state/from_ha_test.go @@ -105,9 +105,9 @@ RHmDi0qnL6qrKfjTOnfHgQPCgxAy9knMIiDzBRg= require.NoError(t, err) dp, err := haproxy_cmd.Start(sd, haproxy_cmd.Config{ - HAProxyPath: "haproxy", + HAProxyPath: os.Getenv("HAPROXY"), HAProxyConfigPath: haCfgPath, - DataplanePath: "dataplaneapi", + DataplanePath: os.Getenv("DATAPLANEAPI"), DataplaneTransactionDir: cfgDir, DataplaneSock: cfgDir + "/dpsock", DataplaneUser: "usr", @@ -134,10 +134,6 @@ RHmDi0qnL6qrKfjTOnfHgQPCgxAy9knMIiDzBRg= } func TestFromHA(t *testing.T) { - err := haproxy_cmd.CheckEnvironment(haproxy_cmd.DefaultDataplaneBin, haproxy_cmd.DefaultHAProxyBin) - if err != nil { - t.Skipf("CANNOT Run test because of missing requirement: %s", err.Error()) - } cfgDir, err := ioutil.TempDir("", fmt.Sprintf("%s_*", t.Name())) require.NoError(t, err) diff --git a/haproxy/state/snapshot_test.go b/haproxy/state/snapshot_test.go index 2774025..0747d5c 100644 --- a/haproxy/state/snapshot_test.go +++ b/haproxy/state/snapshot_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/haproxytech/haproxy-consul-connect/consul" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/stretchr/testify/require" ) @@ -68,20 +68,20 @@ func GetTestHAConfig(baseCfg string, certVersion string) State { Verify: models.BindVerifyRequired, }, LogTarget: &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: baseCfg + "/logs.sock", Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, }, Filter: &FrontendFilter{ Filter: models.Filter{ - ID: int64p(0), + Index: int64p(0), Type: models.FilterTypeSpoe, SpoeEngine: "intentions", SpoeConfig: baseCfg + "/spoe", }, Rule: models.TCPRequestRule{ - ID: int64p(0), + Index: int64p(0), Action: models.TCPRequestRuleActionReject, Cond: models.TCPRequestRuleCondUnless, CondTest: "{ var(sess.connect.auth) -m int eq 1 }", @@ -105,7 +105,7 @@ func GetTestHAConfig(baseCfg string, certVersion string) State { Port: int64p(10000), }, LogTarget: &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: baseCfg + "/logs.sock", Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, @@ -131,14 +131,14 @@ func GetTestHAConfig(baseCfg string, certVersion string) State { }, }, LogTarget: &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: baseCfg + "/logs.sock", Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, }, HTTPRequestRules: []models.HTTPRequestRule{ { - ID: int64p(0), + Index: int64p(0), Type: models.HTTPRequestRuleTypeAddHeader, HdrName: "X-App", HdrFormat: "%[var(sess.connect.source_app)]", @@ -154,7 +154,7 @@ func GetTestHAConfig(baseCfg string, certVersion string) State { ConnectTimeout: int64p(int(consul.DefaultConnectTimeout.Milliseconds())), Mode: models.BackendModeHTTP, Balance: &models.Balance{ - Algorithm: models.BalanceAlgorithmLeastconn, + Algorithm: stringp(models.BalanceAlgorithmLeastconn), }, }, Servers: []models.Server{ @@ -182,7 +182,7 @@ func GetTestHAConfig(baseCfg string, certVersion string) State { }, }, LogTarget: &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: baseCfg + "/logs.sock", Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, diff --git a/haproxy/state/state.go b/haproxy/state/state.go index 77fa74d..316c19e 100644 --- a/haproxy/state/state.go +++ b/haproxy/state/state.go @@ -3,7 +3,7 @@ package state import ( "reflect" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) type FrontendFilter struct { diff --git a/haproxy/state/states.go b/haproxy/state/states.go index 238c0ca..4a9d932 100644 --- a/haproxy/state/states.go +++ b/haproxy/state/states.go @@ -6,7 +6,7 @@ import ( "time" "github.com/haproxytech/haproxy-consul-connect/consul" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) const ( diff --git a/haproxy/state/upstream.go b/haproxy/state/upstream.go index 288a07f..ccd2527 100644 --- a/haproxy/state/upstream.go +++ b/haproxy/state/upstream.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/haproxytech/haproxy-consul-connect/consul" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" ) func generateUpstream(opts Options, certStore CertificateStore, cfg consul.Upstream, oldState, newState State) (State, error) { @@ -36,7 +36,7 @@ func generateUpstream(opts Options, certStore CertificateStore, cfg consul.Upstr } if opts.LogRequests && opts.LogSocket != "" { fe.LogTarget = &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: opts.LogSocket, Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, @@ -51,14 +51,14 @@ func generateUpstream(opts Options, certStore CertificateStore, cfg consul.Upstr ServerTimeout: int64p(int(cfg.ReadTimeout.Milliseconds())), ConnectTimeout: int64p(int(cfg.ConnectTimeout.Milliseconds())), Balance: &models.Balance{ - Algorithm: models.BalanceAlgorithmLeastconn, + Algorithm: stringp(models.BalanceAlgorithmLeastconn), }, Mode: beMode, }, } if opts.LogRequests && opts.LogSocket != "" { be.LogTarget = &models.LogTarget{ - ID: int64p(0), + Index: int64p(0), Address: opts.LogSocket, Facility: models.LogTargetFacilityLocal0, Format: models.LogTargetFormatRfc5424, diff --git a/haproxy/stats.go b/haproxy/stats.go index fd62142..c04498e 100644 --- a/haproxy/stats.go +++ b/haproxy/stats.go @@ -5,7 +5,7 @@ import ( "time" "github.com/haproxytech/haproxy-consul-connect/haproxy/dataplane" - "github.com/haproxytech/models" + "github.com/haproxytech/models/v2" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" log "github.com/sirupsen/logrus" diff --git a/haproxy_test.go b/haproxy_test.go index 5fff04c..82e5aac 100644 --- a/haproxy_test.go +++ b/haproxy_test.go @@ -8,17 +8,12 @@ import ( "net/http" - "github.com/haproxytech/haproxy-consul-connect/haproxy/haproxy_cmd" "github.com/haproxytech/haproxy-consul-connect/lib" "github.com/hashicorp/consul/api" "github.com/stretchr/testify/require" ) func TestService(t *testing.T) { - err := haproxy_cmd.CheckEnvironment(haproxy_cmd.DefaultDataplaneBin, haproxy_cmd.DefaultHAProxyBin) - if err != nil { - t.Skipf("CANNOT Run test because of missing requirement: %s", err.Error()) - } sd := lib.NewShutdown() client := startAgent(t, sd) defer func() { @@ -68,10 +63,6 @@ func TestService(t *testing.T) { } func TestPreparedQuery(t *testing.T) { - err := haproxy_cmd.CheckEnvironment(haproxy_cmd.DefaultDataplaneBin, haproxy_cmd.DefaultHAProxyBin) - if err != nil { - t.Skipf("CANNOT Run test because of missing requirement: %s", err.Error()) - } sd := lib.NewShutdown() client := startAgent(t, sd) defer func() { @@ -79,7 +70,7 @@ func TestPreparedQuery(t *testing.T) { sd.Wait() }() - _, _, err = client.PreparedQuery().Create(&api.PreparedQueryDefinition{ + _, _, err := client.PreparedQuery().Create(&api.PreparedQueryDefinition{ Name: "pq-", Service: api.ServiceQuery{ Service: "${match(1)}", diff --git a/utils_test.go b/utils_test.go index 0b7803f..fbbfb35 100644 --- a/utils_test.go +++ b/utils_test.go @@ -6,6 +6,7 @@ import ( "log" "net" "net/http" + "os" "testing" "time" @@ -73,6 +74,8 @@ func startConnectService(t *testing.T, sd *lib.Shutdown, client *api.Client, reg sourceHap := haproxy.New(client, watcher.C, haproxy.Options{ EnableIntentions: true, + HAProxyBin: os.Getenv("HAPROXY"), + DataplaneBin: os.Getenv("DATAPLANEAPI"), }) go func() { err := sourceHap.Run(sd)