Skip to content

Commit 5bcc118

Browse files
committed
docs: fixes
Signed-off-by: Gabriele Bartolini <[email protected]>
1 parent 7f25cec commit 5bcc118

File tree

1 file changed

+75
-43
lines changed

1 file changed

+75
-43
lines changed

web/docs/resource-name-migration.md

Lines changed: 75 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,125 +12,151 @@ Before proceeding with the migration process, please:
1212
2. **Test in a non-production environment** first if possible
1313
3. **Ensure you have proper backups** of your cluster configuration
1414

15-
This migration will delete old RBAC resources only after the plugin-barman-cloud upgrade. While the operation is
16-
designed to be safe, you should review and understand the changes before proceeding. The maintainers of this project
17-
are not responsible for any issues that may arise during migration.
15+
This migration will delete old RBAC resources only after the
16+
`plugin-barman-cloud` upgrade. While the operation is designed to be safe, you
17+
should review and understand the changes before proceeding. The maintainers of
18+
this project are not responsible for any issues that may arise during
19+
migration.
1820

1921
**Note:** This guide assumes you are using the default `cnpg-system` namespace.
2022
:::
2123

2224
## Overview
2325

24-
Starting from version **0.8.0**, the plugin-barman-cloud deployment manifests use more specific, prefixed resource names
25-
to avoid conflicts with other components deployed in the same Kubernetes cluster.
26+
Starting from version **0.8.0**, the `plugin-barman-cloud` deployment manifests
27+
use more specific, prefixed resource names to avoid conflicts with other
28+
components deployed in the same Kubernetes cluster.
2629

2730
## What Changed
2831

29-
The following resources have been renamed to use proper prefixes:
32+
The following resources have been renamed to use proper prefixes.
3033

3134
### Cluster-scoped Resources
3235

33-
| Old Name | New Name |
34-
|----------|----------|
35-
| `metrics-auth-role` | `barman-plugin-metrics-auth-role` |
36+
| Old Name | New Name |
37+
|----------------------------|------------------------------------------|
38+
| `metrics-auth-role` | `barman-plugin-metrics-auth-role` |
3639
| `metrics-auth-rolebinding` | `barman-plugin-metrics-auth-rolebinding` |
37-
| `metrics-reader` | `barman-plugin-metrics-reader` |
38-
| `objectstore-viewer-role` | `barman-plugin-objectstore-viewer-role` |
39-
| `objectstore-editor-role` | `barman-plugin-objectstore-editor-role` |
40+
| `metrics-reader` | `barman-plugin-metrics-reader` |
41+
| `objectstore-viewer-role` | `barman-plugin-objectstore-viewer-role` |
42+
| `objectstore-editor-role` | `barman-plugin-objectstore-editor-role` |
4043

4144
### Namespace-scoped Resources
4245

43-
| Old Name | New Name | Namespace |
44-
|----------|----------|-----------|
45-
| `leader-election-role` | `barman-plugin-leader-election-role` | `cnpg-system` |
46+
| Old Name | New Name | Namespace |
47+
|-------------------------------|---------------------------------------------|---------------|
48+
| `leader-election-role` | `barman-plugin-leader-election-role` | `cnpg-system` |
4649
| `leader-election-rolebinding` | `barman-plugin-leader-election-rolebinding` | `cnpg-system` |
4750

4851
## Why This Change?
4952

50-
Using generic names for cluster-wide resources is discouraged as they may conflict with other components deployed in
51-
the same cluster. The new names make it clear that these resources belong to the barman-cloud plugin and help avoid
53+
Using generic names for cluster-wide resources is discouraged as they may
54+
conflict with other components deployed in the same cluster. The new names make
55+
it clear that these resources belong to the Barman Cloud plugin and help avoid
5256
naming collisions.
5357

5458
## Migration Instructions
5559

56-
This three steps migration process is straightforward and can be completed with a few kubectl commands.
60+
This three steps migration process is straightforward and can be completed with
61+
a few `kubectl` commands.
5762

5863
### Step 1: Upgrade plugin-barman-cloud
5964

60-
Please refer to the [Installation](installation.mdx) section to deploy the new plugin-barman-cloud release.
65+
Please refer to the [Installation](installation.mdx) section to deploy the new
66+
`plugin-barman-cloud` release.
6167

6268
### Step 2: Delete Old Cluster-scoped Resources
6369

6470
:::danger Verify Resources Before Deletion
65-
**IMPORTANT**: The old resource names are generic and could potentially belong to other components in your cluster.
71+
**IMPORTANT**: The old resource names are generic and could potentially belong
72+
to other components in your cluster.
6673

67-
**Before deleting each resource, verify it belongs to the Barman Cloud plugin by checking:**
74+
**Before deleting each resource, verify it belongs to the Barman Cloud plugin
75+
by checking:**
6876
- For `objectstore-*` roles: Look for `barmancloud.cnpg.io` in the API groups
69-
- For `metrics-*` roles: Check if they reference the `plugin-barman-cloud` ServiceAccount in `cnpg-system` namespace
77+
- For `metrics-*` roles: Check if they reference the `plugin-barman-cloud`
78+
ServiceAccount in `cnpg-system` namespace
7079
- For other roles: Look for labels like `app.kubernetes.io/name: plugin-barman-cloud`
7180

72-
If a resource doesn't have these indicators, **DO NOT DELETE IT** as it may belong to another application.
81+
If a resource doesn't have these indicators, **DO NOT DELETE IT** as it may
82+
belong to another application.
7383

74-
Carefully review the output of each verification command before proceeding with the `delete`.
84+
Carefully review the output of each verification command before proceeding with
85+
the `delete`.
7586
:::
7687

7788
:::tip Dry Run First
78-
You can add `--dry-run=client` to any `kubectl delete` command to preview what would be deleted without actually
79-
removing anything.
89+
You can add `--dry-run=client` to any `kubectl delete` command to preview what
90+
would be deleted without actually removing anything.
8091
:::
8192

8293
**Only proceed if you've verified these resources belong to the Barman Cloud
8394
plugin (see warning above).**
8495

85-
For each resource below, first verify it belongs to barman, then delete it:
96+
For each resource below, first verify it belongs to Barman Cloud, then delete
97+
it:
8698

8799
```bash
88100
# 1. Check metrics-auth-rolebinding FIRST (we'll check the role after)
89101
# Look for references to plugin-barman-cloud ServiceAccount
90102
kubectl describe clusterrolebinding metrics-auth-rolebinding
91-
# If it references plugin-barman-cloud ServiceAccount in cnpg-system namespace, delete it:
103+
# If it references plugin-barman-cloud ServiceAccount in cnpg-system namespace,
104+
# delete it:
92105
kubectl delete clusterrolebinding metrics-auth-rolebinding
93106

94107
# 2. Check metrics-auth-role
95108
# Look for references to authentication.k8s.io and authorization.k8s.io
96109
kubectl describe clusterrole metrics-auth-role
97110
# Verify it's not being used by any other rolebindings:
98-
kubectl get clusterrolebinding -o json | jq -r '.items[] | select(.roleRef.name=="metrics-auth-role") | .metadata.name'
99-
# If the above returns nothing (role is not in use) and the role looks like the barman one, delete it (see warnings section):
111+
kubectl get clusterrolebinding -o json \
112+
| jq -r '.items[] | select(.roleRef.name=="metrics-auth-role") \
113+
| .metadata.name'
114+
# If the above returns nothing (role is not in use) and the role looks like the
115+
# Barman Cloud one, delete it (see warnings section):
100116
kubectl delete clusterrole metrics-auth-role
101117

102118
# 3. Check objectstore-viewer-role
103-
# Look for barmancloud.cnpg.io API group or app.kubernetes.io/name: plugin-barman-cloud label
119+
# Look for barmancloud.cnpg.io API group or
120+
# for `app.kubernetes.io/name: plugin-barman-cloud` label
104121
kubectl describe clusterrole objectstore-viewer-role
105122
# If it shows barmancloud.cnpg.io in API groups, delete it:
106123
kubectl delete clusterrole objectstore-viewer-role
107124

108125
# 4. Check objectstore-editor-role
109-
# Look for barmancloud.cnpg.io API group or app.kubernetes.io/name: plugin-barman-cloud label
126+
# Look for barmancloud.cnpg.io API group or
127+
# for `app.kubernetes.io/name: plugin-barman-cloud` label
110128
kubectl describe clusterrole objectstore-editor-role
111129
# If it shows barmancloud.cnpg.io in API groups, delete it:
112130
kubectl delete clusterrole objectstore-editor-role
113131

114132
# 5. Check metrics-reader (MOST DANGEROUS - very generic name)
115133
# First, check if it's being used by any rolebindings OTHER than barman's:
116-
kubectl get clusterrolebinding -o json | jq -r '.items[] | select(.roleRef.name=="metrics-reader") | "\(.metadata.name) -> \(.subjects[0].name) in \(.subjects[0].namespace)"'
117-
# If this shows ANY rolebindings, review them carefully. Only proceed if they're all barman-related.
118-
# Then check the role itself:
134+
kubectl get clusterrolebinding -o json | jq -r '.items[] \
135+
| select(.roleRef.name=="metrics-reader") \
136+
| "\(.metadata.name) -> \(.subjects[0].name) in \(.subjects[0].namespace)"'
137+
# If this shows ANY rolebindings, review them carefully. Only proceed if
138+
# they're all Barman-related. Then check the role itself:
119139
kubectl describe clusterrole metrics-reader
120-
# If it ONLY has nonResourceURLs: /metrics and NO other rolebindings use it, delete it:
140+
# If it ONLY has nonResourceURLs: /metrics and NO other rolebindings use it,
141+
# delete it:
121142
kubectl delete clusterrole metrics-reader
122143
```
123144

124145
:::warning
125-
The `metrics-reader` role is particularly dangerous to delete blindly. Many monitoring systems use this exact name. Only delete it if:
146+
The `metrics-reader` role is particularly dangerous to delete blindly. Many
147+
monitoring systems use this exact name. Only delete it if:
148+
126149
1. You've verified it ONLY grants access to `/metrics`
127150
2. No other rolebindings reference it (checked with the jq command above)
128151
3. You're certain it was created by the Barman Cloud plugin
129152

130-
If you're unsure, it's safer to leave it and let the new `barman-plugin-metrics-reader` role coexist with it.
153+
If you're unsure, it's safer to leave it and let the new
154+
`barman-plugin-metrics-reader` role coexist with it.
131155
:::
132156

133-
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.
157+
If any resource is not found during the `describe` command, that's okay - it
158+
means it was never created or already deleted. Simply skip the delete command
159+
for that resource.
134160

135161
### Step 3: Delete Old Namespace-scoped Resources
136162

@@ -142,12 +168,17 @@ kubectl delete role leader-election-role -n cnpg-system
142168
kubectl delete rolebinding leader-election-rolebinding -n cnpg-system
143169
```
144170

145-
If any resource is not found, that's okay - it means it was never created or already deleted.
171+
If any resource is not found, that's okay - it means it was never created or
172+
already deleted.
146173

147174
## Impact
148175

149-
- **Permissions:** If you have custom RBAC rules or tools that reference the old resource names, they will need to be updated.
150-
- **External Users:** If end users have been granted the `objectstore-viewer-role` or `objectstore-editor-role`, they will need to be re-granted the new role names (`barman-plugin-objectstore-viewer-role` and `barman-plugin-objectstore-editor-role`).
176+
- **Permissions:** If you have custom RBAC rules or tools that reference the
177+
old resource names, they will need to be updated.
178+
- **External Users:** If end users have been granted the
179+
`objectstore-viewer-role` or `objectstore-editor-role`, they will need to be
180+
re-granted the new role names (`barman-plugin-objectstore-viewer-role` and
181+
`barman-plugin-objectstore-editor-role`).
151182

152183
## Verification
153184

@@ -184,4 +215,5 @@ If the plugin fails to start after migration, check:
184215

185216
## Support
186217

187-
If you encounter issues during migration, please open an issue on the [GitHub repository](https://github.com/cloudnative-pg/plugin-barman-cloud/issues).
218+
If you encounter issues during migration, please open an issue on the [GitHub
219+
repository](https://github.com/cloudnative-pg/plugin-barman-cloud/issues).

0 commit comments

Comments
 (0)