You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: web/docs/resource-name-migration.md
+65-52Lines changed: 65 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,13 @@ sidebar_position: 41
8
8
9
9
:::warning
10
10
Before running the migration script or applying the manifest, please:
11
-
1.**Review the complete manifest**on the [Migration Manifest](migration-manifest.md) page to understand what changes will be made
11
+
1.**Review the complete manifest**at [migration-rbac.yaml](/migration-rbac.yaml) to understand what changes will be made
12
12
2.**Test in a non-production environment** first if possible
13
13
3.**Ensure you have proper backups** of your cluster configuration
14
-
4.**Verify the resource names match** your current installation (default namespace is `cnpg-system`)
15
14
16
15
This migration will delete old RBAC resources and create new ones. While the operation is designed to be safe, you should review and understand the changes before proceeding. The maintainers of this project are not responsible for any issues that may arise during migration.
16
+
17
+
**Note:** This guide assumes you are using the default `cnpg-system` namespace.
17
18
:::
18
19
19
20
## Overview
@@ -50,26 +51,16 @@ Using generic names for cluster-wide resources is discouraged as they may confli
50
51
The migration process is straightforward and can be completed with a few kubectl commands.
51
52
52
53
:::danger Verify Resources Before Deletion
53
-
**IMPORTANT**: The old resource names are generic and could potentially belong to other components in your cluster. Before deleting, verify they belong to the barman plugin by checking their labels:
54
+
**IMPORTANT**: The old resource names are generic and could potentially belong to other components in your cluster.
54
55
55
-
```bash
56
-
# Check if the resources have the barman plugin labels
57
-
kubectl get clusterrole metrics-auth-role -o yaml | grep -A 5 "labels:"
58
-
kubectl get clusterrole metrics-reader -o yaml | grep -A 5 "labels:"
59
-
kubectl get clusterrole objectstore-viewer-role -o yaml | grep -A 5 "labels:"
60
-
kubectl get clusterrole objectstore-editor-role -o yaml | grep -A 5 "labels:"
61
-
kubectl get clusterrolebinding metrics-auth-rolebinding -o yaml | grep -A 5 "labels:"
62
-
```
56
+
**Before deleting each resource, verify it belongs to the barman plugin by checking:**
57
+
- For `objectstore-*` roles: Look for `barmancloud.cnpg.io` in the API groups
58
+
- For `metrics-*` roles: Check if they reference the `plugin-barman-cloud` ServiceAccount in `cnpg-system` namespace
59
+
- For other roles: Look for labels like `app.kubernetes.io/name: plugin-barman-cloud`
63
60
64
-
Look for labels like `app.kubernetes.io/name: plugin-barman-cloud` or references to `barmancloud.cnpg.io` in the rules. If the resources don't have these indicators, **DO NOT DELETE THEM** as they may belong to another application.
61
+
If a resource doesn't have these indicators, **DO NOT DELETE IT** as it may belong to another application.
65
62
66
-
If you're unsure, you can also check what the resources manage:
67
-
```bash
68
-
kubectl get clusterrole objectstore-viewer-role -o yaml
69
-
kubectl get clusterrole objectstore-editor-role -o yaml
70
-
```
71
-
72
-
These should reference `barmancloud.cnpg.io` API groups. If they don't, they are not barman plugin resources.
63
+
In Step 1 below, carefully review the output of each verification command before proceeding with the delete.
73
64
:::
74
65
75
66
:::tip Dry Run First
@@ -80,55 +71,91 @@ You can add `--dry-run=client` to any `kubectl delete` command to preview what w
80
71
81
72
**Only proceed if you've verified these resources belong to the barman plugin (see warning above).**
82
73
74
+
For each resource below, first verify it belongs to barman, then delete it:
75
+
83
76
```bash
84
-
# Only delete if this belongs to barman plugin (check labels first)
85
-
kubectl delete clusterrole metrics-auth-role
77
+
# 1. Check metrics-auth-rolebinding FIRST (we'll check the role after)
78
+
# Look for references to plugin-barman-cloud ServiceAccount
# 5. Check metrics-reader (MOST DANGEROUS - very generic name)
104
+
# First, check if it's being used by any rolebindings OTHER than barman's:
105
+
kubectl get clusterrolebinding -o json | jq -r '.items[] | select(.roleRef.name=="metrics-reader") | "\(.metadata.name) -> \(.subjects[0].name) in \(.subjects[0].namespace)"'
106
+
# If this shows ANY rolebindings, review them carefully. Only proceed if they're all barman-related.
107
+
# Then check the role itself:
108
+
kubectl describe clusterrole metrics-reader
109
+
# If it ONLY has nonResourceURLs: /metrics and NO other rolebindings use it, delete it:
110
+
kubectl delete clusterrole metrics-reader
98
111
```
99
112
100
-
If any resource is not found, that's okay - it means it was never created or already deleted.
113
+
:::warning
114
+
The `metrics-reader` role is particularly dangerous to delete blindly. Many monitoring systems use this exact name. Only delete it if:
115
+
1. You've verified it ONLY grants access to `/metrics`
116
+
2. No other rolebindings reference it (checked with the jq command above)
117
+
3. You're certain it was created by the barman plugin
118
+
119
+
If you're unsure, it's safer to leave it and let the new `barman-plugin-metrics-reader` role coexist with it.
120
+
:::
121
+
122
+
If any resource is not found during the `describe` command, that's okay - it means it was never created or already deleted. Simply skip the delete command for that resource.
101
123
102
124
### Step 2: Delete Old Namespace-scoped Resources
103
125
104
-
These are less likely to conflict, but you should still verify they're in the correct namespace. Replace `cnpg-system`with your namespace if different:
126
+
Delete the old namespace-scoped resources in the `cnpg-system` namespace:
105
127
106
128
```bash
107
-
# First, verify these exist in your namespace
108
-
kubectl get role leader-election-role -n cnpg-system
109
-
kubectl get rolebinding leader-election-rolebinding -n cnpg-system
110
-
111
-
# Then delete them
129
+
# Delete the old leader-election resources
112
130
kubectl delete role leader-election-role -n cnpg-system
The new manifest will create all RBAC resources with the `barman-plugin-` prefix. Review the [Migration Manifest](migration-manifest.md) page to see exactly what will be created.
158
+
The new manifest will create all RBAC resources with the `barman-plugin-` prefix in the `cnpg-system` namespace. You can review the complete YAML at [migration-rbac.yaml](/migration-rbac.yaml).
132
159
:::
133
160
134
161
## Impact
@@ -170,20 +197,6 @@ If the plugin fails to start after migration, check:
If you encounter issues during migration, please open an issue on the [GitHub repository](https://github.com/cloudnative-pg/plugin-barman-cloud/issues).
0 commit comments