Documentation
¶
Index ¶
- Constants
- func LoadConfig(cfg string, defaultName string)
- func RequestShutdown() bool
- func ServeHealthCheck(healthPath string, healthAddress string)
- func SetupSignalHandler() <-chan struct{}
- type CertKey
- type CompletedConfig
- type Config
- type GenericAPIServer
- type InsecureServingInfo
- type JwtInfo
- type SecureServingInfo
Constants ¶
const ( // RecommendedHomeDir defines the default directory used to place all iam service configurations. RecommendedHomeDir = ".iam" // RecommendedEnvPrefix defines the ENV prefix used by all iam service. RecommendedEnvPrefix = "iam" )
Variables ¶
This section is empty.
Functions ¶
func RequestShutdown ¶
func RequestShutdown() bool
RequestShutdown 模拟接收到的作为关机信号的事件(SIGTERM/SIGINT) 返回是否通知了处理程序。
func ServeHealthCheck ¶
ServeHealthCheck 运行一个http服务器,用来提供一个api来检查泵的健康状态。
func SetupSignalHandler ¶
func SetupSignalHandler() <-chan struct{}
SetupSignalHandler 注册SIGTERM和SIGINT。返回一个停止通道 在其中一个信号时关闭。如果捕捉到第二个信号,程序就停止运行 以退出码1结束。
Types ¶
type CertKey ¶
type CertKey struct {
// CertFile 是一个包含pem编码证书的文件,可能包含完整的证书链
CertFile string
// KeyFile 是一个包含pem编码的证书私钥的文件,由CertFile指定
KeyFile string
}
CertKey 包含证书相关的配置项。
type CompletedConfig ¶
type CompletedConfig struct {
*Config
}
CompletedConfig 是GenericAPIServer的完整配置。
func (CompletedConfig) New ¶
func (c CompletedConfig) New() (*GenericAPIServer, error)
New 从给定的配置返回一个GenericAPIServer的新实例。
type Config ¶
type Config struct {
SecureServing *SecureServingInfo
InsecureServing *InsecureServingInfo
Jwt *JwtInfo
Mode string
Middlewares []string
Healthz bool
EnableProfiling bool
EnableMetrics bool
}
Config 是一个用于配置genericapisserver的结构。 它的成员大致按组件的重要性排序。
func (*Config) Complete ¶
func (c *Config) Complete() CompletedConfig
Complete 完整填写任何未设置的字段,这些字段需要有有效的数据,并且可以派生 从其他字段。如果你要去ApplyOptions,先做那个。它让接收器发生变异。
type GenericAPIServer ¶
type GenericAPIServer struct {
// SecureServingInfo holds configuration of the TLS logicServer.
SecureServingInfo *SecureServingInfo
// InsecureServingInfo holds configuration of the insecure HTTP logicServer.
InsecureServingInfo *InsecureServingInfo
// ShutdownTimeout is the timeout used for logicServer shutdown. This specifies the timeout before logicServer
// gracefully shutdown returns.
ShutdownTimeout time.Duration
*gin.Engine
// contains filtered or unexported fields
}
GenericAPIServer 包含iam api服务器的状态。 输入genericapisserver gin.Engine。
func (*GenericAPIServer) InstallAPIs ¶
func (s *GenericAPIServer) InstallAPIs()
InstallAPIs install generic apis.
func (*GenericAPIServer) InstallMiddlewares ¶
func (s *GenericAPIServer) InstallMiddlewares()
InstallMiddlewares install generic middlewares.
func (*GenericAPIServer) Run ¶
func (s *GenericAPIServer) Run() error
Run spawns the http logicServer. It only returns when the port cannot be listened on initially.
func (*GenericAPIServer) Setup ¶
func (s *GenericAPIServer) Setup()
Setup do some setup work for gin engine.
type InsecureServingInfo ¶
type InsecureServingInfo struct {
Address string
}
InsecureServingInfo 保存不安全http服务器的配置。
type JwtInfo ¶
type JwtInfo struct {
// defaults to "iam jwt"
Realm string
// defaults to empty
Key string
// defaults to one hour
Timeout time.Duration
// defaults to zero
MaxRefresh time.Duration
}
JwtInfo 定义用于创建jwt认证中间件的jwt字段。
type SecureServingInfo ¶
SecureServingInfo 保存TLS服务器的配置。
func (*SecureServingInfo) Address ¶
func (s *SecureServingInfo) Address() string
Address 将主机IP地址和端口号组合成一个地址字符串,如:0.0.0.0:8443。