Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐾 Add selectedInstanceType flag to the plan #1017

Open
liranr23 opened this issue Mar 24, 2024 · 7 comments
Open

🐾 Add selectedInstanceType flag to the plan #1017

liranr23 opened this issue Mar 24, 2024 · 7 comments
Assignees
Labels
enhancement Categorizes issue or PR as related to a new feature.
Milestone

Comments

@liranr23
Copy link
Member

liranr23 commented Mar 24, 2024

We are going to add a new feature in https://issues.redhat.com/browse/MTV-919, to allow the setting an instance type to the plan.
In order to do that, the user needs to specify he wish to preserve it by setting it within the plan:
selectedInstanceType=

e.g the plan will look like:

kind: Plan
metadata:
  annotations:
    populatorLabels: 'True'
  creationTimestamp: '2024-01-02T15:15:51Z'
  generation: 1
  name: testcluster
  namespace: konveyor-forklift
  resourceVersion: '7403505'
  uid: 53e13421-6590-49d9-84b0-735abf98e738
spec:
  archived: false
  description: ''
  map:
    network:
      name: testcluster-xzklj
      namespace: konveyor-forklift
    storage:
      name: testcluster-lmqbt
      namespace: konveyor-forklift
  selectedInstanceType: u1.medium
  provider:
    destination:
      name: host
      namespace: konveyor-forklift
    source:
      name: ovirt
      namespace: konveyor-forklift
  targetNamespace: konveyor-forklift
  vms:
    - hooks: []
      id: 41f2988a-a579-40a8-ab25-4584b1f696dc
  warm: false

where you can see the new flag under the spec (like warm migrations).
The field is optional, but to select using the feature is must be there and set to requested instance type.
In the UI a drop down list in order to use it will be the best option to the users, but in order to do so you will need to query both VirtualMachineInstancetype from the destination cluster namespace and VirtualMachineClusterInstancetype.
If that's too difficult, maybe a text box will be enough.
The backend part is still WIP.

@yaacov yaacov added this to the 2.7.0 milestone Mar 24, 2024
@yaacov yaacov added the enhancement Categorizes issue or PR as related to a new feature. label Mar 24, 2024
@yaacov yaacov changed the title Add selectedInstanceType flag to the plan 🐾 Add selectedInstanceType flag to the plan Mar 24, 2024
@yaacov
Copy link
Member

yaacov commented Mar 24, 2024

but in order to do so you will need to query both VirtualMachineInstancetype from the destination cluster namespace and VirtualMachineClusterInstancetype.
If that's too difficult, maybe a text box will be enough.

If the inventory will add an /instancetypes endpoint it will be possible.

like we do for networks:
https://github.com/kubev2v/forklift/blob/a4ce2e8dcfe3a083654c2b68581efc88e2d34167/pkg/controller/provider/web/ocp/netattachdefinition.go#L18

cc:// @ahadas

@ahadas
Copy link
Member

ahadas commented Mar 24, 2024

but in order to do so you will need to query both VirtualMachineInstancetype from the destination cluster namespace and VirtualMachineClusterInstancetype.
If that's too difficult, maybe a text box will be enough.

If the inventory will add an /instancetypes endpoint it will be possible.

like we do for networks: https://github.com/kubev2v/forklift/blob/a4ce2e8dcfe3a083654c2b68581efc88e2d34167/pkg/controller/provider/web/ocp/netattachdefinition.go#L18

cc:// @ahadas

+1
makes sense, it better not be a free text field

@liranr23
Copy link
Member Author

liranr23 commented Apr 1, 2024

Once kubev2v/forklift#824 will go in you can query like this:
https://<inventory-url>/providers/openshift/<provider-id>/clusterinstancetypes/?detail=1
for namespace specific (most likely user made):
https://<inventory-url>/providers/openshift/<provider-id>/instancetypes/?detail=1

you can also do single get using:
https://<inventory-url>/providers/openshift/<provider-id>/clusterinstancetypes/<clusterinstancetype-id>?detail=1

an example of a response of single get (https://<inventory-url>/providers/openshift/d1284344-be63-4c88-8d05-c067b09cce42/clusterinstancetypes/2bb1bc4b-2990-4953-8083-9a0a8db2e693?detail=1):

{
  "uid": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
  "version": "41620",
  "namespace": "",
  "name": "u1.nano",
  "selfLink": "providers/openshift/d1284344-be63-4c88-8d05-c067b09cce42/clusterinstancetypes/:clusterinstancetype",
  "id": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
  "object": {
    "kind": "VirtualMachineClusterInstancetype",
    "apiVersion": "instancetype.kubevirt.io/v1beta1",
    "metadata": {
      "name": "u1.nano",
      "uid": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
      "resourceVersion": "41620",
      "generation": 1,
      "creationTimestamp": "2024-03-31T16:09:25Z",
      "labels": {
        "app.kubernetes.io/component": "templating",
        "app.kubernetes.io/managed-by": "ssp-operator",
        "app.kubernetes.io/name": "common-instancetypes",
        "app.kubernetes.io/part-of": "hyperconverged-cluster",
        "app.kubernetes.io/version": "4.14.4",
        "instancetype.kubevirt.io/common-instancetypes-version": "v0.3.5",
        "instancetype.kubevirt.io/cpu": "1",
        "instancetype.kubevirt.io/memory": "512Mi",
        "instancetype.kubevirt.io/vendor": "redhat.com"
      },
      "annotations": {
        "instancetype.kubevirt.io/class": "General Purpose",
        "instancetype.kubevirt.io/description": "The U Series is quite neutral and provides resources for\ngeneral purpose applications.\n\n*U* is the abbreviation for \"Universal\", hinting at the universal\nattitude towards workloads.\n\nVMs of instance types will share physical CPU cores on a\ntime-slice basis with other VMs.",
        "instancetype.kubevirt.io/version": "1",
        "openshift.io/documentation-url": "https://access.redhat.com",
        "openshift.io/provider-display-name": "Red Hat",
        "openshift.io/support-url": "https://access.redhat.com",
        "operator-sdk/primary-resource": "openshift-cnv/ssp-kubevirt-hyperconverged",
        "operator-sdk/primary-resource-type": "SSP.ssp.kubevirt.io"
      },
      "managedFields": [
        {
          "manager": "manager",
          "operation": "Update",
          "apiVersion": "instancetype.kubevirt.io/v1beta1",
          "time": "2024-03-31T16:09:25Z",
          "fieldsType": "FieldsV1",
          "fieldsV1": {
            "f:metadata": {
              "f:annotations": {
                ".": {},
                "f:instancetype.kubevirt.io/class": {},
                "f:instancetype.kubevirt.io/description": {},
                "f:instancetype.kubevirt.io/version": {},
                "f:openshift.io/documentation-url": {},
                "f:openshift.io/provider-display-name": {},
                "f:openshift.io/support-url": {},
                "f:operator-sdk/primary-resource": {},
                "f:operator-sdk/primary-resource-type": {}
              },
              "f:labels": {
                ".": {},
                "f:app.kubernetes.io/component": {},
                "f:app.kubernetes.io/managed-by": {},
                "f:app.kubernetes.io/name": {},
                "f:app.kubernetes.io/part-of": {},
                "f:app.kubernetes.io/version": {},
                "f:instancetype.kubevirt.io/common-instancetypes-version": {},
                "f:instancetype.kubevirt.io/cpu": {},
                "f:instancetype.kubevirt.io/memory": {},
                "f:instancetype.kubevirt.io/vendor": {}
              }
            },
            "f:spec": {
              ".": {},
              "f:cpu": {
                ".": {},
                "f:guest": {}
              },
              "f:memory": {
                ".": {},
                "f:guest": {}
              }
            }
          }
        }
      ]
    },
    "spec": {
      "cpu": {
        "guest": 1
      },
      "memory": {
        "guest": "512Mi"
      }
    }
  }
}

@yaacov
Copy link
Member

yaacov commented Apr 2, 2024

Note:
this also affect the "Calculated resources VMs migration plan will consume on target cluster"

@yaacov
Copy link
Member

yaacov commented Apr 11, 2024

Copy link

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label Aug 10, 2024
@yaacov yaacov removed the Stale label Aug 11, 2024
@fabiand
Copy link

fabiand commented Sep 12, 2024

let's not merge this for 2.7, let's merge this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

5 participants