mirror of https://github.com/kubernetes/kops.git
gcp: Update terraform rendering for HTTP Health Check
This commit is contained in:
parent
dc5fa01b02
commit
1db17ab949
|
@ -48,6 +48,7 @@ func createPublicLB(b *APILoadBalancerBuilder, c *fi.CloudupModelBuilderContext)
|
||||||
healthCheck := &gcetasks.HTTPHealthcheck{
|
healthCheck := &gcetasks.HTTPHealthcheck{
|
||||||
Name: s(b.NameForHealthcheck("api")),
|
Name: s(b.NameForHealthcheck("api")),
|
||||||
Port: i64(wellknownports.KubeAPIServerHealthCheck),
|
Port: i64(wellknownports.KubeAPIServerHealthCheck),
|
||||||
|
RequestPath: s("/healthz"),
|
||||||
Lifecycle: b.Lifecycle,
|
Lifecycle: b.Lifecycle,
|
||||||
}
|
}
|
||||||
c.AddTask(healthCheck)
|
c.AddTask(healthCheck)
|
||||||
|
|
|
@ -419,6 +419,7 @@ resource "google_compute_forwarding_rule" "api-minimal-gce-plb-example-com" {
|
||||||
resource "google_compute_http_health_check" "api-minimal-gce-plb-example-com" {
|
resource "google_compute_http_health_check" "api-minimal-gce-plb-example-com" {
|
||||||
name = "api-minimal-gce-plb-example-com"
|
name = "api-minimal-gce-plb-example-com"
|
||||||
port = 3990
|
port = 3990
|
||||||
|
request_path = "/healthz"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_instance_group_manager" "a-master-us-test1-a-minimal-gce-plb-example-com" {
|
resource "google_compute_instance_group_manager" "a-master-us-test1-a-minimal-gce-plb-example-com" {
|
||||||
|
|
|
@ -35,6 +35,7 @@ type HTTPHealthcheck struct {
|
||||||
|
|
||||||
SelfLink string
|
SelfLink string
|
||||||
Port *int64
|
Port *int64
|
||||||
|
RequestPath *string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ fi.CompareWithID = &HTTPHealthcheck{}
|
var _ fi.CompareWithID = &HTTPHealthcheck{}
|
||||||
|
@ -56,6 +57,7 @@ func (e *HTTPHealthcheck) Find(c *fi.CloudupContext) (*HTTPHealthcheck, error) {
|
||||||
actual := &HTTPHealthcheck{
|
actual := &HTTPHealthcheck{
|
||||||
Name: fi.PtrTo(r.Name),
|
Name: fi.PtrTo(r.Name),
|
||||||
Port: fi.PtrTo(r.Port),
|
Port: fi.PtrTo(r.Port),
|
||||||
|
RequestPath: fi.PtrTo(r.RequestPath),
|
||||||
SelfLink: r.SelfLink,
|
SelfLink: r.SelfLink,
|
||||||
}
|
}
|
||||||
// System fields
|
// System fields
|
||||||
|
@ -80,7 +82,7 @@ func (h *HTTPHealthcheck) RenderGCE(t *gce.GCEAPITarget, a, e, changes *HTTPHeal
|
||||||
o := &compute.HttpHealthCheck{
|
o := &compute.HttpHealthCheck{
|
||||||
Name: fi.ValueOf(e.Name),
|
Name: fi.ValueOf(e.Name),
|
||||||
Port: fi.ValueOf(e.Port),
|
Port: fi.ValueOf(e.Port),
|
||||||
RequestPath: "/healthz",
|
RequestPath: fi.ValueOf(e.RequestPath),
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.V(4).Infof("Creating Healthcheck %q", o.Name)
|
klog.V(4).Infof("Creating Healthcheck %q", o.Name)
|
||||||
|
@ -99,12 +101,14 @@ func (h *HTTPHealthcheck) RenderGCE(t *gce.GCEAPITarget, a, e, changes *HTTPHeal
|
||||||
type terraformHTTPHealthcheck struct {
|
type terraformHTTPHealthcheck struct {
|
||||||
Name string `cty:"name"`
|
Name string `cty:"name"`
|
||||||
Port *int64 `cty:"port"`
|
Port *int64 `cty:"port"`
|
||||||
|
RequestPath *string `cty:"request_path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_ *HTTPHealthcheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *HTTPHealthcheck) error {
|
func (_ *HTTPHealthcheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *HTTPHealthcheck) error {
|
||||||
tf := &terraformHTTPHealthcheck{
|
tf := &terraformHTTPHealthcheck{
|
||||||
Name: *e.Name,
|
Name: *e.Name,
|
||||||
Port: e.Port,
|
Port: e.Port,
|
||||||
|
RequestPath: e.RequestPath,
|
||||||
}
|
}
|
||||||
return t.RenderResource("google_compute_http_health_check", *e.Name, tf)
|
return t.RenderResource("google_compute_http_health_check", *e.Name, tf)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue