Skip to content

Commit 6c3e6d2

Browse files
authored
Remove image list cm and edb config secret during migration (#2448)
* update migration job to cleanup certain edb config resources to prevent helm ownership problems Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * differentiate operator namespace role Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * differentiate operator namespace role Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * differentiate operator namespace role Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * add secrets to role Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * remove delete configmap Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> * do not delete edb secret Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com> --------- Signed-off-by: Ben Luzarraga <luzarragaben@gmail.com>
1 parent 8451b7f commit 6c3e6d2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

bedrock-migration/templates/adopt-cs-cr.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#not sure this is necessary
21
apiVersion: operator.ibm.com/v3
32
kind: CommonService
43
metadata:

bedrock-migration/templates/bedrock-migration-job.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ spec:
8484
oc delete --ignore-not-found csv $edbCSV -n $operatorNamespace && oc delete --ignore-not-found subscription.operators.coreos.com $edbSub -n $operatorNamespace
8585
fi
8686
87+
echo "Deleting EDB config resources in namespace $operatorNamespace to be regenerated after migration..."
88+
oc delete configmap cloud-native-postgresql-image-list --ignore-not-found -n $operatorNamespace
89+
8790
echo "Deleting IM, UI, and EDB ServiceAccounts and Jobs in operator namespace $operatorNamespace and services namespace $servicesNamespace..."
8891
oc delete --ignore-not-found sa postgresql-operator-manager edb-license-sa -n $operatorNamespace
8992
oc delete --ignore-not-found sa ibm-iam-operand-restricted ibm-commonui-operand common-service-db -n $servicesNamespace

bedrock-migration/templates/rbac.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
kind: Role
1111
apiVersion: rbac.authorization.k8s.io/v1
1212
metadata:
13-
name: bedrock-migration-job-role
13+
name: bedrock-migration-job-role-{{ .Values.global.operatorNamespace }}
1414
namespace: {{ .Values.global.operatorNamespace }}
1515
annotations:
1616
"helm.sh/hook": pre-install
@@ -39,6 +39,7 @@ rules:
3939
resources:
4040
- configmaps
4141
- serviceaccounts
42+
- secrets
4243
verbs:
4344
- list
4445
- get
@@ -64,7 +65,7 @@ rules:
6465
kind: RoleBinding
6566
apiVersion: rbac.authorization.k8s.io/v1
6667
metadata:
67-
name: bedrock-migration-job-rb
68+
name: bedrock-migration-job-rb-{{ .Values.global.operatorNamespace }}
6869
namespace: {{ .Values.global.operatorNamespace }}
6970
annotations:
7071
"helm.sh/hook": pre-install
@@ -76,7 +77,7 @@ subjects:
7677
roleRef:
7778
apiGroup: rbac.authorization.k8s.io
7879
kind: Role
79-
name: bedrock-migration-job-role
80+
name: bedrock-migration-job-role-{{ .Values.global.operatorNamespace }}
8081
{{- $watchNamespaces := .Values.global.tetheredNamespaces | default list -}}
8182
{{- if .Values.global.instanceNamespace -}}
8283
{{- $watchNamespaces = append $watchNamespaces .Values.global.instanceNamespace -}}

0 commit comments

Comments
 (0)