github.com/cilium/cilium@v1.16.2/operator/api/cell.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package api 5 6 import ( 7 "github.com/cilium/hive/cell" 8 "github.com/spf13/pflag" 9 ) 10 11 const ( 12 // OperatorAPIServeAddr is the "<ip>:<port>" on which to serve api requests 13 // from the operator. 14 // Use ":<port>" to bind on all interfaces. 15 // Use an empty string to bind on both "127.0.0.1:0" and "[::1]:0". 16 OperatorAPIServeAddr = "operator-api-serve-addr" 17 ) 18 19 const ( 20 // OperatorAPIServeAddrDefault is the default "<ip>:<port>" value on which to serve 21 // api requests from the operator. 22 OperatorAPIServeAddrDefault = "localhost:9234" 23 ) 24 25 var ServerCell = cell.Module( 26 "cilium-operator-api", 27 "Cilium Operator API Server", 28 29 cell.Config(Config{}), 30 cell.Provide(newServer), 31 cell.Invoke(func(Server) {}), 32 ) 33 34 type Config struct { 35 OperatorAPIServeAddr string 36 } 37 38 func (def Config) Flags(flags *pflag.FlagSet) { 39 flags.String(OperatorAPIServeAddr, OperatorAPIServeAddrDefault, "Address to serve API requests") 40 }