cluster-api-provider-gcp icon indicating copy to clipboard operation
cluster-api-provider-gcp copied to clipboard

Fix panic when no failure domain found

Open alexander-demicev opened this issue 3 years ago • 3 comments

What type of PR is this? /kind bug

What this PR does / why we need it: We are using externally managed cluster infrastructure and nothing sets failure domain on cluster object, this makes controller panic when it's missing. I believe the controller should not panic here and fail in another place in this case.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • [ ] squashed commits
  • [ ] includes documentation
  • [ ] adds unit tests

Release note:

Fix panic when no failure domain found

alexander-demicev avatar Jul 19 '22 12:07 alexander-demicev

@richardcase gcp cluster controller also tries to populate the failure domain field https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/main/controllers/gcpcluster_controller.go#L179-L196 but regardless of that, if the payload is invalid it's better to fail somewhere on the GCP side than panic :)

alexander-demicev avatar Jul 19 '22 14:07 alexander-demicev

if the payload is invalid it's better to fail somewhere on the GCP side than panic :)

Agreed that a panic isn't good. I was trying to highlight that we should review our usage of Zone() more generally as it appears in some instances its not needed.

richardcase avatar Jul 19 '22 17:07 richardcase

@richardcase are you fine with this change?

cpanato avatar Aug 18 '22 14:08 cpanato

@cpanato - yes all good :+1:

Worth a try.....

/lgtm

richardcase avatar Aug 18 '22 14:08 richardcase

/test ls

cpanato avatar Aug 18 '22 14:08 cpanato

@cpanato: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-gcp-build
  • /test pull-cluster-api-provider-gcp-e2e-test
  • /test pull-cluster-api-provider-gcp-make
  • /test pull-cluster-api-provider-gcp-test
  • /test pull-cluster-api-provider-gcp-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-gcp-apidiff
  • /test pull-cluster-api-provider-gcp-capi-e2e
  • /test pull-cluster-api-provider-gcp-conformance
  • /test pull-cluster-api-provider-gcp-conformance-ci-artifacts
  • /test pull-cluster-api-provider-gcp-coverage
  • /test pull-cluster-api-provider-gcp-e2e-workload-upgrade

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-gcp-apidiff
  • pull-cluster-api-provider-gcp-build
  • pull-cluster-api-provider-gcp-e2e-test
  • pull-cluster-api-provider-gcp-make
  • pull-cluster-api-provider-gcp-test
  • pull-cluster-api-provider-gcp-verify

In response to this:

/test ls

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 avatar Aug 18 '22 14:08 k8s-ci-robot

/test pull-cluster-api-provider-gcp-capi-e2e /test pull-cluster-api-provider-gcp-conformance /test pull-cluster-api-provider-gcp-conformance-ci-artifacts /test pull-cluster-api-provider-gcp-e2e-workload-upgrade

cpanato avatar Aug 18 '22 14:08 cpanato

/hold for the non required tests

cpanato avatar Aug 18 '22 14:08 cpanato

All tests have passed, any GCP maintainer happy to help and add the approve label?

JoelSpeed avatar Aug 18 '22 15:08 JoelSpeed

/unhold

cpanato avatar Aug 18 '22 15:08 cpanato

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demichev, cpanato

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 avatar Aug 18 '22 15:08 k8s-ci-robot