Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Problem

The init-job deployment template (controllers/job/init/deploy/manifests/deploy.yaml.tmpl) did not provide default values for admin configuration environment variables. This could lead to "Invalid username or password" errors when these values were not explicitly configured during deployment, as the init-job would fail to create the admin user with the expected credentials.

Solution

Updated the deployment template to include default values for admin configuration environment variables, matching the defaults defined in controllers/job/init/internal/util/database/types.go:

  • ADMIN_PASSWORD: Now defaults to "sealos2023" (the default password defined in code)
  • ADMIN_USER_NAME: Added with default value "admin"
  • WORKSPACE_PREFIX: Added with default value "ns-"

These defaults ensure that the init-job can run successfully and create the admin user with the expected credentials even when these values are not explicitly provided in the deployment configuration.

Changes

env:
  - name: PASSWORD_SALT
    value: {{ .PASSWORD_SALT }}
  - name: ADMIN_PASSWORD
-   value: {{ .ADMIN_PASSWORD }}
+   value: {{ .ADMIN_PASSWORD | default "sealos2023" }}
+ - name: ADMIN_USER_NAME
+   value: {{ .ADMIN_USER_NAME | default "admin" }}
+ - name: WORKSPACE_PREFIX
+   value: {{ .WORKSPACE_PREFIX | default "ns-" }}

Benefits

  • Fixes the "Invalid username or password" issue when admin credentials are not explicitly configured
  • Reduces deployment complexity by providing sensible defaults
  • Maintains backward compatibility - custom values can still override the defaults
  • Aligns template with code defaults ensuring consistency across the codebase

Testing

  • Built the init-job controller successfully
  • Verified template rendering with multiple scenarios (no values, custom values, partial values)
  • Confirmed defaults match the constants in types.go

Closes #6090

Original prompt

This section details on the original issue you should resolve

<issue_title>Invalid usename or password</issue_title>
<issue_description>

Discussed in #6090

Originally posted by GlennZhang October 15, 2025
截屏2025-10-15 13 01 04

本地安装sealos,根据install-v2.sh完成安装后提示username和password为admin,sealos2023。但在网页端输入后显示Invalid usename or password。有什么方法可以解决或进行排查,能否重置密码或者开放注册吗。
另外我还看了下mongodb是否正常运行了。

root@slf:~/.sealos# kubectl get pod -n sealos -l app.kubernetes.io/instance=sealos-mongodb
NAME                       READY   STATUS    RESTARTS   AGE
sealos-mongodb-mongodb-0   3/3     Running   0          20h
```</div>


</issue_description>

<agent_instructions>Set the controllers/job/init/deploy/manifests/deploy.yaml.tmpl template of init-job to support the default password </agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

Fixes #6116


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix invalid username or password error on login feat(job/init): add default values for admin configuration in init-job deployment template Oct 24, 2025
Copilot AI requested a review from cuisongliu October 24, 2025 09:54
…onment variables in deploy template

Co-authored-by: cuisongliu <[email protected]>
@cuisongliu cuisongliu force-pushed the copilot/fix-invalid-username-password branch from fd3e1d9 to 68c6c01 Compare October 24, 2025 10:02
@cuisongliu cuisongliu added this to the v5.1 milestone Oct 24, 2025
@cuisongliu cuisongliu marked this pull request as ready for review October 24, 2025 10:02
@cuisongliu cuisongliu requested a review from a team as a code owner October 24, 2025 10:02
@cuisongliu cuisongliu merged commit 8966c53 into main Oct 24, 2025
21 of 34 checks passed
@cuisongliu cuisongliu deleted the copilot/fix-invalid-username-password branch October 24, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid usename or password

3 participants