This pull request implements the following upcoming breaking changes for the VM Placement GA:
AffinityType -> PlacementGroupType
IsStrict -> PlacementGroupPolicy
NOTE: We will need communication around this breaking change in the release notes.
✔️ How to Test
The following test steps assume you have pulled down this PR locally and have pointed your local environment at an API instance where PGs are available:
export LINODE_URL=...
export LINODE_TOKEN=...
Integration Testing
make ARGS="-run TestPlacementGroup TestInstance_withPG" fixtures
Manual Testing
In a linodego sandbox environment (e.g. dx-devenv), run the following:
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/linode/linodego"
)
const targetRegion = "eu-west"
func main() {
ctx := context.Background()
client := linodego.NewClient(nil)
client.SetToken(os.Getenv("LINODE_TOKEN"))
// Create a PG
pg, err := client.CreatePlacementGroup(ctx, linodego.PlacementGroupCreateOptions{
Label: "test-pg",
Region: targetRegion,
PlacementGroupType: linodego.PlacementGroupTypeAntiAffinityLocal,
PlacementGroupPolicy: linodego.PlacementGroupPolicyStrict,
})
if err != nil {
log.Fatal(err)
}
// Provision two instances assigned to the PG
compliantOnly := true
for i := 0; i < 2; i++ {
_, err := client.CreateInstance(ctx, linodego.InstanceCreateOptions{
Region: targetRegion,
Type: "g6-nanode-1",
Label: fmt.Sprintf("test-instance-%d", i),
PlacementGroup: &linodego.InstanceCreatePlacementGroupOptions{
ID: pg.ID,
CompliantOnly: &compliantOnly,
},
})
if err != nil {
log.Fatal(err)
}
}
}
Navigate to Cloud Manager and ensure a new Placement Group has been created with two instances assigned to it.
Modify this code with update logic, assignment logic, etc.
Re-run the file and ensure everything works as expected.
📝 Description
This pull request implements the following upcoming breaking changes for the VM Placement GA:
NOTE: We will need communication around this breaking change in the release notes.
✔️ How to Test
The following test steps assume you have pulled down this PR locally and have pointed your local environment at an API instance where PGs are available:
Integration Testing
Manual Testing