Initialize attempts to determine the type of cluster its currently running on (OpenShift or Kubernetes). This function *must* be called before others; otherwise the call will panic.
()
| 42 | // Initialize attempts to determine the type of cluster its currently running on (OpenShift or Kubernetes). This function |
| 43 | // *must* be called before others; otherwise the call will panic. |
| 44 | func Initialize() error { |
| 45 | var err error |
| 46 | current, err = detect() |
| 47 | if err != nil { |
| 48 | return err |
| 49 | } |
| 50 | if current == Unsupported { |
| 51 | return fmt.Errorf("running on unsupported cluster") |
| 52 | } |
| 53 | initialized = true |
| 54 | return nil |
| 55 | } |
| 56 | |
| 57 | // InitializeForTesting is used to mock running on a specific type of cluster (Kubernetes, OpenShift) in testing code. |
| 58 | func InitializeForTesting(currentInfrastructure Type) { |