Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ignored = [

[[constraint]]
name = "github.com/openshift/cluster-api-provider-libvirt"
branch = "master"
revision = "c23986b36a2521cd69ac22d7adb74a22bca9f7aa"

[[constraint]]
name = "github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
})
case libvirt.Name:
data, err = libvirttfvars.TFVars(
mastersAsset.MachinesDeprecated[0].Spec.ProviderSpec.Value.Object.(*libvirtprovider.LibvirtMachineProviderConfig),
mastersAsset.Machines[0].Spec.ProviderSpec.Value.Object.(*libvirtprovider.LibvirtMachineProviderConfig),
string(*rhcosImage),
&installConfig.Config.Networking.MachineCIDR.IPNet,
installConfig.Config.Platform.Libvirt.Network.IfName,
Expand Down
12 changes: 6 additions & 6 deletions pkg/asset/machines/libvirt/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"fmt"

libvirtprovider "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1alpha1"
machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"

"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/libvirt"
)

// Machines returns a list of machines for a machinepool.
func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]clusterapi.Machine, error) {
func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]machineapi.Machine, error) {
if configPlatform := config.Platform.Name(); configPlatform != libvirt.Name {
return nil, fmt.Errorf("non-Libvirt configuration: %q", configPlatform)
}
Expand All @@ -29,9 +29,9 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine
total = *pool.Replicas
}
provider := provider(clustername, config.Networking.MachineCIDR.String(), platform, userDataSecret)
var machines []clusterapi.Machine
var machines []machineapi.Machine
for idx := int64(0); idx < total; idx++ {
machine := clusterapi.Machine{
machine := machineapi.Machine{
TypeMeta: metav1.TypeMeta{
APIVersion: "cluster.k8s.io/v1alpha1",
Kind: "Machine",
Expand All @@ -45,8 +45,8 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine
"sigs.k8s.io/cluster-api-machine-type": role,
},
},
Spec: clusterapi.MachineSpec{
ProviderSpec: clusterapi.ProviderSpec{
Spec: machineapi.MachineSpec{
ProviderSpec: machineapi.ProviderSpec{
Value: &runtime.RawExtension{Object: provider},
},
// we don't need to set Versions, because we control those via cluster operators.
Expand Down
16 changes: 8 additions & 8 deletions pkg/asset/machines/libvirt/machinesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ package libvirt
import (
"fmt"

machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"

"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/libvirt"
)

// MachineSets returns a list of machinesets for a machinepool.
func MachineSets(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]clusterapi.MachineSet, error) {
func MachineSets(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]machineapi.MachineSet, error) {
if configPlatform := config.Platform.Name(); configPlatform != libvirt.Name {
return nil, fmt.Errorf("non-Libvirt configuration: %q", configPlatform)
}
Expand All @@ -34,7 +34,7 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach

provider := provider(clustername, config.Networking.MachineCIDR.String(), platform, userDataSecret)
name := fmt.Sprintf("%s-%s-%d", clustername, pool.Name, 0)
mset := clusterapi.MachineSet{
mset := machineapi.MachineSet{
TypeMeta: metav1.TypeMeta{
APIVersion: "cluster.k8s.io/v1alpha1",
Kind: "MachineSet",
Expand All @@ -48,15 +48,15 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach
"sigs.k8s.io/cluster-api-machine-type": role,
},
},
Spec: clusterapi.MachineSetSpec{
Spec: machineapi.MachineSetSpec{
Replicas: pointer.Int32Ptr(int32(total)),
Selector: metav1.LabelSelector{
MatchLabels: map[string]string{
"sigs.k8s.io/cluster-api-machineset": name,
"sigs.k8s.io/cluster-api-cluster": clustername,
},
},
Template: clusterapi.MachineTemplateSpec{
Template: machineapi.MachineTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"sigs.k8s.io/cluster-api-machineset": name,
Expand All @@ -65,8 +65,8 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach
"sigs.k8s.io/cluster-api-machine-type": role,
},
},
Spec: clusterapi.MachineSpec{
ProviderSpec: clusterapi.ProviderSpec{
Spec: machineapi.MachineSpec{
ProviderSpec: machineapi.ProviderSpec{
Value: &runtime.RawExtension{Object: provider},
},
// we don't need to set Versions, because we control those via cluster operators.
Expand All @@ -75,5 +75,5 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach
},
}

return []clusterapi.MachineSet{mset}, nil
return []machineapi.MachineSet{mset}, nil
}
2 changes: 1 addition & 1 deletion pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *Master) Generate(dependencies asset.Parents) error {
mpool.Set(ic.Platform.Libvirt.DefaultMachinePlatform)
mpool.Set(pool.Platform.Libvirt)
pool.Platform.Libvirt = &mpool
m.MachinesDeprecated, err = libvirt.Machines(clusterID.ClusterID, ic, &pool, "master", "master-user-data")
m.Machines, err = libvirt.Machines(clusterID.ClusterID, ic, &pool, "master", "master-user-data")
if err != nil {
return errors.Wrap(err, "failed to create master machine objects")
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
return errors.Wrap(err, "failed to create worker machine objects")
}

list := listFromMachineDeprecated(sets)
list := listFromMachineSets(sets)
raw, err := yaml.Marshal(list)
if err != nil {
return errors.Wrap(err, "failed to marshal")
Expand All @@ -147,7 +147,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
return errors.Wrap(err, "failed to create master machine objects")
}

list := listFromMachineDeprecated(sets)
list := listFromMachineSetsDeprecated(sets)
w.MachineSetRaw, err = yaml.Marshal(list)
if err != nil {
return errors.Wrap(err, "failed to marshal")
Expand Down Expand Up @@ -188,7 +188,7 @@ func listFromMachineSets(objs []machineapi.MachineSet) *metav1.List {
return list
}

func listFromMachineDeprecated(objs []clusterapi.MachineSet) *metav1.List {
func listFromMachineSetsDeprecated(objs []clusterapi.MachineSet) *metav1.List {
list := &metav1.List{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading