Documentation ¶
Index ¶
- Variables
- func AddToUniqueSlice(src string, to []string) []string
- func CorrecteShellExpr(src string) string
- func DeleteFromSlice(src string, from []string) []string
- func GetBatcherTimeout(defaultValue time.Duration) time.Duration
- func GetCommonID() string
- func GetEnvWithDefault(defaultValue, envkey string) string
- func GetGlobalConfigJSON(confKey, namespace string, obj interface{}) error
- func GetGlobalConfigVal(confKey, namespace string) (string, error)
- func GetGlobalConfigValForObj(confKey string, kind string, object metav1.Object) (string, error)
- func GetRequestID() string
- func HealthCheck(w http.ResponseWriter, r *http.Request)
- func InitFlags(flagset *pflag.FlagSet)
- func InitGlobalKubeConfiger(namespace string, kubeClient clientset.Interface, stopCh <-chan struct{}) error
- func IsInterfaceNil(i interface{}) bool
- func ProxyTo(req *restful.Request, responseWriter http.ResponseWriter, host string) (int, error)
- func QueryParameter(req *http.Request, paramName string) string
- func SetGlobalConfiger(c config.Configer, ns string)
- func TestCallHTTPDecoder(method, uri string, body []byte, headers map[string]string, ...) (interface{}, error)
- func TestCallHTTPJson(method, uri string, body []byte, headers map[string]string, resp interface{}) (interface{}, error)
- func TestCallHTTPPB(method, uri string, body []byte, headers map[string]string, resp proto.Message) (interface{}, error)
- func TestCallHTTPPBInput(method, uri string, body []byte, headers map[string]string, resp interface{}) (interface{}, error)
- type Config
- type HTTPClient
- type JsonMatcher
- type MatchRule
Constants ¶
This section is empty.
Variables ¶
var ( ConfStarAgentSidecar = "staragent-sidecar" ConfInterposeObject = "interpose" ConfSkylineAPI = "skyline-api" ConfSkylineDefault = "skyline-default" // in corev1.Container format ConfSkylineInitContainer = "skyline-container-template" ConfFiberBoxIdMapping = "fiber-box-id-mapping" ConfFiberBox = "fiber-box-config" ConfPoolMetaCopy = "pool-meta-copy" ConfFiberZkRoot = "fiber-zk-root" ConfServerlessTweaks = "serverless-tweaks" ConfRollingsetTweaks = "rollingset-tweaks" ConfProxyCopyLabels = "proxy-copy-labels" ConfVipserverEnvInterpose = "vipserver-env-interpose" ConfNonVersionedKeys = "non-versioned-keys" )
all config keys
var (
// HealthCheckPath HealthCheckPath
HealthCheckPath = "/status.html"
)
Functions ¶
func AddToUniqueSlice ¶
AddToUniqueSlice add a string to slice unique
func CorrecteShellExpr ¶
CorrecteShellExpr CorrecteShellExpr
func DeleteFromSlice ¶
DeleteFromSlice delete a string from slice
func GetBatcherTimeout ¶
GetBatcherTimeout get batcher time out from env / args
func GetEnvWithDefault ¶
GetEnvWithDefault get env if default is nil
func GetGlobalConfigJSON ¶
GetGlobalConfigJSON get json config
func GetGlobalConfigVal ¶
GetGlobalConfigVal get config value, `namespace` is optional
func GetGlobalConfigValForObj ¶
GetGlobalConfigValForObj get interposed object config
func InitGlobalKubeConfiger ¶
func InitGlobalKubeConfiger(namespace string, kubeClient clientset.Interface, stopCh <-chan struct{}) error
InitGlobalKubeConfiger initializes the configer
func ProxyTo ¶
func ProxyTo(req *restful.Request, responseWriter http.ResponseWriter, host string) (int, error)
ProxyTo proxies the request to the host's server directly. It tries its best to keep the origal data from host's server.
func QueryParameter ¶
QueryParameter QueryParameter
func SetGlobalConfiger ¶
SetGlobalConfiger for test only
func TestCallHTTPDecoder ¶
func TestCallHTTPDecoder(method, uri string, body []byte, headers map[string]string, decoder func(rr *httptest.ResponseRecorder) (interface{}, error)) (interface{}, error)
TestCallHTTPDecoder test func
func TestCallHTTPJson ¶
func TestCallHTTPJson(method, uri string, body []byte, headers map[string]string, resp interface{}) (interface{}, error)
TestCallHTTPJson test func
Types ¶
type Config ¶
type Config struct { MatchRule MatchRule `json:"matchRule,omitempty"` Data json.RawMessage `json:"data,omitempty"` }
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient is
func NewWithHTTPClient ¶
func NewWithHTTPClient(client *http.Client) *HTTPClient
NewWithHTTPClient create with http client
type JsonMatcher ¶
type JsonMatcher struct {
// contains filtered or unexported fields
}
matcher for gomock
func NewJSONMatcher ¶
func NewJSONMatcher(b []byte, obj interface{}) *JsonMatcher
func (*JsonMatcher) Matches ¶
func (m *JsonMatcher) Matches(x interface{}) bool
func (*JsonMatcher) String ¶
func (m *JsonMatcher) String() string