chore: add finalizer for ghost and anonymous users (#3386)

#### 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
```
pull/3363/head^2
guqing 2023-02-24 18:04:17 +08:00 committed by GitHub
parent 3330ff8c3d
commit f1ec6ceeab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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