GCP: Only create debugd loadbalancer when debugCluster is set

This commit is contained in:
Nils Hanke 2022-09-06 10:28:00 +02:00 committed by Nils Hanke
parent d74c7a3769
commit 72d4456b3f
5 changed files with 54 additions and 22 deletions

View file

@ -20,7 +20,7 @@ type gcpclient interface {
CreateVPCs(ctx context.Context) error
CreateFirewall(ctx context.Context, input gcpcl.FirewallInput) error
CreateInstances(ctx context.Context, input gcpcl.CreateInstancesInput) error
CreateLoadBalancers(ctx context.Context) error
CreateLoadBalancers(ctx context.Context, isDebugCluster bool) error
TerminateFirewall(ctx context.Context) error
TerminateVPCs(context.Context) error
TerminateLoadBalancers(context.Context) error

View file

@ -284,7 +284,7 @@ func (c *fakeGcpClient) CreateInstances(ctx context.Context, input gcpcl.CreateI
return nil
}
func (c *fakeGcpClient) CreateLoadBalancers(ctx context.Context) error {
func (c *fakeGcpClient) CreateLoadBalancers(ctx context.Context, isDebugCluster bool) error {
c.loadbalancers = []string{"kube-lb", "boot-lb", "verify-lb"}
return nil
}
@ -361,7 +361,7 @@ func (c *stubGcpClient) CreateInstances(ctx context.Context, input gcpcl.CreateI
return c.createInstancesErr
}
func (c *stubGcpClient) CreateLoadBalancers(ctx context.Context) error {
func (c *stubGcpClient) CreateLoadBalancers(ctx context.Context, isDebugClient bool) error {
return c.createLoadBalancerErr
}

View file

@ -150,7 +150,7 @@ func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Co
return state.ConstellationState{}, err
}
if err := cl.CreateLoadBalancers(ctx); err != nil {
if err := cl.CreateLoadBalancers(ctx, config.IsDebugCluster()); err != nil {
return state.ConstellationState{}, err
}