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

Clean conductors from db during rescaling #620

Conversation

mrkisaolamb
Copy link
Contributor

No description provided.

@openshift-ci openshift-ci bot requested review from abays and bogdando December 4, 2023 15:37
@openshift-ci openshift-ci bot added the approved label Dec 4, 2023
@mrkisaolamb mrkisaolamb changed the title WIP: Clean conductors from db during rescaling Clean conductors from db during rescaling Dec 8, 2023
@mrkisaolamb mrkisaolamb requested a review from gibizer December 8, 2023 10:39
@@ -446,6 +453,41 @@ func (r *NovaConductorReconciler) ensureDeployment(
return ctrl.Result{}, nil
}

func (r *NovaConductorReconciler) cleanServiceFromNovaDb(
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be generalized now as it only differs from the scheduler one by Binary: "nova-conductor" so that can be passed as a parameter and also the keystoneAuthURL can be taken as a parameter.

Copy link
Contributor Author

@mrkisaolamb mrkisaolamb Dec 8, 2023

Choose a reason for hiding this comment

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

done a68cc8c

condition.DeploymentReadyCondition,
corev1.ConditionTrue,
)
Expect(novaAPIServer.FindRequest("DELETE", "/compute/os-services/3", "")).To(BeTrue())
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that fixture records the query param please assert that the code queried a list of conductor services.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done a68cc8c

Copy link
Contributor

Choose a reason for hiding this comment

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

cool. As a follow up add the same to the schedule test

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/14f8c0fdb2054343b690b3a735ca0290

✔️ nova-operator-content-provider SUCCESS in 2h 26m 29s
✔️ nova-operator-kuttl SUCCESS in 36m 34s
nova-operator-tempest-multinode FAILURE in 2h 07m 00s

@mrkisaolamb mrkisaolamb requested a review from gibizer December 8, 2023 13:22
Copy link
Contributor

@gibizer gibizer left a comment

Choose a reason for hiding this comment

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

I see a list of code cleanup possibilities. I did them in a81aba2 If you like it feel free to squash it in.

condition.DeploymentReadyCondition,
corev1.ConditionTrue,
)
Expect(novaAPIServer.FindRequest("DELETE", "/compute/os-services/3", "")).To(BeTrue())
Copy link
Contributor

Choose a reason for hiding this comment

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

cool. As a follow up add the same to the schedule test

@@ -102,6 +103,35 @@ type conditionsGetter interface {
GetConditions() condition.Conditions
}

func cleanNovaServiceFromNovaDb(ctx context.Context,
h *helper.Helper, authURL string, adminUser string,
authPassword string, timeout time.Duration, l logr.Logger, serviceName string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

timeout parameter is unused and therefore can be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

I would move the ) error { to the next line for readability

func cleanNovaServiceFromNovaDb(ctx context.Context,
h *helper.Helper, authURL string, adminUser string,
authPassword string, timeout time.Duration, l logr.Logger, serviceName string) error {
computeClient, _, err := getNovaClient(ctx, h, authURL, adminUser, authPassword, defaultRequestTimeout, l)
Copy link
Contributor

Choose a reason for hiding this comment

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

  • It seems that the result return value of getNovaClient is unused so that can also be removed.
  • also as far as I see the defaultRequestTimeout is also unused in getNovaClient so the whole constant can be removed

Comment on lines 464 to 465
err := cleanNovaServiceFromNovaDb(ctx, h, instance.Spec.KeystoneAuthURL,
instance.Spec.ServiceUser, authPassword, defaultRequestTimeout, l, "nova-conductor")
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 can express that the authURL and the user name is coming from the same instance with some refactoring and shrink the parameter list.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://review.rdoproject.org/zuul/buildset/24ab078f910d428bb75e62abdf90fa15

✔️ nova-operator-content-provider SUCCESS in 2h 39m 16s
✔️ nova-operator-kuttl SUCCESS in 39m 08s
nova-operator-tempest-multinode FAILURE in 2h 21m 48s

@mrkisaolamb
Copy link
Contributor Author

I see a list of code cleanup possibilities. I did them in a81aba2 If you like it feel free to squash it in.

I cherry-pick commit

@mrkisaolamb mrkisaolamb requested a review from gibizer December 11, 2023 10:11
@mrkisaolamb
Copy link
Contributor Author

/retest

Copy link
Contributor

openshift-ci bot commented Dec 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gibizer, mrkisaolamb

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:
  • OWNERS [gibizer,mrkisaolamb]

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

@openshift-merge-bot openshift-merge-bot bot merged commit 455707a into openstack-k8s-operators:main Dec 12, 2023
2 checks passed
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.

2 participants