Skip to content

Commit

Permalink
Skip Loadbalancer Calls during deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
maboehm committed Jan 10, 2024
1 parent 35d70f0 commit aabcb86
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
16 changes: 11 additions & 5 deletions pkg/controller/infrastructure/actuator_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ func (a *actuator) deleteWithTerraformer(ctx context.Context, log logr.Logger, i
if err != nil {
return util.DetermineError(err, helper.KnownCodes)
}
loadbalancerClient, err := openstackClient.Loadbalancing()
if err != nil {
return util.DetermineError(err, helper.KnownCodes)
}

// STACKIT Openstack has no Loadbalancer API, so we are skipping this call, see
// https://github.com/gardener/gardener-extension-provider-openstack/issues/672
// loadbalancerClient, err := openstackClient.Loadbalancing()
// if err != nil {
// return util.DetermineError(err, helper.KnownCodes)
// }

stateInitializer := terraformer.StateConfigMapInitializerFunc(terraformer.CreateState)
tf = tf.InitializeWith(ctx, terraformer.DefaultInitializer(a.client, terraformFiles.Main, terraformFiles.Variables, terraformFiles.TFVars, stateInitializer)).SetEnvVars(internal.TerraformerEnvVars(infra.Spec.SecretRef, credentials)...)
Expand All @@ -134,7 +137,10 @@ func (a *actuator) deleteWithTerraformer(ctx context.Context, log logr.Logger, i
destroyKubernetesLoadbalancers = g.Add(flow.Task{
Name: "Destroying Kubernetes loadbalancers entries",
Fn: flow.TaskFn(func(ctx context.Context) error {
return a.cleanupKubernetesLoadbalancers(ctx, log, loadbalancerClient, vars[infrastructure.TerraformOutputKeySubnetID], infra.Namespace)
// STACKIT Openstack has no Loadbalancer API, so we are skipping this call, see
// https://github.com/gardener/gardener-extension-provider-openstack/issues/672
// return a.cleanupKubernetesLoadbalancers(ctx, log, loadbalancerClient, vars[infrastructure.TerraformOutputKeySubnetID], infra.Namespace)
return nil
}).
RetryUntilTimeout(10*time.Second, 5*time.Minute).
DoIf(configExists),
Expand Down
17 changes: 10 additions & 7 deletions pkg/controller/infrastructure/infraflow/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ func NewFlowContext(log logr.Logger, clientFactory osclient.Factory,
if err != nil {
return nil, fmt.Errorf("creating compute client failed: %w", err)
}
loadbalancing, err := clientFactory.Loadbalancing(osclient.WithRegion(infra.Spec.Region))
if err != nil {
return nil, err
}

// STACKIT Openstack has no Loadbalancer API, so we are skipping this call, see
// https://github.com/gardener/gardener-extension-provider-openstack/issues/672
// loadbalancing, err := clientFactory.Loadbalancing(osclient.WithRegion(infra.Spec.Region))
// if err != nil {
// return nil, err
// }

flowContext := &FlowContext{
BasicFlowContext: *shared.NewBasicFlowContext(log, whiteboard, persistor),
Expand All @@ -112,9 +115,9 @@ func NewFlowContext(log logr.Logger, clientFactory osclient.Factory,
config: config,
cloudProfileConfig: cloudProfileConfig,
networking: networking,
loadbalancing: loadbalancing,
access: access,
compute: compute,
// loadbalancing: loadbalancing,
access: access,
compute: compute,
}
return flowContext, nil
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/controller/infrastructure/infraflow/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func (c *FlowContext) buildDeleteGraph() *flow.Graph {
if subnetID == nil {
return nil
}
return infrastructure.CleanupKubernetesLoadbalancers(ctx, c.LogFromContext(ctx), c.loadbalancing, *subnetID, c.namespace)
// STACKIT Openstack has no Loadbalancer API, so we are skipping this call, see
// https://github.com/gardener/gardener-extension-provider-openstack/issues/672
// return infrastructure.CleanupKubernetesLoadbalancers(ctx, c.LogFromContext(ctx), c.loadbalancing, *subnetID, c.namespace)
return nil
},
Timeout(defaultTimeout),
)
Expand Down

0 comments on commit aabcb86

Please sign in to comment.