During gitops flows, if the user changes the subjectName or the certificate authority on an existing certificate, we should delete the old certificate, and insert a new ones.
💥 Actual behavior
Currently the old certificate just gets an updated subjectName:
> select * from certificate_templates;
*************************** 1. row ***************************
id: 6
team_id: 13
certificate_authority_id: 1
name: wifi-certificate
subject_name: /CN=$FLEET_VAR_HOST_END_USER_IDP_USERNAME/OU=$FLEET_VAR_HOST_UUID/ST=$FLEET_VAR_HOST_HARDWARE_SERIAL
created_at: 2025-12-04 22:27:29
updated_at: 2025-12-04 22:27:29
1 row in set (0.01 sec)
change name and run gitops
> select * from certificate_templates;
*************************** 1. row ***************************
id: 6
team_id: 13
certificate_authority_id: 1
name: wifi-certificate
subject_name: /CN=$FLEET_VAR_HOST_END_USER_IDP_USERNAME/OU=$FLEET_VAR_HOST_UUID/ST=$FLEET_VAR_HOST_HARDWARE_SERIAL/moresubjectstuff
created_at: 2025-12-04 22:27:29
updated_at: 2025-12-04 22:27:52
1 row in set (0.00 sec)
This is the same problem with certificate authorities.
🛠️ To fix
Delete old certificate_template and create a new one.
During gitops flows, if the user changes the subjectName or the certificate authority on an existing certificate, we should delete the old certificate, and insert a new ones.
💥 Actual behavior
Currently the old certificate just gets an updated subjectName:
change name and run gitopsThis is the same problem with certificate authorities.
🛠️ To fix
Delete old certificate_template and create a new one.