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

Swtich to use beta HealthCheck for NEG #366

Merged
merged 3 commits into from
Jun 27, 2018

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Jun 26, 2018

@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 Jun 26, 2018
@freehan freehan force-pushed the neg-beta-healthcheck branch 2 times, most recently from b0bf889 to 6e76504 Compare June 26, 2018 18:29
glog.V(2).Infof("Updating health check for port %v with protocol %v", newHC.Port, newHC.Type)
v1hc, err := newHC.ToComputeHealthCheck()
if err != nil {
return err
}
return h.cloud.UpdateHealthCheck(v1hc)
default:
return fmt.Errorf("Unkonwn Version: %q", newHC.Version())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Unknown . I think it also is a typo earlier in this file

var hc *computealpha.HealthCheck
var err error
if alpha {
if version == meta.VersionAlpha {
hc, err = h.cloud.GetAlphaHealthCheck(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This part of the if clause is missing the:

if err != nil {
    return nil, err
}

Alternatively, just do this check once at the end of this function, and otherwise return NewHealthCheck(hc), err

Copy link
Member

Choose a reason for hiding this comment

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

irrelevant, just out of curiosity, why not switch .. case .. here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah. I had switch .. case .. at other places. Will make the change

hc.merge()
return toBetaHealthCheck(&hc.HealthCheck)
}

// ToComputeHealthCheck returns a valid compute.HealthCheck object
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, this should also be ToAlphaComputeHealthCheck

err := copyViaJSON(ret, hc)
return ret, err
}

// toV1HealthCheck converts v1 health check to alpha health check.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, // betaToAlphaHealthCheck converts beta health check to alpha health check

if err != nil {
return nil, err
}
hc, err = betaToAlphaHealthCheck(betaHC)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should also check for invalid version here - return fmt.Errorf("Unknown Version: %q", hc.Version()). Since this is used in a few places, it could be a const too.

@@ -183,7 +203,7 @@ func mergeHealthcheck(oldHC, newHC *HealthCheck) *HealthCheck {
}

func (h *HealthChecks) getHealthCheckLink(name string, alpha bool) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to change the method signature of this function to version meta.Version also. Below line should be h.Get(name, version).

@freehan freehan force-pushed the neg-beta-healthcheck branch 2 times, most recently from fc7ec2c to 93c376f Compare June 26, 2018 23:07
@bowei bowei merged commit 4fe4d22 into kubernetes:master Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants