Skip to content

Bug: DNS partial apply #1705

@Despire

Description

@Despire

Current Behaviour

As of now, if part of the DNS templates fails to be build while some parts are build successfully, the workflow will error out, but the partially created resources will be left as is.

Expected Behaviour

What should happen is the same as with partial fails in case of nodepools

var currentState []string
if c.CurrentClusterInfo != nil {
var err error
if currentState, err = terraform.StateList(); err != nil {
return fmt.Errorf("error while running terraform state list in %s : %w", clusterID, err)
}
}
if err := terraform.Apply(); err != nil {
updatedState, errList := terraform.StateList()
if errList != nil {
return errors.Join(err, fmt.Errorf("%w: error while running terraform state list in %s : %w", err, clusterID, errList))
}
var toDelete []string
for _, resource := range updatedState {
if !slices.Contains(currentState, resource) {
toDelete = append(toDelete, resource)
}
}
if errDestroy := terraform.DestroyTarget(toDelete); errDestroy != nil {
return fmt.Errorf("%w: failed to destroy partially create state: %w", err, errDestroy)
}
return err
}

This was not a problem until now, as the DNS templates were only considered to be fully build or not. With recent support for extensions in terraform templates this has changed and the same approach as with nodepools should be used.

  1. Create DNS records where one succeeds and the other fails (invalid hostname)
  2. Delete the cluster.
  3. See that one of those hostname are still present.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions