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

OCPBUGS-4466: Prevent cluster installation with mismatched worker assets and worker replicas #8370

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sadasu
Copy link
Contributor

@sadasu sadasu commented May 8, 2024

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.

@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels May 8, 2024
@openshift-ci-robot
Copy link
Contributor

@sadasu: This pull request references Jira Issue OCPBUGS-4466, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @jianli-wei

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

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.

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.

@openshift-ci openshift-ci bot requested a review from jianli-wei May 8, 2024 14:57
Copy link
Contributor

openshift-ci bot commented May 8, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from sadasu. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sadasu
Copy link
Contributor Author

sadasu commented May 8, 2024

With the steps detailed in the bug, the behavior with this fix is as follows:
[sdasu@sdasu-thinkpadp1gen5 bin]$ ./openshift-install create cluster --dir ~/clusters/gcp-dev
INFO Consuming Common Manifests from target directory
INFO Consuming Openshift Manifests from target directory
INFO Consuming OpenShift Install (Manifests) from target directory
INFO Consuming Worker Machines from target directory
INFO Consuming Master Machines from target directory
INFO Credentials loaded from file "/home/sdasu/.gcp/osServiceAccount.json"
FATAL failed to fetch Terraform Variables: failed to generate asset "Terraform Variables": number of worker assets: 0 does not match requested workers: 3

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if len(workers) == 0 && !mastersSchedulable {
if len(workers) == 0 || !mastersSchedulable {

Should this be an or here?

Comment on lines +224 to +226
if worker.Replicas != nil {
numWorkers += *worker.Replicas
}
Copy link
Contributor

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:

Suggested change
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 {
Copy link
Contributor

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 machinesets
  • numWorkers == the number of replicas in all worker machinesets.

Copy link
Contributor

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

Copy link
Contributor

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

https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_installer/8370/pull-ci-openshift-installer-master-e2e-gcp-ovn/1788264305544663040

@r4f4
Copy link
Contributor

r4f4 commented May 8, 2024

/test e2e-gcp-ovn

Copy link
Contributor

openshift-ci bot commented May 8, 2024

@sadasu: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-e2e-aws-ovn-upgrade e618df2 link false /test okd-e2e-aws-ovn-upgrade
ci/prow/e2e-gcp-ovn e618df2 link true /test e2e-gcp-ovn

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants