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

Test Instascale machine set functionality #322

Merged

Conversation

Fiona-Waters
Copy link
Contributor

@Fiona-Waters Fiona-Waters commented Oct 6, 2023

Issue link

Closes #323

What changes have been made

An e2e test has been added to test the entire instascale flow on an OCP Cluster - testing machine set functionality.

Verification steps

  • Provision an OCP cluster
  • Install the codeflare stack following the Quick Start.
  • A NodeFeatureDiscovery CR and ClusterPolicy CR are required also. These can be added using the updated makefile - if installing using make all-in-one these should already be present. NFD and ClusterPolicy.
  • Set instascale: enabled: false in the Codeflare Operator config map and deploy Instascale from this image: quay.io/rh_ee_fwaters/instascale-controller:CRtest which uses this PR. Add an Instastale configMap stating a max scale out value like so:
kind: ConfigMap
apiVersion: v1
metadata:
  name: instascale-config
  namespace: instascale-system
data:
  maxScaleoutAllowed: '5'
  • Create a machineSet in the cluster following instructions here. setting the ami id to ami-0624891c612b5eaa0.
  • In your VS code terminal log in to your cluster.
  • Run or Debug the test.

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

test/support/utils.go Outdated Show resolved Hide resolved
@Fiona-Waters Fiona-Waters force-pushed the instascale-machine-sets-e2e branch 5 times, most recently from af0a38e to 85cf71b Compare October 11, 2023 08:23
@Fiona-Waters Fiona-Waters marked this pull request as ready for review October 11, 2023 08:24
@Fiona-Waters Fiona-Waters changed the title [WIP] Test Instascale machine set functionality Test Instascale machine set functionality Oct 11, 2023
Co-authored-by: Karel Suta [email protected]
Co-authored-by: Fiona Waters [email protected]
@Fiona-Waters Fiona-Waters force-pushed the instascale-machine-sets-e2e branch from 85cf71b to aa3026d Compare October 11, 2023 08:26
@Fiona-Waters Fiona-Waters force-pushed the instascale-machine-sets-e2e branch from e8d50c3 to 77e0f91 Compare October 11, 2023 09:38
test/support/machine.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sutaakar sutaakar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

test/e2e/instascale_machineset_test.go Outdated Show resolved Hide resolved

func Machines(t Test, machineSetName string) func(g gomega.Gomega) []machinev1beta1.Machine {
return func(g gomega.Gomega) []machinev1beta1.Machine {
machine, err := t.Client().Machine().MachineV1beta1().Machines("openshift-machine-api").List(t.Ctx(), metav1.ListOptions{LabelSelector: "machine.openshift.io/cluster-api-machineset=" + machineSetName})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK to have openshift-machine-api hard-coded?


func Machines(t Test, machineSetName string) func(g gomega.Gomega) []machinev1beta1.Machine {
return func(g gomega.Gomega) []machinev1beta1.Machine {
machine, err := t.Client().Machine().MachineV1beta1().Machines("openshift-machine-api").List(t.Ctx(), metav1.ListOptions{LabelSelector: "machine.openshift.io/cluster-api-machineset=" + machineSetName})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could passing the label selector as argument instead be useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we can access the machine label easily in the test to pass it in. Could this work, or what would be the benefit of passing it as an argument? maybe it can be one variable instead of 2 also since these shouldn't change.

labelSelectorPrefix = "machine.openshift.io/cluster-api-machineset="
machine, err := t.Client().Machine().MachineV1beta1().Machines(namespaceToList).List(t.Ctx(), metav1.ListOptions{LabelSelector: labelSelectorPrefix + machineSetName})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, probably bette to keep it that way for now.

@openshift-ci openshift-ci bot removed the lgtm label Oct 16, 2023
@Fiona-Waters Fiona-Waters force-pushed the instascale-machine-sets-e2e branch from 7e38eb2 to 93fff91 Compare October 16, 2023 12:26
@Fiona-Waters Fiona-Waters force-pushed the instascale-machine-sets-e2e branch from 93fff91 to ea9ee6a Compare October 16, 2023 12:27
@astefanutti
Copy link
Contributor

/lgtm

@astefanutti
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Oct 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astefanutti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot merged commit ea777c6 into project-codeflare:main Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instascale E2E - Machine Sets
3 participants