refactor: 集中显式注入并归位凭据领域规则
Verify / test (pull_request) Successful in 13m29s
Verify / lint (pull_request) Successful in 14m13s
Verify / database-integration (pull_request) Successful in 15m48s

This commit is contained in:
2026-09-27 19:16:48 +00:00
parent 72ce3eda40
commit 7834cab97f
34 changed files with 612 additions and 259 deletions
@@ -0,0 +1,28 @@
package kubernetes
import credentialdomain "git.ddupan.top/panxiao81/ayatori/internal/database/domain/credential"
const credentialsReadyCondition = "CredentialsReady"
// 持久化 API 的 Reason 保持兼容,领域内部只使用准备阶段。
var credentialReasons = map[credentialdomain.Phase]string{
credentialdomain.Pending: "PreparationPending",
credentialdomain.Pinned: "LocationPinned",
credentialdomain.Creating: "CreationStarted",
credentialdomain.Prepared: "CredentialPrepared",
credentialdomain.Conflict: "Conflict",
credentialdomain.Unavailable: "DependencyUnavailable",
credentialdomain.Stopped: "PreparationStopped",
credentialdomain.InvalidTarget: "InvalidTarget",
}
func credentialReason(phase credentialdomain.Phase) string { return credentialReasons[phase] }
func credentialPhase(reason string) credentialdomain.Phase {
for phase, value := range credentialReasons {
if value == reason {
return phase
}
}
return credentialdomain.Pending
}