Releases: topfreegames/kubernetes-crossplane-infrastructure-operator
chore: update tag name of custom metrics
Change the tag name cluster_environment to object_environment to match the other tag object_name.
chore: add custom metrics to sgController
Add a custom metric to track consecutive reconciliation errors with labels of controller name, environment, and object name so that we can group the errors in a more granular way and filter the environments.
Bugfix: change sg finalizer suffix to sgID
We need these changes because our controller throws reconciler errors when our sgName is bigger than 63 characters. So we decided to change the finalizer suffix from sgName to sgID because it is smaller and still references which security group put that finalizer.
failed to add finalizer in xxxxx-xxxxxx: KopsMachinePool.infrastructure.cluster.x-k8s.io "xxxxxx-xxxxxx" is invalid: metadata.finalizers: Invalid value: "securitygroup.wildlife.infrastructure.io/xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxx': name part must be no more than 63 characters
Ensuring deletion of security groups
When the clusters/igs are deleted, we must also clean up the resources that reference those objects like security groups. In the current implementation if we delete a Machine pool there's a race condition which can cause the reconciliation to fail in the Detach process. We can also have the condition where the WSG resource is deleted but the SG still exists in AWS.
To ensure the proper order of reconciliation and deletion we are leveraging the features of Finalizers. Now the infrastructure referenced by the WSG gets a finalizer, which we use to proper coordinate the deletions. Also, we are using the Status property of the WSG to guarantee that we properly detach the SG from a Machine Pool's ASG getting deleted.