微信开发中 ACCESS TOKEN 过期失效的解决方案详解
736
2022-10-21
kubectl源码分析之config current-context
istio多集群探秘,部署了50次多集群后我得出的结论
istio多集群链路追踪,附实操视频
istio防故障利器,你知道几个,istio新手不要读,太难!
istio业务权限控制,原来可以这么玩
istio实现非侵入压缩,微服务之间如何实现压缩
不懂envoyfilter也敢说精通istio系列-filter-再也不用再代码里写csrf逻辑了
不懂envoyfilter也敢说精通istio系列filter
不懂envoyfilter也敢说精通istio系列-network filter-redis proxy
不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager
不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册
———————————————
type CurrentContextOptions struct {//current-context结构体 ConfigAccess clientcmd.ConfigAccess}
//创建current-context命令func NewCmdConfigCurrentContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { options := &CurrentContextOptions{ConfigAccess: configAccess}//初始化结构体 cmd := &cobra.Command{//创建cobra命令 Use: "current-context", Short: i18n.T("Displays the current-context"), Long: currentContextLong, Example: currentContextExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(RunCurrentContext(out, options))//运行 }, } return cmd}
//运行func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error { config, err := options.ConfigAccess.GetStartingConfig()//加载config if err != nil { return err } if config.CurrentContext == "" {// 如果currentContext为空则报错 err = fmt.Errorf("current-context is not set") return err } fmt.Fprintf(out, "%s\n", config.CurrentContext)//打印currentContext return nil}
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~