Skip to content

Commit

Permalink
Add tinav6 and migrate to tinav6
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentBaer committed Oct 10, 2023
1 parent 4e82d52 commit 27fb49e
Show file tree
Hide file tree
Showing 18 changed files with 93 additions and 73 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}
image_id: ${{ secrets.OMI_ID }}
control_plane_vm_type: ${{ secrets.CP_VMTYPE }}
bastion_vm_type: ${{ secrets.BASTION_VMTYPE }}
worker_vm_type: ${{ secrets.WORKER_VMTYPE }}
rke_version: ${{ secrets.RKE_VERSION }}
kubernetes_version: ${{ secrets.KUBERNETES_VERSION }}
- name: Wait Kubernetes control plane is up and running
uses: nick-invision/retry@v2
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}
image_id: ${{ secrets.OMI_ID }}
control_plane_vm_type: ${{ secrets.CP_VMTYPE }}
bastion_vm_type: ${{ secrets.BASTION_VMTYPE }}
worker_vm_type: ${{ secrets.WORKER_VMTYPE }}
rke_version: ${{ secrets.RKE_VERSION }}
kubernetes_version: ${{ secrets.KUBERNETES_VERSION }}
- name: Wait Kubernetes control plane is up and running
uses: nick-invision/retry@v2
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/unit-func-e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ jobs:
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}
image_id: ${{ secrets.OMI_ID }}
control_plane_vm_type: ${{ secrets.CP_VMTYPE }}
bastion_vm_type: ${{ secrets.BASTION_VMTYPE }}
worker_vm_type: ${{ secrets.WORKER_VMTYPE }}
rke_version: ${{ secrets.RKE_VERSION }}
kubernetes_version: ${{ secrets.KUBERNETES_VERSION }}
- name: Wait Kubernetes control plane is up and running
uses: nick-invision/retry@v2
with:
Expand Down Expand Up @@ -236,6 +241,11 @@ jobs:
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}
image_id: ${{ secrets.OMI_ID }}
control_plane_vm_type: ${{ secrets.CP_VMTYPE }}
bastion_vm_type: ${{ secrets.BASTION_VMTYPE }}
worker_vm_type: ${{ secrets.WORKER_VMTYPE }}
rke_version: ${{ secrets.RKE_VERSION }}
kubernetes_version: ${{ secrets.KUBERNETES_VERSION }}
- name: Wait Kubernetes control plane is up and running
uses: nick-invision/retry@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/oscmachine_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func ValidateDeviceName(deviceName string) (string, error) {

// ValidateVmType check that vmType is a valid vmType
func ValidateVmType(vmType string) (string, error) {
isValidateVmType := regexp.MustCompile(`^tinav[1-5].c[0-9]+r[0-9]+p[1-3]$`).MatchString
isValidateVmType := regexp.MustCompile(`^tinav[3-6].c[0-9]+r[0-9]+p[1-3]$`).MatchString
switch {
case isValidateVmType(vmType):
return vmType, nil
Expand Down
12 changes: 6 additions & 6 deletions api/v1beta1/oscmachinetemplate_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestOscMachineTemplate_ValidateCreate(t *testing.T) {
ImageId: "ami-01234567",
KeypairName: "test-webhook",
DeviceName: "/dev/xvdb",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
},
},
},
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestOscMachineTemplate_ValidateUpdate(t *testing.T) {
KeypairName: "test-webhook",
ImageId: "ami-00000000",
DeviceName: "/dev/xvda",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
},
Volumes: []*OscVolume{
{
Expand All @@ -283,7 +283,7 @@ func TestOscMachineTemplate_ValidateUpdate(t *testing.T) {
KeypairName: "test-webhook",
ImageId: "ami-00000000",
DeviceName: "/dev/xvda",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
},
Volumes: []*OscVolume{
{
Expand All @@ -306,7 +306,7 @@ func TestOscMachineTemplate_ValidateUpdate(t *testing.T) {
KeypairName: "test-webhook-1",
ImageId: "ami-00000000",
DeviceName: "/dev/xvda",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
},
},
},
Expand All @@ -316,11 +316,11 @@ func TestOscMachineTemplate_ValidateUpdate(t *testing.T) {
KeypairName: "test-webhook-2",
ImageId: "ami-00000000",
DeviceName: "/dev/xvda",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
},
},
},
expValidateUpdateErr: fmt.Errorf("OscMachineTemplate.infrastructure.cluster.x-k8s.io \"webhook-test\" is invalid: OscMachineTemplate.spec.template.spec: Invalid value: v1beta1.OscMachineTemplate{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"webhook-test\", GenerateName:\"\", Namespace:\"default\", SelfLink:\"\", UID:\"\", ResourceVersion:\"\", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:v1beta1.OscMachineTemplateSpec{Template:v1beta1.OscMachineTemplateResource{ObjectMeta:v1beta1.ObjectMeta{Labels:map[string]string(nil), Annotations:map[string]string(nil)}, Spec:v1beta1.OscMachineSpec{ProviderID:(*string)(nil), Node:v1beta1.OscNode{Vm:v1beta1.OscVm{Name:\"\", ImageId:\"ami-00000000\", KeypairName:\"test-webhook-2\", VmType:\"tinav4.c2r4p2\", VolumeName:\"\", VolumeDeviceName:\"\", DeviceName:\"/dev/xvda\", SubnetName:\"\", RootDisk:v1beta1.OscRootDisk{RootDiskIops:0, RootDiskSize:0, RootDiskType:\"\"}, LoadBalancerName:\"\", PublicIpName:\"\", SubregionName:\"\", PrivateIps:[]v1beta1.OscPrivateIpElement(nil), SecurityGroupNames:[]v1beta1.OscSecurityGroupElement(nil), ResourceId:\"\", Role:\"\", ClusterName:\"\", Replica:0}, Image:v1beta1.OscImage{Name:\"\", ResourceId:\"\"}, Volumes:[]*v1beta1.OscVolume(nil), KeyPair:v1beta1.OscKeypair{Name:\"\", PublicKey:\"\", ResourceId:\"\", ClusterName:\"\", DeleteKeypair:false}, ClusterName:\"\"}}}}, Status:v1beta1.OscMachineTemplateStatus{Capacity:v1.ResourceList(nil), Conditions:v1beta1.Conditions(nil)}}: OscMachineTemplate spec.template.spec field is immutable."),
expValidateUpdateErr: fmt.Errorf("OscMachineTemplate.infrastructure.cluster.x-k8s.io \"webhook-test\" is invalid: OscMachineTemplate.spec.template.spec: Invalid value: v1beta1.OscMachineTemplate{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"webhook-test\", GenerateName:\"\", Namespace:\"default\", SelfLink:\"\", UID:\"\", ResourceVersion:\"\", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:v1beta1.OscMachineTemplateSpec{Template:v1beta1.OscMachineTemplateResource{ObjectMeta:v1beta1.ObjectMeta{Labels:map[string]string(nil), Annotations:map[string]string(nil)}, Spec:v1beta1.OscMachineSpec{ProviderID:(*string)(nil), Node:v1beta1.OscNode{Vm:v1beta1.OscVm{Name:\"\", ImageId:\"ami-00000000\", KeypairName:\"test-webhook-2\", VmType:\"tinav3.c2r4p2\", VolumeName:\"\", VolumeDeviceName:\"\", DeviceName:\"/dev/xvda\", SubnetName:\"\", RootDisk:v1beta1.OscRootDisk{RootDiskIops:0, RootDiskSize:0, RootDiskType:\"\"}, LoadBalancerName:\"\", PublicIpName:\"\", SubregionName:\"\", PrivateIps:[]v1beta1.OscPrivateIpElement(nil), SecurityGroupNames:[]v1beta1.OscSecurityGroupElement(nil), ResourceId:\"\", Role:\"\", ClusterName:\"\", Replica:0}, Image:v1beta1.OscImage{Name:\"\", ResourceId:\"\"}, Volumes:[]*v1beta1.OscVolume(nil), KeyPair:v1beta1.OscKeypair{Name:\"\", PublicKey:\"\", ResourceId:\"\", ClusterName:\"\", DeleteKeypair:false}, ClusterName:\"\"}}}}, Status:v1beta1.OscMachineTemplateStatus{Capacity:v1.ResourceList(nil), Conditions:v1beta1.Conditions(nil)}}: OscMachineTemplate spec.template.spec field is immutable."),
},
}
for _, mtc := range machineTestCases {
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,19 @@ var (
DefaultVmImageId string = "ami-e1a786f1"

DefaultVmKeypairName string = "cluster-api"
DefaultVmType string = "tinav5.c4r8p1"
DefaultVmType string = "tinav3.c4r8p1"
DefaultVmDeviceName string = "/dev/sda1"

DefaultVmBastionImageId string = "ami-bb490c7e"
DefaultVmBastionKeypairName string = "cluster-api"
DefaultVmBastionSubregionName string = "eu-west-2a"

DefaultVmKwName string = "cluster-api-vm-kw"
DefaultVmKwType string = "tinav5.c4r8p1"
DefaultVmKwType string = "tinav3.c4r8p1"
DefaultVmKcpName string = "cluster-api-vm-kcp"
DefaultVmKcpType string = "tinav5.c4r8p1"
DefaultVmKcpType string = "tinav3.c4r8p1"
DefaultVmBastionName string = "cluster-api-vm-bastion"
DefaultVmBastionType string = "tinav5.c2r2p1"
DefaultVmBastionType string = "tinav3.c2r2p1"
DefaultVolumeKcpName string = "cluster-api-volume-kcp"
DefaultVolumeKcpIops int32 = 1000
DefaultVolumeKcpSize int32 = 30
Expand Down
38 changes: 19 additions & 19 deletions controllers/osccluster_bastion_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var (
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -161,7 +161,7 @@ var (
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -237,7 +237,7 @@ var (
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
ResourceId: "i-test-bastion-uid",
PublicIpName: "test-publicip",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestCheckBastionSecurityGroupOscAssociateResourceName(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -503,7 +503,7 @@ func TestCheckBastionSubnetAssociateResourceName(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet@test",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -616,7 +616,7 @@ func TestCheckBastionPublicIpOscAssociateResourceName(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -717,7 +717,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -793,7 +793,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -868,7 +868,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -955,7 +955,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1032,7 +1032,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1107,7 +1107,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1181,7 +1181,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1331,7 +1331,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1406,7 +1406,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2c",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1481,7 +1481,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1556,7 +1556,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -1631,7 +1631,7 @@ func TestCheckBastionFormatParameters(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip@test",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
{
Expand Down Expand Up @@ -2707,7 +2707,7 @@ func TestReconcileDeleteBastionWithoutSpec(t *testing.T) {
},
SubregionName: "eu-west-2a",
SubnetName: "test-subnet",
VmType: "tinav4.c2r4p2",
VmType: "tinav3.c2r4p2",
PublicIpName: "test-publicip",
ResourceId: "i-test-bastion-uid",
SecurityGroupNames: []infrastructurev1beta1.OscSecurityGroupElement{
Expand Down
Loading

0 comments on commit 27fb49e

Please sign in to comment.