Skip to content

Commit 7754826

Browse files
committed
baremetal: add infra provider
1 parent b70e65b commit 7754826

File tree

8 files changed

+975
-4
lines changed

8 files changed

+975
-4
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package baremetal
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
"github.com/openshift/installer/pkg/asset"
8+
"github.com/openshift/installer/pkg/infrastructure"
9+
"github.com/openshift/installer/pkg/types"
10+
)
11+
12+
type Provider struct{}
13+
14+
func InitializeProvider() infrastructure.Provider {
15+
return Provider{}
16+
}
17+
18+
// Provision creates a baremetal platform bootstrap node.
19+
func (a Provider) Provision(ctx context.Context, dir string, parents asset.Parents) ([]*asset.File, error) {
20+
config, err := GetConfig(dir)
21+
if err != nil {
22+
return []*asset.File{}, fmt.Errorf("failed to get baremetal platform config: %v", err)
23+
}
24+
25+
err = createBootstrap(config)
26+
if err != nil {
27+
return []*asset.File{}, fmt.Errorf("failed to create bootstrap: %v", err)
28+
}
29+
30+
return []*asset.File{}, nil
31+
}
32+
33+
func (a Provider) DestroyBootstrap(dir string) error {
34+
config, err := GetConfig(dir)
35+
if err != nil {
36+
return fmt.Errorf("failed to get baremetal platform config: %v", err)
37+
}
38+
err = destroyBootstrap(config)
39+
if err != nil {
40+
return fmt.Errorf("failed to create bootstrap: %v", err)
41+
}
42+
43+
return nil
44+
}
45+
46+
func (a Provider) ExtractHostAddresses(dir string, ic *types.InstallConfig, ha *infrastructure.HostAddresses) error {
47+
ha.Bootstrap = ic.Platform.BareMetal.BootstrapProvisioningIP
48+
49+
masters, err := getMasterAddresses(dir)
50+
if err != nil {
51+
return err
52+
}
53+
54+
ha.Masters = masters
55+
56+
return nil
57+
}

0 commit comments

Comments
 (0)