Skip to content

support lifecycle#23

Open
w-a-n-g-s-h-u-n wants to merge 1 commit intoapolloconfig:mainfrom
w-a-n-g-s-h-u-n:patch-1
Open

support lifecycle#23
w-a-n-g-s-h-u-n wants to merge 1 commit intoapolloconfig:mainfrom
w-a-n-g-s-h-u-n:patch-1

Conversation

@w-a-n-g-s-h-u-n
Copy link

@w-a-n-g-s-h-u-n w-a-n-g-s-h-u-n commented Jan 23, 2026

添加下面env后,可用于覆盖前端页面文件

  • name: _JAVA_OPTIONS value: >- -Dspring.web.resources.static-locations=file:./static/,classpath:/static/

Summary by CodeRabbit

  • New Features
    • Enhanced deployment configuration with support for container lifecycle hooks, enabling customization of pre-startup and post-shutdown behaviors through configuration values.

✏️ Tip: You can customize this high-level summary in your review settings.

添加下面env后,可用于覆盖前端页面文件
- name: _JAVA_OPTIONS
              value: >-
                -Dspring.web.resources.static-locations=file:./static/,classpath:/static/
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

A lifecycle configuration block is added to the container specification in the Kubernetes deployment template by injecting a lifecycle section sourced from Helm values into the existing resources configuration block.

Changes

Cohort / File(s) Change Summary
Lifecycle Configuration
apollo-portal/templates/deployment-portal.yaml
Injects lifecycle block from Helm values into the container spec within the resources section (+2 lines)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A lifecycle takes root in YAML's embrace,
Values flow softly into their rightful place,
Two gentle lines, a config so fine,
The container now blooms on its schedule divine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'support lifecycle' is vague and generic, using a non-descriptive term that doesn't clearly convey the specific change being made. Use a more descriptive title that specifies what lifecycle support is being added, such as 'Add lifecycle hooks to deployment container spec' or 'Support container lifecycle configuration in deployment template.'
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@w-a-n-g-s-h-u-n
Copy link
Author

结合-Dspring.web.resources.static-locations=file:./static/,classpath:/static/ 和 lifecycle.postStart 可以实现不改代码覆盖前端网页

@nobodyiam
Copy link
Member

感谢你的贡献!支持 lifecycle 配置是一个很有用的功能 👍

我看了一下代码,有几点建议:

1. 建议添加条件判断

当前实现在未配置 lifecycle 时会生成空字段,建议修改为:

{{- with .Values.lifecycle }}
lifecycle:
  {{- toYaml . | nindent 12 }}
{{- end }}

这样只有在配置了 lifecycle 时才会渲染这部分内容。

2. 缺少 values.yaml 配置

建议在 apollo-portal/values.yaml 中添加配置项和使用说明,例如:

# Lifecycle hooks for the portal container
# lifecycle:
#   postStart:
#     exec:
#       command: ["/bin/sh", "-c", "echo Container started"]
#   preStop:
#     exec:
#       command: ["/bin/sh", "-c", "sleep 15"]
lifecycle: {}

3. PR 描述建议优化

PR 描述中提到的 _JAVA_OPTIONS 环境变量和本次代码改动关系不太明确。建议更新 PR 描述,说明 lifecycle 的使用场景,比如:

  • 用于在容器启动前准备静态资源文件
  • 用于在容器停止前优雅关闭连接等

4. 文档补充

如果方便的话,可以考虑在 README 或相关文档中补充 lifecycle 的配置说明和使用示例。

如果你能补充以上内容(至少是第 1、2 点),我们就可以合并这个 PR 了。再次感谢!

nobodyiam

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants