Skip to content

Commit

Permalink
Update the doc with correct annotation to disable druid managed resou…
Browse files Browse the repository at this point in the history
…rce protection via the webhook. (#907)
  • Loading branch information
ishan16696 authored Nov 7, 2024
1 parent fab4318 commit b4b759e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func GetSuspendEtcdSpecReconcileAnnotationKey(etcdObjMeta metav1.ObjectMeta) *st
return nil
}

// AreManagedResourcesProtected returns false if the Etcd resource has the `druid.gardener.cloud/disable-resource-protection` annotation set,
// AreManagedResourcesProtected returns false if the Etcd resource has the `druid.gardener.cloud/disable-etcd-component-protection` annotation set,
// else returns true.
func AreManagedResourcesProtected(etcdObjMeta metav1.ObjectMeta) bool {
return !metav1.HasAnnotation(etcdObjMeta, DisableEtcdComponentProtectionAnnotation)
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/managing-etcd-clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ We provide a generic way to suspend etcd cluster reconciliation via etcd-druid,
2. Add another annotation to the target `Etcd` resource disabling managed resource protection via the webhook. You can do this by invoking the following command:

```bash
kubectl annotate etcd etcd-main -n <namespace> druid.gardener.cloud/disable-resource-protection=
kubectl annotate etcd etcd-main -n <namespace> druid.gardener.cloud/disable-etcd-component-protection=
```

Now you are free to make changes to any managed etcd cluster resource.
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/recovering-etcd-clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The above annotation will prevent any reconciliation by etcd-druid for this `Etc
Add another annotation to the `Etcd` resource:
```bash
kubectl annotate etcd etcd-main -n <namespace> druid.gardener.cloud/disable-resource-protection=
kubectl annotate etcd etcd-main -n <namespace> druid.gardener.cloud/disable-etcd-component-protection=
```
The above annotation will allow manual edits to `Etcd` cluster resources that are managed by etcd-druid.
Expand Down Expand Up @@ -122,7 +122,7 @@ If both containers report readiness (as seen above), then the etcd-cluster is co
All manual changes are now done. We must now re-enable etcd-cluster resource protection and also enable reconciliation by etcd-druid by doing the following:
```bash
kubectl annotate etcd <etcd-name> -n <namespace> druid.gardener.cloud/suspend-etcd-spec-reconcile-
kubectl annotate etcd <etcd-name> -n <namespace> druid.gardener.cloud/disable-resource-protection-
kubectl annotate etcd <etcd-name> -n <namespace> druid.gardener.cloud/disable-etcd-component-protection-
```
#### 09-Scale-up Etcd Cluster to 3 and trigger reconcile
Expand Down
2 changes: 1 addition & 1 deletion internal/webhook/etcdcomponents/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (h *Handler) Handle(ctx context.Context, req admission.Request) admission.R
return admission.Allowed(fmt.Sprintf("resource: %v is not part of any Etcd, skipping validations", util.CreateObjectKey(partialObjMeta))).WithWarnings(warnings...)
}

// allow changes to resources if Etcd has annotation druid.gardener.cloud/disable-resource-protection is set.
// allow changes to resources if Etcd has annotation druid.gardener.cloud/disable-etcd-component-protection is set.
if !druidv1alpha1.AreManagedResourcesProtected(etcd.ObjectMeta) {
return admission.Allowed(fmt.Sprintf("changes allowed, since Etcd %s has annotation %s", etcd.Name, druidv1alpha1.DisableEtcdComponentProtectionAnnotation))
}
Expand Down

0 comments on commit b4b759e

Please sign in to comment.