Skip to content

Commit

Permalink
Take healthcheck configuration overrides from the backendconfig
Browse files Browse the repository at this point in the history
This enables taking the healthcheck configuration from a backendconfig
associated with the given Service.

As part of this PR, we also clean up the override handling to be easier
to understand where the settings come from.

For a given ServicePort `sp` and its associated healthcheck `hc`:

1. `sp` has some default settings depending on its type (e.g. IG, NEG, ILB).
2. SyncServicePort() will override those settings if the Probe exists.
     Path, Host, TimeoutSec, CheckIntervalSec.
3. We then sync with what exists in GCE:
3.1 If the healthcheck is does not exist, it will be CREATED.
3.1.1 If it has a backendconfig, then the following settings are used:
        CheckIntervalSec, TimeoutSec, HealthyThreshold,
        UnhealthyThreshold, Type, RequestPath
      We have `Port` in the struct, but it does not seem to be a valid
      field to use so it is currently ignored.
3.2 Otherwise the healthcheck will need to be UPDATED.
3.2.1 We merge in the settings from the existing healthcheck. As
      users have (in the past) done edits to their HCs directly, we
      do not want to break any previous behavior. Thus we merge in
      all of the settings on HTTPHealthCheck as well as any fields on
      HealthCheck itself, with the exception of:
        Port, PortSpecification
3.2.2 We now consider the backendconfig to be a final override.
  See list above for settings from the backendconfig.

Several situations do not seem to be handled currently:

* There is no way to change HC based on probe after it is created.
  This is because there is no way to tell if the difference is due
  to a user changing the setting directly in GCE or the HC should
  be updated.
* Changing types to/from NEG, ILB will leak the old healthcheck.
  User healthchecksettings will not propagate to the new healthcheck.
  • Loading branch information
bowei committed Feb 17, 2020
1 parent ea5f70b commit 365736a
Show file tree
Hide file tree
Showing 2 changed files with 1,037 additions and 176 deletions.
Loading

0 comments on commit 365736a

Please sign in to comment.