Skip to content

Commit 2872205

Browse files
Merge pull request #8160 from honza/remove-terraform-libvirt
METAL-872: Remove terraform libvirt provider
2 parents b70e65b + 9810f30 commit 2872205

40 files changed

+12393
-251
lines changed

data/data/baremetal/OWNERS

Lines changed: 0 additions & 7 deletions
This file was deleted.

data/data/baremetal/bootstrap/README.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

data/data/baremetal/bootstrap/main.tf

Lines changed: 0 additions & 66 deletions
This file was deleted.

data/data/baremetal/variables-baremetal.tf

Lines changed: 0 additions & 14 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ require (
113113
k8s.io/klog v1.0.0
114114
k8s.io/klog/v2 v2.120.1
115115
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
116+
libvirt.org/go/libvirtxml v1.10002.0
116117
sigs.k8s.io/cluster-api v1.6.3
117118
sigs.k8s.io/cluster-api-provider-aws/v2 v2.4.2-0.20240408095607-ad71a542f8b4
118119
sigs.k8s.io/cluster-api-provider-azure v1.14.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,6 +2989,8 @@ k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
29892989
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
29902990
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
29912991
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
2992+
libvirt.org/go/libvirtxml v1.10002.0 h1:6bc7BZcTd/X/RSKc/YE6y5ZpGXoDdhRYuP5qPdB+LzI=
2993+
libvirt.org/go/libvirtxml v1.10002.0/go.mod h1:7Oq2BLDstLr/XtoQD8Fr3mfDNrzlI3utYKySXF2xkng=
29922994
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
29932995
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
29942996
modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
// Provider is the baremetal platform provider.
13+
type Provider struct{}
14+
15+
// InitializeProvider initializes an empty Provider.
16+
func InitializeProvider() infrastructure.Provider {
17+
return Provider{}
18+
}
19+
20+
// Provision creates a baremetal platform bootstrap node.
21+
func (a Provider) Provision(ctx context.Context, dir string, parents asset.Parents) ([]*asset.File, error) {
22+
config, err := getConfig(dir)
23+
if err != nil {
24+
return []*asset.File{}, fmt.Errorf("failed to get baremetal platform config: %w", err)
25+
}
26+
27+
err = createBootstrap(config)
28+
if err != nil {
29+
return []*asset.File{}, fmt.Errorf("failed to create bootstrap: %w", err)
30+
}
31+
32+
return []*asset.File{}, nil
33+
}
34+
35+
// DestroyBootstrap destroys the temporary bootstrap resources.
36+
func (a Provider) DestroyBootstrap(dir string) error {
37+
config, err := getConfig(dir)
38+
if err != nil {
39+
return fmt.Errorf("failed to get baremetal platform config: %w", err)
40+
}
41+
err = destroyBootstrap(config)
42+
if err != nil {
43+
return fmt.Errorf("failed to create bootstrap: %w", err)
44+
}
45+
46+
return nil
47+
}
48+
49+
// ExtractHostAddresses extracts the IPs of the bootstrap and control plane machines.
50+
func (a Provider) ExtractHostAddresses(dir string, ic *types.InstallConfig, ha *infrastructure.HostAddresses) error {
51+
ha.Bootstrap = ic.Platform.BareMetal.BootstrapProvisioningIP
52+
53+
masters, err := getMasterAddresses(dir)
54+
if err != nil {
55+
return err
56+
}
57+
58+
ha.Masters = masters
59+
60+
return nil
61+
}

0 commit comments

Comments
 (0)