Skip to content

Commit

Permalink
Merge pull request openshift#1211 from wking/fix-machine-loads
Browse files Browse the repository at this point in the history
pkg/asset/machines: Convert Master to a WriteableAsset
  • Loading branch information
openshift-merge-robot authored Feb 12, 2019
2 parents 6b4ba7f + d983eae commit 0f8e6b8
Show file tree
Hide file tree
Showing 19 changed files with 394 additions and 104 deletions.
29 changes: 21 additions & 8 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 @@ -59,7 +59,7 @@ ignored = [
[[constraint]]
name = "sigs.k8s.io/cluster-api-provider-aws"
source = "https://github.com/openshift/cluster-api-provider-aws.git"
revision = "9a983a5c6c12b27169c57e4c8948cb554e4d6b6c"
revision = "15fe4b4ea5636f8516c238490fc6a85d44161181"

[[constraint]]
name = "github.com/openshift/cluster-api-provider-libvirt"
Expand Down
26 changes: 18 additions & 8 deletions pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/openshift/installer/pkg/types/openstack"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1"
openstackprovider "sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1"
)

Expand Down Expand Up @@ -76,10 +76,8 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
bootstrapIgn := string(bootstrapIgnAsset.Files()[0].Data)
masterIgn := string(masterIgnAsset.Files()[0].Data)

masterCount := len(mastersAsset.Machines)
if mastersAsset.Machines == nil {
masterCount = len(mastersAsset.MachinesDeprecated)
}
masters := mastersAsset.Machines()
masterCount := len(masters)
data, err := tfvars.TFVars(
clusterID.ClusterID,
installConfig.Config.ObjectMeta.Name,
Expand All @@ -105,8 +103,12 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {

switch platform := installConfig.Config.Platform.Name(); platform {
case aws.Name:
masters, err := mastersAsset.StructuredMachines()
if err != nil {
return err
}
data, err = awstfvars.TFVars(
mastersAsset.Machines[0].Spec.ProviderSpec.Value.Object.(*awsprovider.AWSMachineProviderConfig),
masters[0].Spec.ProviderSpec.Value.Object.(*awsprovider.AWSMachineProviderConfig),
)
if err != nil {
return errors.Wrapf(err, "failed to get %s Terraform variables", platform)
Expand All @@ -116,8 +118,12 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
Data: data,
})
case libvirt.Name:
masters, err := mastersAsset.StructuredMachines()
if err != nil {
return err
}
data, err = libvirttfvars.TFVars(
mastersAsset.Machines[0].Spec.ProviderSpec.Value.Object.(*libvirtprovider.LibvirtMachineProviderConfig),
masters[0].Spec.ProviderSpec.Value.Object.(*libvirtprovider.LibvirtMachineProviderConfig),
string(*rhcosImage),
&installConfig.Config.Networking.MachineCIDR.IPNet,
installConfig.Config.Platform.Libvirt.Network.IfName,
Expand All @@ -132,8 +138,12 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
})
case none.Name:
case openstack.Name:
masters, err := mastersAsset.StructuredMachinesDeprecated()
if err != nil {
return err
}
data, err = openstacktfvars.TFVars(
mastersAsset.MachinesDeprecated[0].Spec.ProviderSpec.Value.Object.(*openstackprovider.OpenstackProviderSpec),
masters[0].Spec.ProviderSpec.Value.Object.(*openstackprovider.OpenstackProviderSpec),
installConfig.Config.Platform.OpenStack.Region,
installConfig.Config.Platform.OpenStack.ExternalNetwork,
installConfig.Config.Platform.OpenStack.TrunkSupport,
Expand Down
3 changes: 3 additions & 0 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/openshift/installer/pkg/asset/ignition"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/kubeconfig"
"github.com/openshift/installer/pkg/asset/machines"
"github.com/openshift/installer/pkg/asset/manifests"
"github.com/openshift/installer/pkg/asset/tls"
"github.com/openshift/installer/pkg/types"
Expand Down Expand Up @@ -75,6 +76,7 @@ func (a *Bootstrap) Dependencies() []asset.Asset {
&tls.JournalCertKey{},
&kubeconfig.Admin{},
&kubeconfig.Kubelet{},
&machines.Master{},
&manifests.Manifests{},
&manifests.Openshift{},
}
Expand Down Expand Up @@ -347,6 +349,7 @@ func (a *Bootstrap) addParentFiles(dependencies asset.Parents) {
for _, asset := range []asset.WritableAsset{
&kubeconfig.Admin{},
&kubeconfig.Kubelet{},
&machines.Master{},
&tls.KubeCA{},
&tls.AggregatorCA{},
&tls.EtcdCA{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/machines/aws/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/utils/pointer"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1"
awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1"

"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/aws"
Expand Down
Loading

0 comments on commit 0f8e6b8

Please sign in to comment.