MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / Initialize

Function Initialize

pkg/infrastructure/cluster.go:44–55  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
44func 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.
58func InitializeForTesting(currentInfrastructure Type) {

Callers 2

initFunction · 0.92
initFunction · 0.92

Calls 1

detectFunction · 0.85

Tested by

no test coverage detected