Sitelet https://github.com/kubernetes/kops/commit/a84a7ac525941938f726d71bc064739ce491a764
Skip to content

Commit a84a7ac

Browse files
authored
Merge pull request #18496 from cheftako/apiOnlyLB
Fixing LB behavior when you have both APIServer and Control Plane.
2 parents 1fcef80 + 1049ccf commit a84a7ac

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎pkg/model/gcemodel/autoscalinggroup.go‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ func (b *AutoscalingGroupModelBuilder) splitToZones(ig *kops.InstanceGroup) (map
314314
}
315315

316316
func (b *AutoscalingGroupModelBuilder) Build(c *fi.CloudupModelBuilderContext) error {
317+
clusterHasApiServerOnly := false
318+
for _, ig := range b.InstanceGroups {
319+
if ig.IsAPIServerOnly() {
320+
clusterHasApiServerOnly = true
321+
break
322+
}
323+
}
324+
317325
for _, ig := range b.InstanceGroups {
318326
subnets, err := b.GatherSubnets(ig)
319327
if err != nil {
@@ -354,7 +362,11 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.CloudupModelBuilderContext) e
354362
}
355363

356364
// Attach API server instances to load balancer if we're using one
357-
if ig.HasAPIServer() {
365+
// Do not attach API server instances from the control plane if we
366+
// have an APIServer only IG declared. We are assuming that APIServer
367+
// only IG is a front end and other APIServers are dedicated for
368+
// internal use
369+
if ig.IsAPIServerOnly() || (!clusterHasApiServerOnly && ig.IsControlPlane()) {
358370
if b.UseLoadBalancerForAPI() {
359371
lbSpec := b.Cluster.Spec.API.LoadBalancer
360372
if lbSpec != nil {

‎tests/integration/update_cluster/minimal_gce_plb_apiserver/kubernetes.tf‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ resource "google_compute_instance_group_manager" "a-master-us-test1-a-minimal-gc
494494
}
495495
list_managed_instances_results = "PAGINATED"
496496
name = "a-master-us-test1-a-minimal-gce-plb-apiserver-example-com"
497-
target_pools = [google_compute_target_pool.api-minimal-gce-plb-apiserver-example-com.self_link]
498497
target_size = 1
499498
update_policy {
500499
minimal_action = "REPLACE"

0 commit comments

Comments
 (0)