argo.go 466 B

123456789101112131415161718192021222324252627282930313233
  1. package argo
  2. import "git.sxidc.com/go-tools/argo-api/client"
  3. var clientInstance *client.Client
  4. func Init(kubeConfig string) error {
  5. if clientInstance != nil {
  6. return nil
  7. }
  8. c, err := client.NewClient(kubeConfig)
  9. if err != nil {
  10. return err
  11. }
  12. clientInstance = c
  13. return nil
  14. }
  15. func Destroy() {
  16. if clientInstance == nil {
  17. return
  18. }
  19. client.Destroy(clientInstance)
  20. clientInstance = nil
  21. }
  22. func GetInstance() *client.Client {
  23. return clientInstance
  24. }