如何使用goland调用kubernetes operator

1. 前提条件

假定您已经按照官网文档生成了一个operator的框架。我这里使用的是go module。

1.1 go的信息如下:

jeffreyguan@localhost ~/.kube$ go version                                                                                                                                   2 ↵
go version go1.12.7 darwin/amd64

1.2 项目的路径如下:

1.3 安装goland并配置:

  • Mac上使用快捷键打开项目的配置
    command + ,
  • 对GOPATH, GOROOT, GO Moudle进行配置


  • 找以Run->Edit Configurations,添加以下环境变量
KUBERNETES_CONFIG=/path/to/your/kube/config/file
WATCH_NAMESPACE=default (or any other namespace you like to wath)

1.4 Run main.go file from cmd dir

1.5 参考文档

https://github.com/Dimss/operator-sdk-jetbrain-goland-debugging

猜你喜欢

转载自www.cnblogs.com/double12gzh/p/11367962.html
今日推荐