Documentation ¶
Index ¶
- Constants
- func RegisterPolicyEngine(name string, engine PolicyEngine) error
- type BaseDto
- type BasePolicy
- func (policy BasePolicy) CreateDefaultConfig(map[string]interface{}) interface{}
- func (policy BasePolicy) GetConfig(gatewayProvider, name, packageId string, zone *orm.GatewayZone, ...) (PolicyDto, error)
- func (policy BasePolicy) GetGatewayAdapter(ctx map[string]interface{}, policyName string) (gatewayAdapter interface{}, gatewayProvider string, err error)
- func (policy BasePolicy) GetGatewayProvider(clusterName string) (string, error)
- func (policy BasePolicy) GetName() string
- func (policy BasePolicy) MergeDiceConfig(map[string]interface{}) (PolicyDto, error)
- func (policy BasePolicy) NeedResetAnnotation(dto PolicyDto) bool
- func (policy BasePolicy) NeedSerialUpdate() bool
- func (policy BasePolicy) NonSwitchUpdateMSEPluginConfig(mseAdapter gateway_providers.GatewayAdapter, ...)
- func (policy BasePolicy) ParseConfig(interface{}, map[string]interface{}) (PolicyConfig, error)
- func (policy *BasePolicy) SetName(name string)
- func (policy BasePolicy) UnmarshalConfig([]byte) (interface{}, error, string)
- type IngressAnnotation
- type IngressController
- type PolicyConfig
- type PolicyDto
- type PolicyEngine
- type ServiceInfo
Constants ¶
View Source
const ( CTX_IDENTIFY = "id" CTX_K8S_CLIENT = "k8s_client" CTX_KONG_ADAPTER = "kong_adapter" CTX_MSE_ADAPTER = "mse_adapter" CTX_ZONE = "zone" CTX_SERVICE_INFO = "service_info" Policy_Engine_Service_Guard = "safety-server-guard" Policy_Engine_Built_in = "built-in" Policy_Engine_WAF = "safety-waf" Policy_Engine_CORS = "cors" Policy_Engine_Custom = "custom" Policy_Engine_IP = "safety-ip" Policy_Engine_Proxy = "proxy" Policy_Engine_SBAC = "sbac" // "sbac" is ServerBasedAccessControl Policy_Engine_CSRF = "safety-csrf" Policy_Category_Basic = "basic" Policy_Category_BuiltIn = "built-in" Policy_Category_Safety = "safety" Policy_Category_Proxy = "proxy" Policy_Category_Auth = "auth" )
Variables ¶
This section is empty.
Functions ¶
func RegisterPolicyEngine ¶
func RegisterPolicyEngine(name string, engine PolicyEngine) error
Types ¶
type BasePolicy ¶
type BasePolicy struct {
PolicyName string
}
func (BasePolicy) CreateDefaultConfig ¶
func (policy BasePolicy) CreateDefaultConfig(map[string]interface{}) interface{}
func (BasePolicy) GetConfig ¶
func (policy BasePolicy) GetConfig(gatewayProvider, name, packageId string, zone *orm.GatewayZone, ctx map[string]interface{}) (PolicyDto, error)
func (BasePolicy) GetGatewayAdapter ¶
func (policy BasePolicy) GetGatewayAdapter(ctx map[string]interface{}, policyName string) (gatewayAdapter interface{}, gatewayProvider string, err error)
func (BasePolicy) GetGatewayProvider ¶
func (policy BasePolicy) GetGatewayProvider(clusterName string) (string, error)
func (BasePolicy) GetName ¶
func (policy BasePolicy) GetName() string
func (BasePolicy) MergeDiceConfig ¶
func (policy BasePolicy) MergeDiceConfig(map[string]interface{}) (PolicyDto, error)
func (BasePolicy) NeedResetAnnotation ¶
func (policy BasePolicy) NeedResetAnnotation(dto PolicyDto) bool
func (BasePolicy) NeedSerialUpdate ¶
func (policy BasePolicy) NeedSerialUpdate() bool
func (BasePolicy) NonSwitchUpdateMSEPluginConfig ¶
func (policy BasePolicy) NonSwitchUpdateMSEPluginConfig(mseAdapter gateway_providers.GatewayAdapter, pluginReq *providerDto.PluginReqDto, zoneName string, msePluginName string)
初创路由或者关闭路由策略(PolicyDto.Switch == false)的时候,都会进入 ParseConfig 的同一段逻辑中, 但: 1. 如果是关闭路由策略,则对应的逻辑里需要清除已经配置的插件策略,一般直接就能处理了,因此进入不了 nonSwitchUpdateMSEPluginConfig() 的逻辑 2. 如果是新建路由,实际上是不需要进行处理的(但网关应用默认策略实际上还是会进入 ParseConfig),此时路由还没被 MSE 网关识别到,但可以延时等待拿到对应的新的路由信息,然后进行类似清除路由对应的策略配置的设置即可,但这个过程不能同步等待,因此异步执行,最多重试3次
func (BasePolicy) ParseConfig ¶
func (policy BasePolicy) ParseConfig(interface{}, map[string]interface{}) (PolicyConfig, error)
func (*BasePolicy) SetName ¶
func (policy *BasePolicy) SetName(name string)
func (BasePolicy) UnmarshalConfig ¶
func (policy BasePolicy) UnmarshalConfig([]byte) (interface{}, error, string)
type IngressAnnotation ¶
type IngressController ¶
type PolicyConfig ¶
type PolicyConfig struct { KongPolicyChange bool IngressAnnotation *IngressAnnotation IngressController *IngressController AnnotationReset bool }
type PolicyEngine ¶
type PolicyEngine interface { GetConfig(string, string, string, *orm.GatewayZone, map[string]interface{}) (PolicyDto, error) MergeDiceConfig(map[string]interface{}) (PolicyDto, error) CreateDefaultConfig(string, map[string]interface{}) PolicyDto ParseConfig(PolicyDto, map[string]interface{}, bool) (PolicyConfig, error) NeedResetAnnotation(PolicyDto) bool UnmarshalConfig([]byte, string) (PolicyDto, error, string) SetName(name string) GetName() string NeedSerialUpdate() bool }
func GetPolicyEngine ¶
func GetPolicyEngine(name string) (PolicyEngine, error)
type ServiceInfo ¶
Click to show internal directories.
Click to hide internal directories.