Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插件安装之后无法保存设置 #3224

Closed
ruibaby opened this issue Feb 4, 2023 · 2 comments · Fixed by #3236
Closed

插件安装之后无法保存设置 #3224

ruibaby opened this issue Feb 4, 2023 · 2 comments · Fixed by #3236
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@ruibaby
Copy link
Member

ruibaby commented Feb 4, 2023

是什么版本出现了此问题?

2.2.0

使用的什么数据库?

H2

使用的哪种方式部署?

Docker

在线站点地址

https://halo.run

发生了什么?

image

如图,具体表现为点击保存按钮无任何反应,原因可能是因为安装之后 configmap 没有正常初始化,比如 /apis/api.console.halo.run/v1alpha1/plugins/PluginFeed/config 接口是空的 Response。

临时解决方案:一般重启插件之后可以恢复正常。

/area core
/kind bug

相关日志输出

No response

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug. labels Feb 4, 2023
@guqing
Copy link
Member

guqing commented Feb 6, 2023

/triage accepted
/assign

@f2c-ci-robot f2c-ci-robot bot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Feb 6, 2023
@guqing
Copy link
Member

guqing commented Feb 6, 2023

原因分析:
插件安装时先创建 plugin.yaml 然后判断是否配置了 settingName,如果设置了则需要根据 settingName 查询 Setting 然后读取默认值创建 ConfigMap
但此时查询 Setting 可能还查询不到,由于插件启动才会创建 Setting 且这个过程是异步的,而查询不到 Setting 就跳过了读取默认值的逻辑所以导致 ConfigMap 没有创建。

解决思路:如果 plugin.yaml 中配置了 settingName ,则默认为插件中一定有 Setting 对应的 yaml 它最终会被创建到数据库,如果没有则就是异常情况,所以当查询 Setting 没有获取到时将插件标记为 Failed 状态并抛出异常,然后会被 reconciler 重试,等到能查询到时即可继续完成剩余步骤。

f2c-ci-robot bot pushed a commit that referenced this issue Feb 8, 2023
…ause of asynchrony (#3236)

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.2.x
/cherry-pick release-2.2
#### What this PR does / why we need it:
修复插件安装时有几率出现设置没有默认值导致无法保存的问题

see #3224 (comment) for more details

#### Which issue(s) this PR fixes:

Fixes #3224

#### Special notes for your reviewer:
how to test it?
1. 安装 https://github.com/halo-sigs/plugin-feed 插件并立即启用(或以开发模式)
2. 到此插件设置**始终**能查询到默认值并且能保存

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
修复插件安装时有几率出现设置没有默认值导致无法保存的问题
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants