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

OCPCLOUD-2493: Update CAO to add upstream annotations #316

Merged
merged 2 commits into from Mar 28, 2024

Conversation

racheljpg
Copy link
Contributor

Hello! This is a PR to update the CAO to add the upstream scale from zero annotations if it's only the old annotations that are there. Thanks!

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 4, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 4, 2024

@racheljpg: This pull request references OCPCLOUD-2493 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Hello! This is a PR to update the CAO to add the upstream scale from zero annotations if it's only the old annotations that are there. Thanks!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@racheljpg racheljpg force-pushed the upstreamannotations branch 2 times, most recently from 3285a25 to 1b43a09 Compare March 4, 2024 17:41
@racheljpg
Copy link
Contributor Author

/retest

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

changes are looking good, we need some cleanup and more tests

annotationsutil.CpuKeyDeprecated: "1",
},
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we need more test cases here to exercise all the code paths in that function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey Mike, thank you for the feedback. I've added some more test cases to test the other annotations in the SetAnnotations function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also added a second commit to make some changes to commits/names for clarity!

Copy link
Contributor

Choose a reason for hiding this comment

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

these tests are looking great @racheljpg !

}

// test checkscalefromzeroannotations on a new machine
func TestScaleFromZeroAnnotations(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elmiko Do you think it's worth adding this as a test case above to make things neater, or is it fine to leave it out here on it's own?

Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like we are testing the same functionality as above, i would add it as a case there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It actually seems like we are doing what I was trying to test there above on line 389, so I've removed that function entirely :)

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

apologies for the delay on getting back here, this is looking good to me, just a couple minor nits and we can probably merge this.

expectedNewAnnotation: map[string]string{
annotationsutil.GpuCountKey: "1",
annotationsutil.GpuCountKeyDeprecated: "1",
annotationsutil.GpuTypeKey: "1",
Copy link
Contributor

Choose a reason for hiding this comment

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

just to make this a little more realistic, i would change this value to nvidia.com/gpu, that is how it will look in a live cluster.

annotationsutil.CpuKeyDeprecated: "1",
},
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

these tests are looking great @racheljpg !

}

// test checkscalefromzeroannotations on a new machine
func TestScaleFromZeroAnnotations(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems like we are testing the same functionality as above, i would add it as a case there.

@racheljpg
Copy link
Contributor Author

Hello @elmiko, no worries, and thank you. I've changed the value of the GpuTypeKey and removed a redundant test. Thanks!

@racheljpg
Copy link
Contributor Author

racheljpg commented Mar 28, 2024

Hello!
I've tested this manually (thanks @elmiko) and can confirm that the new annotations show up on a MachineSet. :)

apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
  annotations:
    machine.openshift.io/GPU: '0'
    autoscaling.openshift.io/machineautoscaler: openshift-machine-api/worker-us-east-1a
    machine.openshift.io/memoryMb: '16384'
    capacity.cluster-autoscaler.kubernetes.io/gpu-type: nvidia.com/gpu
    capacity.cluster-autoscaler.kubernetes.io/labels: kubernetes.io/arch=amd64
    machine.openshift.io/cluster-api-autoscaler-node-group-min-size: '1'
    capacity.cluster-autoscaler.kubernetes.io/memory: '17179869184'
    capacity.cluster-autoscaler.kubernetes.io/cpu: '4'
    capacity.cluster-autoscaler.kubernetes.io/gpu-count: '0'
    machine.openshift.io/vCPU: '4'
    machine.openshift.io/cluster-api-autoscaler-node-group-max-size: '12'

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2024
Copy link
Contributor

openshift-ci bot commented Mar 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elmiko

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2024
Copy link
Contributor

openshift-ci bot commented Mar 28, 2024

@racheljpg: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 287595b into openshift:master Mar 28, 2024
11 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-cluster-autoscaler-operator-container-v4.16.0-202403281444.p0.g287595b.assembly.stream.el9 for distgit ose-cluster-autoscaler-operator.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants