NewManager returns a Manager that interacts with the Kubernetes API of config. When config is nil, it reads from KUBECONFIG or the local service account. When options.Scheme is nil, it uses the Scheme from this package.
(config *rest.Config, options manager.Options)
| 51 | // When config is nil, it reads from KUBECONFIG or the local service account. |
| 52 | // When options.Scheme is nil, it uses the Scheme from this package. |
| 53 | func NewManager(config *rest.Config, options manager.Options) (manager.Manager, error) { |
| 54 | var m manager.Manager |
| 55 | var err error |
| 56 | |
| 57 | if config == nil { |
| 58 | config, err = GetConfig() |
| 59 | } |
| 60 | |
| 61 | if options.Scheme == nil { |
| 62 | options.Scheme = Scheme |
| 63 | } |
| 64 | |
| 65 | if err == nil { |
| 66 | m, err = manager.New(config, options) |
| 67 | } |
| 68 | |
| 69 | return m, err |
| 70 | } |
| 71 | |
| 72 | // SetLogger assigns the default Logger used by [sigs.k8s.io/controller-runtime]. |
| 73 | func SetLogger(logger logging.Logger) { log.SetLogger(logger) } |