mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #53075 from alrs/fix-federation-controller-swallowed-errors
Automatic merge from submit-queue (batch tested with PRs 52630, 53110, 53136, 53075). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. federation/pkg/federation-controller/util: fix swallowed errors **What this PR does / why we need it**: The re-declaration of `err` inside the `if` block causes it to be lost before the check on line 93, even though it is reassigned on lines 95 and 90. By declaring the secret variable on line 71 I was able to ditch the `:=` assignment on line 72, meaning we can keep the `err` variable previously defined before the block on line 47. ```release-note NONE ```
This commit is contained in:
commit
b80b7b08c9
@ -68,7 +68,8 @@ func BuildClusterConfig(c *federation_v1beta1.Cluster) (*restclient.Config, erro
|
|||||||
if c.Spec.SecretRef.Name == "" {
|
if c.Spec.SecretRef.Name == "" {
|
||||||
return nil, fmt.Errorf("found secretRef but no secret name for cluster %s", c.Name)
|
return nil, fmt.Errorf("found secretRef but no secret name for cluster %s", c.Name)
|
||||||
}
|
}
|
||||||
secret, err := getSecret(c.Spec.SecretRef.Name)
|
var secret *api.Secret
|
||||||
|
secret, err = getSecret(c.Spec.SecretRef.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user