From f1ec6ceeab8d05feba74168075ca8a6f7f5a1627 Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Fri, 24 Feb 2023 18:04:17 +0800 Subject: [PATCH] chore: add finalizer for ghost and anonymous users (#3386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /area core #### What this PR does / why we need it: 为系统默认用户添加系统保护 finalizer,避免被删除 how to test it? ```shell curl -u username:password --basic 'http://localhost:8090/api/v1alpha1/users/ghost' curl -u username:password --basic 'http://localhost:8090/api/v1alpha1/users/anonymousUser' ``` 将看到 ```json "finalizers": [ "...", "system-protection" ] ``` #### Which issue(s) this PR fixes: Fixes # #### Special notes for your reviewer: /cc @halo-dev/sig-halo #### Does this PR introduce a user-facing change? ```release-note None ``` --- src/main/resources/extensions/user.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/resources/extensions/user.yaml b/src/main/resources/extensions/user.yaml index d1c18f88d..776b4aa07 100644 --- a/src/main/resources/extensions/user.yaml +++ b/src/main/resources/extensions/user.yaml @@ -2,6 +2,8 @@ apiVersion: v1alpha1 kind: User metadata: name: anonymousUser + finalizers: + - system-protection spec: displayName: Anonymous User email: anonymous@example.com @@ -12,6 +14,8 @@ apiVersion: v1alpha1 kind: User metadata: name: ghost + finalizers: + - system-protection spec: displayName: 已删除用户 email: ghost@example.com