-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
OCPBUGS-4466: Prevent cluster installation with mismatched worker assets and worker replicas #8370
base: master
Are you sure you want to change the base?
Conversation
@sadasu: This pull request references Jira Issue OCPBUGS-4466, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
With the steps detailed in the bug, the behavior with this fix is as follows: |
if int64(len(workers)) != numWorkers { | ||
return fmt.Errorf("number of worker assets: %d does not match requested workers: %d", len(workers), numWorkers) | ||
} | ||
if len(workers) == 0 && !mastersSchedulable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(workers) == 0 && !mastersSchedulable { | |
if len(workers) == 0 || !mastersSchedulable { |
Should this be an or here?
if worker.Replicas != nil { | ||
numWorkers += *worker.Replicas | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a nice function for this in k8s.io/utils/ptr
:
if worker.Replicas != nil { | |
numWorkers += *worker.Replicas | |
} | |
numWorkers += ptr.Deref(worker.Replicas, 0) |
// 3. workers = 0, masters not schedulable, invalid cluster | ||
if len(workers) == 0 { | ||
return errors.Errorf("compact clusters with 0 workers are not supported at this time") | ||
if int64(len(workers)) != numWorkers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are comparing different things here:
len(workers)
== the number of worker machinesetsnumWorkers
== the number of replicas in all worker machinesets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of machinesets the installer creates based on the install-config is related to the availability zones: https://github.com/openshift/installer/blob/master/pkg/asset/machines/gcp/machinesets.go#L37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I suspected, GCP installs are broken:
level=info msg=Credentials loaded from environment variable "GOOGLE_CLOUD_KEYFILE_JSON", file "/var/run/secrets/ci.openshift.io/cluster-profile/gce.json"
level=fatal msg=failed to fetch Terraform Variables: failed to generate asset "Terraform Variables": number of worker assets: 4 does not match requested workers: 3
Installer exit with code 1
/test e2e-gcp-ovn |
@sadasu: The following tests failed, say
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. |
This is updating the fix introduced in #8226.
Based on https://docs.openshift.com/container-platform/4.13/installing/installing_gcp/installing-gcp-three-node.html, compact clusters on GCP are actually supported so the fix has been updated to disallow only incorrect states that we may end up in with incorrect manipulation of generated assets as detailed in the big.
Also, limiting the fix to just the GCP platform.