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

Populate machineset status #180

Merged
merged 1 commit into from
May 21, 2018
Merged

Conversation

k4leung4
Copy link
Contributor

This PR was split off from PR #165 to make it a smaller PR.
There are edge cases that will be implemented in a separate PR.

@kubernetes/kube-deploy-reviewers

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 16, 2018
@k8s-ci-robot
Copy link
Contributor

Hi @k4leung4. Thanks for your PR.

I'm waiting for a kubernetes or kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 16, 2018
@k4leung4
Copy link
Contributor Author

/assign @jessicaochen

listers "sigs.k8s.io/cluster-api/pkg/client/listers_generated/cluster/v1alpha1"
"sigs.k8s.io/cluster-api/pkg/controller/sharedinformers"
)

const (
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this const belongs in the status file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved.

return updatedMS, nil
}
// Stop retrying if we exceed statusUpdateRetries - the machineSet will be requeued with a rate limit.
if i >= statusUpdateRetries {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a retry test? ie. first time fails, second time works?

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.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 17, 2018
// Always updates status as machines come up or die.
_, err = updateMachineSetStatus(c.clusterAPIClient.ClusterV1alpha1().MachineSets(machineSet.Namespace), machineSet, newStatus)
if err != nil {
return fmt.Errorf("failed to update machine set status, %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

recommend replacing the "," with a ":" as it signifies the error is the reason for why we "failed to update". Also it matches the general style of errors in this project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

return c.syncReplicas(machineSet, filteredMachines)
syncErr := c.syncReplicas(machineSet, filteredMachines)

ms := machineSet.DeepCopy()
Copy link
Contributor

Choose a reason for hiding this comment

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

Two questions:

  1. Why is it OK for the code below to continue if syncErr contains an error?
  2. Given The clife_ prefix to the repo name is no longer required #1 above, we can reach line 85 with syncErr populated with an error value. Given In the case of an error on line 85, will cause us to reach line 87 why is it OK that we could potentially lose an error value in "syncErr".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason to continue is ensure the MachineSet Status that contains the number of replicas/labeled/ready/available is correct.
syncReplicas may have changed one of the counts in the status and it is worthwhile to update it.

You make a good point about possibly dropping the syncErr.
I changed it such that the two errors are combined.

return updatedMS, nil
}
// Stop retrying if we exceed statusUpdateRetries - the machineSet will be requeued with a rate limit.
if i >= statusUpdateRetries {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this package depend on cluster-api/util? If so using the retry out of there would be simpler.

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 can depend on cluster-api/util, though I'm not sure it makes it simpler.
The Retry there is more geared towards synchronization of external dependencies, where the exponential backoff makes sense.
I simply want to retry a request in case the server fails for whatever reason.

This PR was split off from PR kubernetes-sigs#165 to make it a smaller PR.
There are edge cases that will be implemented in a separate PR.
@k4leung4
Copy link
Contributor Author

/assign @spew @jessicaochen

Copy link
Contributor

@jessicaochen jessicaochen 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 (leaving backslash for secondary reviewer)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jessicaochen, k4leung4

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2018
@jessicaochen
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 18, 2018
@k4leung4
Copy link
Contributor Author

@spew did you have any other questions or concerns about this PR

@k4leung4
Copy link
Contributor Author

/cc @spew

@k8s-ci-robot k8s-ci-robot requested a review from spew May 21, 2018 16:20
@spew
Copy link
Contributor

spew commented May 21, 2018

no other comments! lgtm.

@spew
Copy link
Contributor

spew commented May 21, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 21, 2018
@k8s-ci-robot k8s-ci-robot merged commit cd39d32 into kubernetes-sigs:master May 21, 2018
chuckha pushed a commit to chuckha/cluster-api that referenced this pull request Oct 2, 2019
…pdate-to-patch

chore: switch from Update() to Patch()
jayunit100 pushed a commit to jayunit100/cluster-api that referenced this pull request Jan 31, 2020
…tes-sigs#180)

* Add support to inject custom trusted certs into the machines

Resolves kubernetes-sigs#165

Change-Id: I2f399143419553b120e28b46719e7514990fdab0

* update trustedCerts.md

fix grammar
fxierh pushed a commit to fxierh/cluster-api that referenced this pull request Sep 14, 2024
…ency-openshift-4.15-ose-cluster-api

OCPBUGS-19109: Updating ose-cluster-api images to be consistent with ART
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants