ydb-platform / ydb-kubernetes-operator

YDB Operator allows you to deploy your own YDB cluster in Kubernetes
Other
46 stars 16 forks source link

YDBOPS-9722 fillMissingSections for ConfigMap on operator upgrade #210

Closed kobzonega closed 3 months ago

kobzonega commented 4 months ago

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Pull request type

Please check the type of change your PR introduces:

What is the current behavior?

In new versions of ydb-operator, the logic of configuration generation for Storage/Database objects has changed - the hosts section is generated by mutationWebhook and then paste into ConfigMap during resource synchronization. In previous versions of the operator, the hosts section was added at the stage of creating the ConfigMap https://github.com/ydb-platform/ydb-kubernetes-operator/blob/0.4.30/internal/resources/database.go#L84.

When user updating the version of the ydb-operator, the mutating/validating webhook is not executed (because they are processed by the k8s api server), and therefore the hosts section for .spec.configuration in the Database is not registered here https://github.com/ydb-platform/ydb-kubernetes-operator/blob/0.5.2/api/v1alpha1/database_webhook.go#L131-L148. Then Database object updates the ConfigMap without generated hosts section https://github.com/ydb-platform/ydb-kubernetes-operator/blob/0.5.2/internal/resources/database.go#L75-L86

Issue Number: YDBOPS-9722

What is the new behavior?

Other information