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
6 changes: 3 additions & 3 deletions pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
ibmcloudprovider "github.com/openshift/cluster-api-provider-ibmcloud/pkg/apis/ibmcloudprovider/v1beta1"
libvirtprovider "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1beta1"
ovirtprovider "github.com/openshift/cluster-api-provider-ovirt/pkg/apis/ovirtprovider/v1beta1"
vsphereprovider "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsprovider/v1beta1"
azureprovider "sigs.k8s.io/cluster-api-provider-azure/pkg/apis/azureprovider/v1beta1"

configv1 "github.com/openshift/api/config/v1"
machinev1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/ignition"
"github.com/openshift/installer/pkg/asset/ignition/bootstrap"
Expand Down Expand Up @@ -612,9 +612,9 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
if err != nil {
return err
}
controlPlaneConfigs := make([]*vsphereprovider.VSphereMachineProviderSpec, len(controlPlanes))
controlPlaneConfigs := make([]*machinev1.VSphereMachineProviderSpec, len(controlPlanes))
for i, c := range controlPlanes {
controlPlaneConfigs[i] = c.Spec.ProviderSpec.Value.Object.(*vsphereprovider.VSphereMachineProviderSpec)
controlPlaneConfigs[i] = c.Spec.ProviderSpec.Value.Object.(*machinev1.VSphereMachineProviderSpec)
}

// Set this flag to use an existing folder specified in the install-config. Otherwise, create one.
Expand Down
10 changes: 6 additions & 4 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
libvirtprovider "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1beta1"
ovirtproviderapi "github.com/openshift/cluster-api-provider-ovirt/pkg/apis"
ovirtprovider "github.com/openshift/cluster-api-provider-ovirt/pkg/apis/ovirtprovider/v1beta1"
vsphereapi "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider"
vsphereprovider "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -544,7 +542,11 @@ func (m *Master) Machines() ([]machineapi.Machine, error) {
libvirtapi.AddToScheme(scheme)
openstackapi.AddToScheme(scheme)
ovirtproviderapi.AddToScheme(scheme)
vsphereapi.AddToScheme(scheme)
// Add vsphere types to scheme
scheme.AddKnownTypes(machineapi.SchemeGroupVersion,
&machineapi.VSphereMachineProviderSpec{},
)
machineapi.AddToScheme(scheme)
Copy link
Contributor

@staebler staebler Nov 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an adequate replacement. The scheme from github.com/openshift/api/machine/v1beta1 does not include the provider specs [1]. If we want to use the types defined in openshift/api, then we will need to manual add the vSphere provider spec to the scheme.

[1] https://github.com/openshift/api/blob/be1be0e89115702f8b508d351c4f5c9a16e5ae95/machine/v1beta1/register.go#L34-L41

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I was aware of the CI failure and was looking for a solution for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the vspherespec into scheme.

decoder := serializer.NewCodecFactory(scheme).UniversalDecoder(
alibabacloudprovider.SchemeGroupVersion,
awsprovider.SchemeGroupVersion,
Expand All @@ -554,7 +556,7 @@ func (m *Master) Machines() ([]machineapi.Machine, error) {
ibmcloudprovider.SchemeGroupVersion,
libvirtprovider.SchemeGroupVersion,
openstackprovider.SchemeGroupVersion,
vsphereprovider.SchemeGroupVersion,
machineapi.SchemeGroupVersion,
ovirtprovider.SchemeGroupVersion,
)

Expand Down
13 changes: 6 additions & 7 deletions pkg/asset/machines/vsphere/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"

machineapi "github.com/openshift/api/machine/v1beta1"
vsphereapis "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -63,7 +62,7 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine
return machines, nil
}

func provider(clusterID string, platform *vsphere.Platform, mpool *vsphere.MachinePool, osImage string, userDataSecret string) (*vsphereapis.VSphereMachineProviderSpec, error) {
func provider(clusterID string, platform *vsphere.Platform, mpool *vsphere.MachinePool, osImage string, userDataSecret string) (*machineapi.VSphereMachineProviderSpec, error) {
folder := fmt.Sprintf("/%s/vm/%s", platform.Datacenter, clusterID)
resourcePool := fmt.Sprintf("/%s/host/%s/Resources", platform.Datacenter, platform.Cluster)
if platform.Folder != "" {
Expand All @@ -73,22 +72,22 @@ func provider(clusterID string, platform *vsphere.Platform, mpool *vsphere.Machi
resourcePool = platform.ResourcePool
}

return &vsphereapis.VSphereMachineProviderSpec{
return &machineapi.VSphereMachineProviderSpec{
TypeMeta: metav1.TypeMeta{
APIVersion: vsphereapis.SchemeGroupVersion.String(),
APIVersion: machineapi.SchemeGroupVersion.String(),
Kind: "VSphereMachineProviderSpec",
},
UserDataSecret: &corev1.LocalObjectReference{Name: userDataSecret},
CredentialsSecret: &corev1.LocalObjectReference{Name: "vsphere-cloud-credentials"},
Template: osImage,
Network: vsphereapis.NetworkSpec{
Devices: []vsphereapis.NetworkDeviceSpec{
Network: machineapi.NetworkSpec{
Devices: []machineapi.NetworkDeviceSpec{
{
NetworkName: platform.Network,
},
},
},
Workspace: &vsphereapis.Workspace{
Workspace: &machineapi.Workspace{
Server: platform.VCenter,
Datacenter: platform.Datacenter,
Datastore: platform.DefaultDatastore,
Expand Down
10 changes: 6 additions & 4 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
libvirtprovider "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1beta1"
ovirtproviderapi "github.com/openshift/cluster-api-provider-ovirt/pkg/apis"
ovirtprovider "github.com/openshift/cluster-api-provider-ovirt/pkg/apis/ovirtprovider/v1beta1"
vsphereproviderapi "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider"
vsphereprovider "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -547,7 +545,11 @@ func (w *Worker) MachineSets() ([]machineapi.MachineSet, error) {
libvirtapi.AddToScheme(scheme)
openstackapi.AddToScheme(scheme)
ovirtproviderapi.AddToScheme(scheme)
vsphereproviderapi.AddToScheme(scheme)
// Add vsphere types to scheme
scheme.AddKnownTypes(machineapi.SchemeGroupVersion,
&machineapi.VSphereMachineProviderSpec{},
)
machineapi.AddToScheme(scheme)
decoder := serializer.NewCodecFactory(scheme).UniversalDecoder(
alibabacloudprovider.SchemeGroupVersion,
awsprovider.SchemeGroupVersion,
Expand All @@ -558,7 +560,7 @@ func (w *Worker) MachineSets() ([]machineapi.MachineSet, error) {
libvirtprovider.SchemeGroupVersion,
openstackprovider.SchemeGroupVersion,
ovirtprovider.SchemeGroupVersion,
vsphereprovider.SchemeGroupVersion,
machineapi.SchemeGroupVersion,
)

machineSets := []machineapi.MachineSet{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/tfvars/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"strings"

vsphereapis "github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1"
"github.com/pkg/errors"

machineapi "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/installer/pkg/tfvars/internal/cache"
"github.com/openshift/installer/pkg/types/vsphere"
)
Expand All @@ -33,7 +33,7 @@ type config struct {

// TFVarsSources contains the parameters to be converted into Terraform variables
type TFVarsSources struct {
ControlPlaneConfigs []*vsphereapis.VSphereMachineProviderSpec
ControlPlaneConfigs []*machineapi.VSphereMachineProviderSpec
Username string
Password string
Cluster string
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,6 @@ github.com/openshift/library-go/pkg/route/routeapihelpers
## explicit
github.com/openshift/machine-api-operator/pkg/apis/machine
github.com/openshift/machine-api-operator/pkg/apis/machine/v1beta1
github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider
github.com/openshift/machine-api-operator/pkg/apis/vsphereprovider/v1beta1
# github.com/openshift/machine-config-operator v0.0.0 => github.com/openshift/machine-config-operator v0.0.1-0.20201009041932-4fe8559913b8
## explicit
Expand Down