backup

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package backup 은 백업/복구 컨텍스트의 조립 지점이다.

설계: docs/11_기능설계/Nullus_백업복구_설계.md (nullus-plan#75)

조립을 모듈 안에 두는 이유: 백업은 스택별 클러스터 어댑터를 요청 시점에 만들어야 해서 배선이 단순하지 않다. 그 복잡도를 cmd/api/main.go 에 흘리면 main 이 이 모듈의 내부 사정을 알게 된다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Pool            *pgxpool.Pool
	Config          config.BackupConfig
	PlatformDB      config.DatabaseConfig
	SecretRouter    *secrets.Router
	Kubeconfig      KubeconfigProvider
	TokenSources    bridge.AdminTokenSourceRepo
	RotationPausing Pausable
	// GatewayAliases 는 복구 뒤 러너·Argo CD hostAliases 를 게이트웨이의 지금 주소로 맞춘다(스택 모듈).
	GatewayAliases port.GatewayAliasRepinner
	// SharedComponents 는 복구 중 공용 자원을 되살리기 전에 cert-manager·metrics-server 를 다시
	// 세운다(스택 모듈의 설치기). 마지막 스택을 지운 클러스터로 되돌릴 때 필요하다.
	SharedComponents port.SharedComponentsEnsurer
	// Stacks 는 백업 세트가 "조직의 모든 설치 완료 스택" 을 읽는 창구다(스택 모듈의 저장소를 bridge 로 감싼다).
	// 없으면 세트 백업은 배선되지 않았다고 거절한다 — 단독 백업·복구는 영향이 없다.
	Stacks port.StackLister
	// Notifications 는 백업 결과를 조직의 알림 채널로 보내는 창구다(B3-3, 알림 모듈). 없으면 로그만 남긴다.
	Notifications sharednotify.Publisher
	// EncryptionKey 는 clusters.kubeconfig 복호화 키다 (ENCRYPTION_KEY).
	// 백업이 쓰지는 않지만, 복구 전제 조건 검사에 필요하다 — 이 키가 없으면
	// 복구해도 어떤 클러스터에도 접근할 수 없다 (§1.3).
	EncryptionKey   []byte
	PlatformVersion string
	Logger          *slog.Logger
}

type KubeconfigProvider

type KubeconfigProvider interface {
	GetKubeconfig(ctx context.Context, clusterID string) ([]byte, error)
}

KubeconfigProvider 는 클러스터 ID 로 kubeconfig 를 준다 (stack 모듈 제공).

type Module

type Module struct {
	Repo      *backuprepo.PostgresBackupRepository
	Verify    *usecase.VerifyUseCase
	Retention *usecase.RetentionUseCase
	// contains filtered or unexported fields
}

Module 은 조립된 백업 모듈이다.

func New

func New(d Deps) (*Module, error)

New 는 백업 모듈을 조립한다.

목적지나 키가 없으면 (nil, nil) 을 돌려준다 — 백업이 꺼진 것은 오류가 아니다. 다만 그 사실이 로그에 남아야 한다. "백업이 돌고 있다" 는 착각이 가장 비싸다 (§9 F10).

func (*Module) Backup

func (m *Module) Backup(ctx context.Context, stackID string) (*usecase.BackupUseCase, error)

Backup 은 스택별 백업 유스케이스를 만든다 (handler.UseCaseFactory).

func (*Module) BackupSet

func (m *Module) BackupSet(context.Context) (*usecase.BackupSetUseCase, error)

BackupSet 은 플랫폼 + 조직의 모든 스택을 한 세트로 뜨는 유스케이스를 만든다(설계 §6.7). 멤버마다 Backup(stackID) 로 그 스택 클러스터의 어댑터를 조립한다.

func (*Module) Restore

func (m *Module) Restore(ctx context.Context, stackID string) (*usecase.RestoreUseCase, error)

Restore 는 스택별 복구 유스케이스를 만든다.

func (*Module) RestoreSet

func (m *Module) RestoreSet(context.Context) (*usecase.RestoreSetUseCase, error)

RestoreSet 은 백업 세트를 플랫폼 → 스택 순서로 되돌리는 유스케이스를 만든다.

type Pausable

type Pausable interface {
	Pause()
	Resume()
}

Pausable 은 백업 정지 창 동안 멈출 수 있는 것이다 (토큰 회전 스케줄러).

Directories

Path Synopsis
adapter
bridge
Package bridge 는 다른 모듈의 공개 인터페이스로만 통하는 얇은 어댑터다.
Package bridge 는 다른 모듈의 공개 인터페이스로만 통하는 얇은 어댑터다.
handler
Package handler 는 백업/복구 HTTP 어댑터다.
Package handler 는 백업/복구 HTTP 어댑터다.
kube
Package kube 는 정지/재개, 볼륨 아카이브, 리소스 덤프의 Kubernetes 어댑터다.
Package kube 는 정지/재개, 볼륨 아카이브, 리소스 덤프의 Kubernetes 어댑터다.
notify
Package notify 는 백업 결과 알림 어댑터다 (B3-3).
Package notify 는 백업 결과 알림 어댑터다 (B3-3).
openbao
Package openbao 는 OpenBao KV 논리 export/import 어댑터다.
Package openbao 는 OpenBao KV 논리 export/import 어댑터다.
postgres
Package postgres 는 PostgreSQL 논리 백업/복원 어댑터다.
Package postgres 는 PostgreSQL 논리 백업/복원 어댑터다.
repository
Package repository 는 backup 컨텍스트의 저장 어댑터다.
Package repository 는 backup 컨텍스트의 저장 어댑터다.
sealer
Package sealer 는 산출물 암호화 구현체다.
Package sealer 는 산출물 암호화 구현체다.
store
Package store 는 백업 산출물 저장소 어댑터다.
Package store 는 백업 산출물 저장소 어댑터다.
Package port 는 backup 컨텍스트의 입출력 포트다.
Package port 는 backup 컨텍스트의 입출력 포트다.
Package scheduler 는 주기 백업과 보존 정책 적용을 돌린다 (B3-1).
Package scheduler 는 주기 백업과 보존 정책 적용을 돌린다 (B3-1).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL