Skip to content
Open
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
14 changes: 7 additions & 7 deletions src/cloud-api-adaptor/test/e2e/common_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func DoTestPodVMwithAnnotationsInvalidInstanceType(t *testing.T, e env.Environme
}
pod := NewPod(E2eNamespace, podName, containerName, imageName, WithCommand([]string{"/bin/sh", "-c", "sleep 3600"}), WithAnnotations(annotationData))
expectedErrorMessage := `requested instance type ("` + expectedType + `") is not part of supported instance types list`
NewTestCase(t, e, "PodVMwithAnnotationsInvalidInstanceType", assert, "Failed to Create PodVM with Annotations Invalid InstanceType").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodFailed).Run()
NewTestCase(t, e, "PodVMwithAnnotationsInvalidInstanceType", assert, "Failed to Create PodVM with Annotations Invalid InstanceType").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodPending).Run()
}

func DoTestPodVMwithAnnotationsLargerMemory(t *testing.T, e env.Environment, assert CloudAssert) {
Expand All @@ -339,24 +339,24 @@ func DoTestPodVMwithAnnotationsLargerMemory(t *testing.T, e env.Environment, ass
imageName := getBusyboxTestImage(t)
annotationData := map[string]string{
"io.katacontainers.config.hypervisor.default_vcpus": "2",
"io.katacontainers.config.hypervisor.default_memory": "18432",
"io.katacontainers.config.hypervisor.default_memory": "22528",
}
pod := NewPod(E2eNamespace, podName, containerName, imageName, WithCommand([]string{"/bin/sh", "-c", "sleep 3600"}), WithAnnotations(annotationData))
expectedErrorMessage := "failed to get instance type based on vCPU and memory annotations: no instance type found for the given vcpus (2) and memory (18432)"
NewTestCase(t, e, "PodVMwithAnnotationsLargerMemory", assert, "Failed to Create PodVM with Annotations Larger Memory").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodFailed).Run()
expectedErrorMessage := "failed to get instance type based on vCPU and memory annotations: no instance type found for the given vcpus (2) and memory (22528)"
NewTestCase(t, e, "PodVMwithAnnotationsLargerMemory", assert, "Failed to Create PodVM with Annotations Larger Memory").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodPending).Run()
}

func DoTestPodVMwithAnnotationsLargerCPU(t *testing.T, e env.Environment, assert CloudAssert) {
podName := "annotations-too-big-cpu"
containerName := "busybox"
imageName := getBusyboxTestImage(t)
annotationData := map[string]string{
"io.katacontainers.config.hypervisor.default_vcpus": "3",
"io.katacontainers.config.hypervisor.default_vcpus": "5",
"io.katacontainers.config.hypervisor.default_memory": "12288",
}
pod := NewPod(E2eNamespace, podName, containerName, imageName, WithCommand([]string{"/bin/sh", "-c", "sleep 3600"}), WithAnnotations(annotationData))
expectedErrorMessage := "no instance type found for the given vcpus (3) and memory (12288)"
NewTestCase(t, e, "PodVMwithAnnotationsLargerCPU", assert, "Failed to Create PodVM with Annotations Larger CPU").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodFailed).Run()
expectedErrorMessage := "no instance type found for the given vcpus (5) and memory (12288)"
NewTestCase(t, e, "PodVMwithAnnotationsLargerCPU", assert, "Failed to Create PodVM with Annotations Larger CPU").WithPod(pod).WithExpectedPodEventError(expectedErrorMessage).WithCustomPodState(v1.PodPending).Run()
}

func DoTestCreatePeerPodContainerWithValidAlternateImage(t *testing.T, e env.Environment, assert CloudAssert, alternateImageName string) {
Expand Down
21 changes: 18 additions & 3 deletions src/cloud-api-adaptor/test/e2e/ibmcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,36 @@ func TestPodVMwithNoAnnotations(t *testing.T) {
assert := IBMCloudAssert{
VPC: pv.IBMCloudProps.VPC,
}
DoTestPodVMwithNoAnnotations(t, testEnv, assert, GetIBMInstanceProfileType("b", "2x8"))
instanceProfile := pv.IBMCloudProps.InstanceProfile
if strings.Contains(instanceProfile, "dc-") {
DoTestPodVMwithNoAnnotations(t, testEnv, assert, "bx3dc-2x10")
} else {
DoTestPodVMwithNoAnnotations(t, testEnv, assert, GetIBMInstanceProfileType("b", "2x8"))
}
}

func TestPodVMwithAnnotationsInstanceType(t *testing.T) {
assert := IBMCloudAssert{
VPC: pv.IBMCloudProps.VPC,
}
DoTestPodVMwithAnnotationsInstanceType(t, testEnv, assert, GetIBMInstanceProfileType("c", "2x4"))
instanceProfile := pv.IBMCloudProps.InstanceProfile
if strings.Contains(instanceProfile, "dc-") {
DoTestPodVMwithAnnotationsInstanceType(t, testEnv, assert, "cx3dc-2x5")
} else {
DoTestPodVMwithAnnotationsInstanceType(t, testEnv, assert, GetIBMInstanceProfileType("c", "2x4"))
}
}

func TestPodVMwithAnnotationsCPUMemory(t *testing.T) {
assert := IBMCloudAssert{
VPC: pv.IBMCloudProps.VPC,
}
DoTestPodVMwithAnnotationsCPUMemory(t, testEnv, assert, GetIBMInstanceProfileType("m", "2x16"))
instanceProfile := pv.IBMCloudProps.InstanceProfile
if strings.Contains(instanceProfile, "dc-") {
DoTestPodVMwithAnnotationsCPUMemory(t, testEnv, assert, "bx3dc-4x20")
} else {
DoTestPodVMwithAnnotationsCPUMemory(t, testEnv, assert, GetIBMInstanceProfileType("m", "2x16"))
}
}

func TestPodVMwithAnnotationsInvalidInstanceType(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,11 @@ func getProfileList() string {
profileList = "bz2-2x8,cz2-2x4,mz2-2x16"
}
} else {
profileList = "bx2-2x8,cx2-2x4,mx2-2x16"

if strings.Contains(IBMCloudProps.InstanceProfile, "dc-") {
profileList = "bx3dc-2x10,cx3dc-2x5,bx3dc-4x20" // Profiles with confidential computing support
} else {
profileList = "bx2-2x8,cx2-2x4,mx2-2x16"
}
}
return profileList
}
Expand Down Expand Up @@ -980,6 +983,7 @@ func (p *IBMCloudProvisioner) GetProperties(ctx context.Context, cfg *envconf.Co
"INITDATA": IBMCloudProps.InitData,
"CLUSTER_ID": IBMCloudProps.ClusterID,
"TAGS": IBMCloudProps.Tags,
"CONTAINER_RUNTIME": IBMCloudProps.ContainerRuntime,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ COS_INSTANCE_ID="crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxx
COS_SERVICE_URL="s3.jp-tok.cloud-object-storage.appdomain.cloud"
# Resource list -> storage -> a cos service -> instances -> an cos service instance -> service credentials -> apikey
COS_APIKEY="${MY_COS_SERVICE_APIKEY}"
# optional, the default is containerd, you can set this value to containerd or crio
CONTAINER_RUNTIME=""
IS_SELF_MANAGED_CLUSTER="no"
# bz2-2x8 | bx2-2x8 | bz2e-2x8
# bz2-2x8 | bx2-2x8 | bz2e-2x8 | bx3dc-2x10
INSTANCE_PROFILE_NAME="bz2-2x8"
# ibmcloud cs versions
KUBE_VERSION="1.26.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type IBMCloudProperties struct {

VPC *vpcv1.VpcV1
ClusterAPI containerv2.Clusters

ContainerRuntime string
}

var IBMCloudProps = &IBMCloudProperties{}
Expand Down Expand Up @@ -103,6 +105,7 @@ func InitIBMCloudProperties(properties map[string]string) error {
VxlanPort: properties["VXLAN_PORT"],
ClusterID: properties["CLUSTER_ID"],
Tags: properties["TAGS"],
ContainerRuntime: properties["CONTAINER_RUNTIME"],
}

if len(IBMCloudProps.IBMCloudProvider) <= 0 {
Expand Down
Loading