remote_daemon_options.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package supervisor // import "github.com/docker/docker/libcontainerd/supervisor"
  2. // WithRemoteAddr sets the external containerd socket to connect to.
  3. func WithRemoteAddr(addr string) DaemonOpt {
  4. return func(r *remote) error {
  5. r.GRPC.Address = addr
  6. return nil
  7. }
  8. }
  9. // WithRemoteAddrUser sets the uid and gid to create the RPC address with
  10. func WithRemoteAddrUser(uid, gid int) DaemonOpt {
  11. return func(r *remote) error {
  12. r.GRPC.UID = uid
  13. r.GRPC.GID = gid
  14. return nil
  15. }
  16. }
  17. // WithLogLevel defines which log level to starts containerd with.
  18. // This only makes sense if WithStartDaemon() was set to true.
  19. func WithLogLevel(lvl string) DaemonOpt {
  20. return func(r *remote) error {
  21. r.Debug.Level = lvl
  22. return nil
  23. }
  24. }
  25. // WithDebugAddress defines at which location the debug GRPC connection
  26. // should be made
  27. func WithDebugAddress(addr string) DaemonOpt {
  28. return func(r *remote) error {
  29. r.Debug.Address = addr
  30. return nil
  31. }
  32. }
  33. // WithMetricsAddress defines at which location the debug GRPC connection
  34. // should be made
  35. func WithMetricsAddress(addr string) DaemonOpt {
  36. return func(r *remote) error {
  37. r.Metrics.Address = addr
  38. return nil
  39. }
  40. }
  41. // WithPlugin allow configuring a containerd plugin
  42. // configuration values passed needs to be quoted if quotes are needed in
  43. // the toml format.
  44. func WithPlugin(name string, conf interface{}) DaemonOpt {
  45. return func(r *remote) error {
  46. r.Plugins[name] = conf
  47. return nil
  48. }
  49. }