Skip to content

Commit

Permalink
Pare down types and associated tests (openshift#90)
Browse files Browse the repository at this point in the history
Minimizing what users can specify in the install-config file after we've gotten a better understanding of things. This should minimize things a user could accidentally change, and unnecessary things we need to validate.


Closes https://issues.redhat.com/browse/MULTIARCH-2014
  • Loading branch information
mjturek authored Jan 14, 2022
1 parent cf74d70 commit 1851532
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 425 deletions.
134 changes: 12 additions & 122 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -473,35 +473,16 @@ spec:
description: PowerVS is the configuration used when installing
on IBM Power VS.
properties:
imageID:
description: ImageID defines the ImageID for the instance.
type: string
keypairname:
description: KeyPairName is the name of an SSH key pair
stored in the Power VS Service Instance
type: string
memory:
description: Memory defines the memory in GB for the instance.
type: string
name:
description: Name is the name of the instance
type: string
networkIDs:
description: NetworkIDs defines the network IDs of the instance.
items:
type: string
type: array
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: 'Processors defines the processing units for
the instance. @TODO:'
type: string
serviceinstance:
description: ServiceInstance is Service Instance to install
into.
description: Processors defines the processing units for
the instance.
type: string
sysType:
description: SysType defines the system type for instance.
Expand All @@ -512,14 +493,6 @@ spec:
items:
type: string
type: array
required:
- imageID
- keypairname
- memory
- name
- processors
- serviceinstance
- volumeIDs
type: object
vsphere:
description: VSphere is the configuration used when installing
Expand Down Expand Up @@ -985,35 +958,16 @@ spec:
description: PowerVS is the configuration used when installing
on IBM Power VS.
properties:
imageID:
description: ImageID defines the ImageID for the instance.
type: string
keypairname:
description: KeyPairName is the name of an SSH key pair stored
in the Power VS Service Instance
type: string
memory:
description: Memory defines the memory in GB for the instance.
type: string
name:
description: Name is the name of the instance
type: string
networkIDs:
description: NetworkIDs defines the network IDs of the instance.
items:
type: string
type: array
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: 'Processors defines the processing units for
the instance. @TODO:'
type: string
serviceinstance:
description: ServiceInstance is Service Instance to install
into.
description: Processors defines the processing units for the
instance.
type: string
sysType:
description: SysType defines the system type for instance.
Expand All @@ -1024,14 +978,6 @@ spec:
items:
type: string
type: array
required:
- imageID
- keypairname
- memory
- name
- processors
- serviceinstance
- volumeIDs
type: object
vsphere:
description: VSphere is the configuration used when installing
Expand Down Expand Up @@ -2286,49 +2232,25 @@ spec:
APIKey:
description: APIKey is the API key for the user's IBM Cloud account.
type: string
SSHKeyName:
description: SSHKeyName is the name of an SSH key stored in the
Service Instance.
type: string
clusterOSImage:
description: ClusterOSImage is a URL to override the default OS
image for the bootstrap node. The URL must contain a sha256
hash of the image e.g https://mirror.example.com/images/image.ova.gz?sha256=a07bd...
description: ClusterOSImage is a pre-created Power VS boot image
that overrides the default image for cluster nodes.
type: string
defaultMachinePlatform:
description: DefaultMachinePlatform is the default configuration
used when installing on Power VS for machine pools which do
not define their own platform configuration.
properties:
imageID:
description: ImageID defines the ImageID for the instance.
type: string
keypairname:
description: KeyPairName is the name of an SSH key pair stored
in the Power VS Service Instance
type: string
memory:
description: Memory defines the memory in GB for the instance.
type: string
name:
description: Name is the name of the instance
type: string
networkIDs:
description: NetworkIDs defines the network IDs of the instance.
items:
type: string
type: array
procType:
description: ProcType defines the processor sharing model
for the instance.
type: string
processors:
description: 'Processors defines the processing units for
the instance. @TODO:'
type: string
serviceinstance:
description: ServiceInstance is Service Instance to install
into.
description: Processors defines the processing units for the
instance.
type: string
sysType:
description: SysType defines the system type for instance.
Expand All @@ -2339,38 +2261,14 @@ spec:
items:
type: string
type: array
required:
- imageID
- keypairname
- memory
- name
- processors
- serviceinstance
- volumeIDs
type: object
imageName:
description: "ImageName is equivalent to BootStrap/ClusterOSImage.
Until the machine provider config in cluster-api-provider-powervs
takes an ID instead of a name, we're using this for TF Creation,
and the other two for machine-config. \n @TODO: Remove when
provider resolves ID from name @TODO: make this +optional when
we have TF support"
type: string
powervsResourceGroup:
description: PowerVSResourceGroup is the resource group for creating
Power VS resources.
type: string
pvsNetworkID:
description: "PVSNetworkID is the associated ID for the PVSNetworkName.
This is currently required For the machine config. @TODO: Remove
when machine config resolves the ID from name. Leave unset to
have the installer create the network. \n @TODO: make this +optional
when we have TF support"
type: string
pvsNetworkName:
description: 'PVSNetworkName specifies an existing network within
the Power VS Service Instance. @TODO: make this +optional when
we have TF support'
description: PVSNetworkName specifies an existing network within
the Power VS Service Instance.
type: string
region:
description: Region specifies the IBM Cloud region where the cluster
Expand All @@ -2381,23 +2279,15 @@ spec:
created from the IBM Cloud Catalog
type: string
subnets:
description: "Subnets specifies existing subnets (by ID) where
description: Subnets specifies existing subnets (by ID) where
cluster resources will be created. Leave unset to have the
installer create subnets in a new VPC on your behalf. \n @TODO:
make this +optional when we have TF support"
installer create subnets in a new VPC on your behalf.
items:
type: string
type: array
userID:
description: UserID is the login for the user's IBM Cloud account.
type: string
userTags:
additionalProperties:
type: string
description: UserTags additional keys and values that the installer
will add as tags to all resources that it creates. Resources
created by the cluster itself may not include these tags.
type: object
vpc:
description: VPC is a VPC inside IBM Cloud. Needed in order to
create VPC Load Balancers.
Expand Down
52 changes: 0 additions & 52 deletions pkg/asset/machines/master_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/openshift/installer/pkg/types"
awstypes "github.com/openshift/installer/pkg/types/aws"
"github.com/openshift/installer/pkg/types/baremetal"
powervstypes "github.com/openshift/installer/pkg/types/powervs"
)

func TestMasterGenerateMachineConfigs(t *testing.T) {
Expand Down Expand Up @@ -182,57 +181,6 @@ spec:
}
}

func TestPowerVSMaster(t *testing.T) {
t.Log("Testing powerVS platform master")
parents := asset.Parents{}
parents.Add(
&installconfig.ClusterID{
UUID: "test-uuid",
InfraID: "test-infra-id",
},
&installconfig.InstallConfig{
Config: &types.InstallConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
SSHKey: "dummy ssh key",
BaseDomain: "test-domain",
Platform: types.Platform{
PowerVS: &powervstypes.Platform{},
},
ControlPlane: &types.MachinePool{
Hyperthreading: types.HyperthreadingEnabled,
Replicas: pointer.Int64Ptr(1),
Platform: types.MachinePoolPlatform{
PowerVS: &powervstypes.MachinePool{
ServiceInstance: "dummy-service-instance",
ImageID: "dummy-image-id",
NetworkIDs: []string{"dummy-network"},
KeyPairName: "dummy-keypair",
},
},
},
},
},
(*rhcos.Image)(pointer.StringPtr("test-image")),
&machine.Master{
File: &asset.File{
Filename: "master-ignition",
Data: []byte("test-ignition"),
},
},
)
master := &Master{}
if err := master.Generate(parents); err != nil {
t.Fatalf("failed to generate master machines: %v", err)
}

_, err := master.Machines()
if err != nil {
t.Fatalf("failed to get master machine set: %v", err)
}
}

func TestControlPlaneIsNotModified(t *testing.T) {
parents := asset.Parents{}
installConfig := installconfig.InstallConfig{
Expand Down
49 changes: 0 additions & 49 deletions pkg/asset/machines/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/openshift/installer/pkg/asset/rhcos"
"github.com/openshift/installer/pkg/types"
awstypes "github.com/openshift/installer/pkg/types/aws"
powervstypes "github.com/openshift/installer/pkg/types/powervs"
)

func TestWorkerGenerate(t *testing.T) {
Expand Down Expand Up @@ -234,51 +233,3 @@ func TestComputeIsNotModified(t *testing.T) {
t.Fatalf("compute in the install config has been modified")
}
}

func TestPowerVSWorker(t *testing.T) {
t.Log("Testing Power VS platform worker")
parents := asset.Parents{}
parents.Add(
&installconfig.ClusterID{
UUID: "test-uuid",
InfraID: "test-infra-id",
},
&installconfig.InstallConfig{
Config: &types.InstallConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
SSHKey: "dummy ssh key",
BaseDomain: "test-domain",
Platform: types.Platform{
PowerVS: &powervstypes.Platform{},
},
Compute: []types.MachinePool{
{
Hyperthreading: types.HyperthreadingEnabled,
Replicas: pointer.Int64Ptr(1),
Platform: types.MachinePoolPlatform{
PowerVS: &powervstypes.MachinePool{
ServiceInstance: "dummy-service-instance",
ImageID: "dummy-image-name",
NetworkIDs: []string{"dummy-network"},
KeyPairName: "dummy-keypair",
},
},
},
},
},
},
(*rhcos.Image)(pointer.StringPtr("test-image")),
&machine.Worker{
File: &asset.File{
Filename: "master-ignition",
Data: []byte("test-ignition"),
},
},
)
worker := &Worker{}
if err := worker.Generate(parents); err != nil {
t.Fatalf("failed to generate worker machines: %v", err)
}
}
Loading

0 comments on commit 1851532

Please sign in to comment.