Backups not working when operator and database installed from helm charts

Description

I install charts from here
 
https://github.com/percona/percona-helm-charts/tree/master/charts/pxc-operator
 
https://github.com/percona/percona-helm-charts/tree/master/charts/pxc-db

Installation steps are taken from readme files:
helm install my-operator percona/pxc-operator --version 0.1.9 --namespace my-namespace
k apply -f backup-secret.yaml
helm install my-db percona/pxc-db --version 0.1.10 --namespace my-namespace -f complete-values.yaml

For db I specify -f complete-values.yaml to be able to deploy this on minikube (affinity set to “none”, setting smaller cpu/mem requirements and configuring backup like this:

When backup job is created it fails with*Error creating: pods “sat-night-backup-1599834120-” is forbidden: error looking up service account my-namespace/percona-xtradb-cluster-operator: serviceaccount “percona-xtradb-cluster-operator” not found*

And indeed there is no such ServiceAccount:
default 1 8m21s
my-operator-pxc-operator 1 8m11s
percona-xtradb-cluster-operator-workload 1 8m11s

In a helm chart I see 2 ServiceAccounts are created
https://github.com/percona/percona-helm-charts/blob/master/charts/pxc-operator/templates/role-binding.yaml
One with hardcoded name “percona-xtradb-cluster-operator-workload ” and second is using helm release name it’s in name. So one is static and second one is dynamic.
Unfortunately none of them is what operator expects…I was able to workaround that issue when I install operator with that parameter

--set fullnameOverride=percona-xtradb-cluster-operator

Then ServiceAccount seems to have the right name.

Environment

None

Smart Checklist

Activity

Slava Sarzhan December 18, 2020 at 2:30 PM

Hi , 

As I can see we had this issue in 1.5.0.  By default 'percona-xtradb-cluster-operator' was used but it was not created. This issue was fixed in 1.6.0. Now for the backup we use  'default' account by default but you can overwrite it in CR.
P.S. In 1.5.0 you also can overwrite   'percona-xtradb-cluster-operator' account for the backups by adding the following line into CR:

Duplicate

Details

Assignee

Reporter

Time tracking

2h logged

Priority

Smart Checklist

Created September 14, 2020 at 11:03 AM
Updated March 5, 2024 at 6:08 PM
Resolved December 18, 2020 at 2:33 PM