@@ -57,6 +57,7 @@ type terraformAzureLoadBalancerProbe struct {
5757 LoadBalancerID * terraformWriter.Literal `cty:"loadbalancer_id"`
5858 Protocol * string `cty:"protocol"`
5959 Port * int32 `cty:"port"`
60+ RequestPath * string `cty:"request_path"`
6061 IntervalInSeconds * int32 `cty:"interval_in_seconds"`
6162 NumberOfProbes * int32 `cty:"number_of_probes"`
6263}
@@ -118,18 +119,21 @@ func (*LoadBalancer) RenderTerraform(t *terraform.TerraformTarget, a, e, changes
118119 if err != nil {
119120 return err
120121 }
121- probeName := fmt .Sprintf ("Health-TCP-%d" , port )
122+
123+ probeProtocol , probeNamePrefix , probeRequestPath := wellKnownServiceProbe (service )
124+ probeName := fmt .Sprintf ("Health-%s-%d" , probeNamePrefix , port )
122125 ruleName := fmt .Sprintf ("TCP-%d" , port )
123126 probeResourceName := fmt .Sprintf ("%s-%s" , fi .ValueOf (e .Name ), probeName )
124127 ruleResourceName := fmt .Sprintf ("%s-%s" , fi .ValueOf (e .Name ), ruleName )
125128
126- protocol := "Tcp"
129+ ruleProtocol := "Tcp"
127130 loadDistribution := "Default"
128131 if err := t .RenderResource ("azurerm_lb_probe" , probeResourceName , & terraformAzureLoadBalancerProbe {
129132 Name : & probeName ,
130133 LoadBalancerID : e .terraformID (),
131- Protocol : & protocol ,
134+ Protocol : & probeProtocol ,
132135 Port : fi .PtrTo (port ),
136+ RequestPath : probeRequestPath ,
133137 IntervalInSeconds : fi.PtrTo [int32 ](15 ),
134138 NumberOfProbes : fi.PtrTo [int32 ](4 ),
135139 }); err != nil {
@@ -139,7 +143,7 @@ func (*LoadBalancer) RenderTerraform(t *terraform.TerraformTarget, a, e, changes
139143 if err := t .RenderResource ("azurerm_lb_rule" , ruleResourceName , & terraformAzureLoadBalancerRule {
140144 Name : & ruleName ,
141145 LoadBalancerID : e .terraformID (),
142- Protocol : & protocol ,
146+ Protocol : & ruleProtocol ,
143147 FrontendPort : fi .PtrTo (port ),
144148 BackendPort : fi .PtrTo (port ),
145149 FrontendIPConfigurationName : fi .PtrTo (terraformAzureLoadBalancerFrontendName ),
@@ -164,6 +168,17 @@ func (lb *LoadBalancer) terraformBackendAddressPoolID() *terraformWriter.Literal
164168 return terraformWriter .LiteralProperty ("azurerm_lb_backend_address_pool" , fmt .Sprintf ("%s-backend-pool" , fi .ValueOf (lb .Name )), "id" )
165169}
166170
171+ // wellKnownServiceProbe returns the probe protocol (for terraform), probe name prefix (for resource naming),
172+ // and request path for the given service.
173+ func wellKnownServiceProbe (service wellknownservices.WellKnownService ) (protocol string , namePrefix string , requestPath * string ) {
174+ switch service {
175+ case wellknownservices .KopsController :
176+ return "Https" , "HTTPS" , fi .PtrTo ("/healthz" )
177+ default :
178+ return "Tcp" , "TCP" , nil
179+ }
180+ }
181+
167182func wellKnownServicePort (service wellknownservices.WellKnownService ) (int32 , error ) {
168183 switch service {
169184 case wellknownservices .KubeAPIServer :
0 commit comments