diff --git a/f2soperator/config.yaml b/f2soperator/config.yaml index e0cb304..c1fc7fb 100644 --- a/f2soperator/config.yaml +++ b/f2soperator/config.yaml @@ -4,6 +4,9 @@ prometheus: url: 192.168.2.40:32133 f2s: + memberlist: + bind_port: 7079 + cluster: memberlist.f2s timeouts: request_timeout: 120000 http_timeout: 60000 diff --git a/f2soperator/go.mod b/f2soperator/go.mod index 6982ebf..dd6cdb1 100644 --- a/f2soperator/go.mod +++ b/f2soperator/go.mod @@ -16,6 +16,7 @@ require ( ) require ( + github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -26,26 +27,37 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/google/btree v1.0.1 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.1.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect + github.com/hashicorp/go-multierror v1.0.0 // indirect + github.com/hashicorp/go-sockaddr v1.0.0 // indirect + github.com/hashicorp/golang-lru v0.5.0 // indirect + github.com/hashicorp/memberlist v0.5.1 // indirect github.com/imdario/mergo v0.3.6 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/miekg/dns v1.1.26 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.16.0 // indirect golang.org/x/oauth2 v0.5.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/f2soperator/go.sum b/f2soperator/go.sum index b29270a..1317962 100644 --- a/f2soperator/go.sum +++ b/f2soperator/go.sum @@ -5,6 +5,8 @@ github.com/actgardner/gogen-avro/v10 v10.1.0/go.mod h1:o+ybmVjEa27AAr35FRqU98DJu github.com/actgardner/gogen-avro/v10 v10.2.1/go.mod h1:QUhjeHPchheYmMDni/Nx7VB0RsT/ee8YIgGY/xpEQgQ= github.com/actgardner/gogen-avro/v9 v9.1.0/go.mod h1:nyTj6wPqDJoxM3qdnjcLv+EnMDSDFqE0qDpva2QRmKc= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -79,6 +81,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -103,6 +107,21 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hamba/avro v1.5.6/go.mod h1:3vNT0RLXXpFm2Tb/5KC71ZRJlOroggq1Rcitb6k4Fr8= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack/v2 v2.1.1 h1:xQEY9yB2wnHitoSzk/B9UjXWRQ67QKu5AOm8aFp8N3I= +github.com/hashicorp/go-msgpack/v2 v2.1.1/go.mod h1:upybraOAblm4S7rx0+jeNy+CWWhzywQsSRV5033mMu4= +github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/memberlist v0.5.1 h1:mk5dRuzeDNis2bi6LLoQIXfMH7JQvAzt3mQD0vNZZUo= +github.com/hashicorp/memberlist v0.5.1/go.mod h1:zGDXV6AqbDTKTM6yxW0I4+JtFzZAJVoIPvss4hV8F24= github.com/heetch/avro v0.3.1/go.mod h1:4xn38Oz/+hiEUTpbVfGVLfvOg0yKLlRP7Q9+gJJILgA= github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= @@ -140,6 +159,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -171,6 +192,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= +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/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -189,8 +212,11 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= @@ -207,14 +233,15 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200505041828-1ed23360d12c/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= @@ -229,6 +256,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/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-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -236,17 +265,17 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -254,6 +283,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm 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-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= diff --git a/f2soperator/hub/f2shub.go b/f2soperator/hub/f2shub.go index e23b044..11e3f9d 100644 --- a/f2soperator/hub/f2shub.go +++ b/f2soperator/hub/f2shub.go @@ -1,6 +1,7 @@ package hub import ( + clusterstate "butschi84/f2s/state/cluster" "butschi84/f2s/state/configuration" "butschi84/f2s/state/dispatcherstate" "butschi84/f2s/state/eventmanager" @@ -14,4 +15,5 @@ type F2SHub struct { F2SQueue *queue.F2SQueue F2SDispatcherHub *dispatcherstate.F2SDispatcherHub F2SOperatorState *operatorstate.F2SOperatorState + F2SClusterState *clusterstate.F2SClusterState } diff --git a/f2soperator/main.go b/f2soperator/main.go index 7c92e35..8a045cc 100644 --- a/f2soperator/main.go +++ b/f2soperator/main.go @@ -3,11 +3,13 @@ package main import ( "butschi84/f2s/hub" "butschi84/f2s/operation/apiserver" + "butschi84/f2s/operation/cluster" "butschi84/f2s/operation/dispatcher" "butschi84/f2s/operation/kafka" "butschi84/f2s/operation/metrics" "butschi84/f2s/operation/operator" "butschi84/f2s/services/logger" + clusterstate "butschi84/f2s/state/cluster" "butschi84/f2s/state/configuration" "butschi84/f2s/state/dispatcherstate" "butschi84/f2s/state/eventmanager" @@ -51,6 +53,7 @@ func main() { F2SQueue: queue.Initialize(), F2SDispatcherHub: dispatcherstate.Initialize(), F2SOperatorState: operatorstate.Initialize(), + F2SClusterState: clusterstate.Initialize(), } var wg sync.WaitGroup @@ -60,6 +63,8 @@ func main() { wg.Add(numWorkers) // start all components + logging.Info("=> initializng f2s cluster") + go handleComponent("cluster", cluster.Initialize, &wg) logging.Info("=> initializng rest api server") go handleComponent("api server", apiserver.HandleRequests, &wg) go logging.Info("=> initializing operator") diff --git a/f2soperator/operation/apiserver/cluster.go b/f2soperator/operation/apiserver/cluster.go new file mode 100644 index 0000000..9c0a2e6 --- /dev/null +++ b/f2soperator/operation/apiserver/cluster.go @@ -0,0 +1,23 @@ +package apiserver + +import ( + "encoding/json" + "net/http" +) + +// ********************************************************* +// get current configucluster stateration +// ********************************************************* +func getClusterState(w http.ResponseWriter, r *http.Request) { + logging.Info("request to get current cluster state") + + // set response headers + w.Header().Set("Content-Type", "application/json") + + jsonBytes, err := json.MarshalIndent(f2shub.F2SClusterState, "", " ") + if err != nil { + return + } + + _, err = w.Write(jsonBytes) +} diff --git a/f2soperator/operation/apiserver/main.go b/f2soperator/operation/apiserver/main.go index a389830..88c8840 100644 --- a/f2soperator/operation/apiserver/main.go +++ b/f2soperator/operation/apiserver/main.go @@ -48,6 +48,7 @@ func HandleRequests(hub *hub.F2SHub) { protectedRouter := router.PathPrefix("/").Subrouter() protectedRouter.Use(authMiddleware) protectedRouter.HandleFunc("/auth/signin", signin) + protectedRouter.HandleFunc("/cluster", getClusterState).Methods(http.MethodGet) protectedRouter.HandleFunc("/functions", returnAllFunctions).Methods(http.MethodGet) protectedRouter.HandleFunc("/functions", createFunction).Methods(http.MethodPost) protectedRouter.HandleFunc("/functions/{id}", getFunction).Methods(http.MethodGet) @@ -131,7 +132,7 @@ func authMiddleware(next http.Handler) http.Handler { requiredPrivilege = string(configuration.F2SPrivilegeSettingsView) } else if mainRequestPath == "users" { requiredPrivilege = string(configuration.F2SPrivilegeSettingsView) - } else if mainRequestPath == "deployments" { + } else if mainRequestPath == "cluster" { requiredPrivilege = string(configuration.F2SPrivilegeSettingsView) } else if mainRequestPath == "prometheus" { requiredPrivilege = string(configuration.F2SPrivilegeSettingsView) diff --git a/f2soperator/operation/cluster/cluster.go b/f2soperator/operation/cluster/cluster.go new file mode 100644 index 0000000..93488e8 --- /dev/null +++ b/f2soperator/operation/cluster/cluster.go @@ -0,0 +1,115 @@ +package cluster + +import ( + "butschi84/f2s/hub" + "butschi84/f2s/services/logger" + clusterstate "butschi84/f2s/state/cluster" + "fmt" + "log" + "os" + "os/signal" + "syscall" + "time" + + "github.com/hashicorp/memberlist" +) + +var logging *logger.F2SLogger +var f2shub *hub.F2SHub + +type customLogger struct { + logger *logger.F2SLogger +} + +func (cl customLogger) Output(calldepth int, s string) error { + logging.Info(s) + return nil +} + +func (cl customLogger) Write(p []byte) (n int, err error) { + logging.Info(string(p)) + return len(p), nil +} + +func Initialize(h *hub.F2SHub) { + + // consume variables + f2shub = h + + // initialize logging + logging = logger.Initialize("dispatcher") + + // subscribe to configuration changes + logging.Info("subscribing to config package events") + f2shub.F2SEventManager.Subscribe(handleEvents) + + // join cluster memberlist + joinMemberList() + + for { + time.Sleep(time.Second) + } +} + +func joinMemberList() { + // Get the hostname of the current machine + logging.Info("resolving hostname in order to join cluster memberlist") + hostname, err := os.Hostname() + if err != nil { + logging.Error(fmt.Errorf("failed to resolve hostname because: %s", err.Error())) + } + + // Configure memberlist + config := memberlist.DefaultLANConfig() + config.BindPort = f2shub.F2SConfiguration.Config.F2S.Memberlist.BindPort + config.Name = hostname + config.LogOutput = &customLogger{logger: logging} + list, err := memberlist.Create(config) + if err != nil { + logging.Error(fmt.Errorf("failed to join memberlist because: %s", err.Error())) + } + + // Join an existing cluster + f2shub.F2SClusterState.MemberlistAddress = fmt.Sprintf("%s:%v", + f2shub.F2SConfiguration.Config.F2S.Memberlist.Cluster, + f2shub.F2SConfiguration.Config.F2S.Memberlist.BindPort) + + // use environment var to join memberlist when it is set + envMemberListAddress := os.Getenv("MEMBERLIST_ADDRESS") + if envMemberListAddress != "" { + f2shub.F2SClusterState.MemberlistAddress = envMemberListAddress + logging.Info(fmt.Sprintf("environment variable MEMBERLIST_ADDRESS is set. using memberlist address: %s", f2shub.F2SClusterState.MemberlistAddress)) + } + + logging.Info(fmt.Sprintf("joining memberlist at: %s", f2shub.F2SClusterState.MemberlistAddress)) + _, err = list.Join([]string{f2shub.F2SClusterState.MemberlistAddress}) + if err != nil { + log.Fatal("Failed to join cluster: ", err) + } + + // Handle signals to gracefully leave the cluster + signals := make(chan os.Signal, 1) + signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM) + + go func() { + <-signals + list.Leave(5 * time.Second) + os.Exit(0) + }() + + // Perform application logic + // For example, loop to periodically print memberlist members + ticker := time.NewTicker(5 * time.Second) + defer ticker.Stop() + + for range ticker.C { + members := list.Members() + f2shub.F2SClusterState.ClusterMembers = make([]clusterstate.F2SClusterStateClusterMember, len(members)) + for idx, member := range members { + f2shub.F2SClusterState.ClusterMembers[idx] = clusterstate.F2SClusterStateClusterMember{ + Name: member.Name, + Address: member.Address(), + } + } + } +} diff --git a/f2soperator/operation/cluster/eventhandler.go b/f2soperator/operation/cluster/eventhandler.go new file mode 100644 index 0000000..755960b --- /dev/null +++ b/f2soperator/operation/cluster/eventhandler.go @@ -0,0 +1,14 @@ +package cluster + +import ( + "butschi84/f2s/state/eventmanager" + "fmt" +) + +// handle eventmanager events +func handleEvents(event eventmanager.Event) { + logging.Info("processing event", fmt.Sprintf("'%s'", string(event.Type))) + + switch event.Type { + } +} diff --git a/f2soperator/services/logger/logging.go b/f2soperator/services/logger/logging.go index 2d21ffa..930f0dd 100644 --- a/f2soperator/services/logger/logging.go +++ b/f2soperator/services/logger/logging.go @@ -38,3 +38,8 @@ func (l F2SLogger) Error(err error) { func (l F2SLogger) Event(text ...string) { l.Logger.Info(strings.Join(text, " "), "type", "event") } + +func (c *F2SLogger) Output(calldepth int, s string) error { + c.Logger.Info(s) + return nil +} diff --git a/f2soperator/start_debug.py b/f2soperator/start_debug.py index d0ada99..a5575fa 100755 --- a/f2soperator/start_debug.py +++ b/f2soperator/start_debug.py @@ -25,7 +25,7 @@ def generate_random_port(): print("Forward ports from Kubernetes services") subprocess.Popen(["kubectl", "port-forward", "-n", "f2s", "service/prometheus-service", "9090:9090"], stdout=subprocess.DEVNULL) subprocess.Popen(["kubectl", "port-forward", "-n", "f2s", "service/f2s-memberlist", "7079:7079"], stdout=subprocess.DEVNULL) -subprocess.Popen(["kubectl", "port-forward", "-n", "f2s", "service/f2s-api", "8080:8080"], stdout=subprocess.DEVNULL) +# subprocess.Popen(["kubectl", "port-forward", "-n", "f2s", "service/f2s-api", "8080:8080"], stdout=subprocess.DEVNULL) # Use forwarded services print("Set environment variables for f2s debugging") diff --git a/f2soperator/state/cluster/main.go b/f2soperator/state/cluster/main.go new file mode 100644 index 0000000..5559f75 --- /dev/null +++ b/f2soperator/state/cluster/main.go @@ -0,0 +1,7 @@ +package clusterstate + +func Initialize() *F2SClusterState { + return &F2SClusterState{ + MemberlistAddress: "", + } +} diff --git a/f2soperator/state/cluster/types.go b/f2soperator/state/cluster/types.go new file mode 100644 index 0000000..5c75b74 --- /dev/null +++ b/f2soperator/state/cluster/types.go @@ -0,0 +1,11 @@ +package clusterstate + +type F2SClusterState struct { + MemberlistAddress string `json:"memberlist_address"` + ClusterMembers []F2SClusterStateClusterMember `json:"cluster_members` +} + +type F2SClusterStateClusterMember struct { + Name string `json:"name"` + Address string `json:"address"` +} diff --git a/f2soperator/state/configuration/types.go b/f2soperator/state/configuration/types.go index b4bf073..11cc246 100644 --- a/f2soperator/state/configuration/types.go +++ b/f2soperator/state/configuration/types.go @@ -22,11 +22,16 @@ type F2SConfigMapPrometheus struct { URL string `yaml:"url"` } type F2SConfigMapF2S struct { - Timeouts F2SConfigMapF2STimeouts `yaml:"timeouts"` - Auth F2SConfigMapAuth `yaml:"auth"` - Kafka F2SConfigMapKafka `yaml:"kafka"` + Timeouts F2SConfigMapF2STimeouts `yaml:"timeouts"` + Auth F2SConfigMapAuth `yaml:"auth"` + Kafka F2SConfigMapKafka `yaml:"kafka"` + Memberlist F2SConfigMapMemberlist `yaml:"memberlist"` } +type F2SConfigMapMemberlist struct { + BindPort int `yaml:"bind_port"` + Cluster string `yaml:"cluster"` +} type F2SConfigMapF2STimeouts struct { RequestTimeout int `yaml:"request_timeout"` HttpTimeout int `yaml:"http_timeout"` diff --git a/f2soperator/static/openapi/spec.yaml b/f2soperator/static/openapi/spec.yaml index 0eb9be8..2dc886a 100644 --- a/f2soperator/static/openapi/spec.yaml +++ b/f2soperator/static/openapi/spec.yaml @@ -130,6 +130,18 @@ paths: application/json: schema: type: object + /cluster: + get: + summary: get current f2s cluster state + tags: + - F2S Internal + responses: + "200": + description: OK + content: + application/json: + schema: + type: object /operator: get: summary: get current f2s operator state diff --git a/helm/templates/f2s/f2s-memberlist.yaml b/helm/templates/f2s/f2s-memberlist.yaml new file mode 100644 index 0000000..c80a743 --- /dev/null +++ b/helm/templates/f2s/f2s-memberlist.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: f2s-memberlist + namespace: f2s + labels: + app: f2s-operator +spec: + selector: + app: f2s + clusterIP: None + ports: + - port: "{{ .Values.f2sconfig.f2s.memberlist.bind_port }}" + targetPort: "{{ .Values.f2sconfig.f2s.memberlist.bind_port }}" diff --git a/helm/values.yaml b/helm/values.yaml index f78504a..d632b9f 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -22,6 +22,8 @@ f2sconfig: url: prometheus-service.f2s:9090 f2s: + memberlist: + bind_port: 7079 timeouts: request_timeout: 120000 http_timeout: 60000