port

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCompatibilityMatrixNotFound = errors.New("compatibility matrix not found")
	ErrCompatibilityMatrixExists   = errors.New("compatibility matrix already exists")
)

Sentinel errors exposed so handlers can map to HTTP status without string matching. F8-Phase5 (재개) introduces CRUD on compatibility matrices; admin endpoints distinguish 404 (not found) vs 409 (already exists) based on these values.

Functions

This section is empty.

Types

type ClusterReader

type ClusterReader interface {
	GetClusterSummary(ctx context.Context, clusterID string) (*ClusterSummary, error)
}

ClusterReader is a read-only port the Stack context uses to pull cluster facts (e.g. node architectures) that the Pre-Deploy Gate needs when cross-checking ToolVersion.ArchSupport. Implemented by an adapter that either queries the admin database directly (modular monolith) or calls the admin service (microservice split).

type ClusterSummary

type ClusterSummary struct {
	ID                string   `json:"id"`
	OrgID             string   `json:"org_id"`
	NodeArchitectures []string `json:"node_architectures"`
}

ClusterSummary is the minimum subset of Cluster context the Stack module needs from the Admin module. Kept separate from admin/domain.Cluster so the Stack bounded context never imports admin internals directly.

type CompatibilityRepository

type CompatibilityRepository interface {
	GetAll(ctx context.Context) ([]*domain.CompatibilityMatrix, error)
	GetByID(ctx context.Context, id string) (*domain.CompatibilityMatrix, error)
	Validate(ctx context.Context, tools map[string]string) (*domain.CompatibilityMatrix, error)

	// Create persists a new matrix. Returns ErrCompatibilityMatrixExists
	// when the id collides with an existing row.
	Create(ctx context.Context, m *domain.CompatibilityMatrix) error
	// Update replaces every mutable field on the matrix identified by
	// m.ID. Returns ErrCompatibilityMatrixNotFound when the row is
	// missing; no-op partial-update semantics — callers send the full
	// desired state.
	Update(ctx context.Context, m *domain.CompatibilityMatrix) error
	// Delete removes the matrix. Idempotent — missing row returns nil so
	// the admin UI can re-issue delete on an already-deleted id without
	// error. Handlers map post-facto 404s via GetByID when strict
	// semantics are desired.
	Delete(ctx context.Context, id string) error
}

CompatibilityRepository defines the interface for compatibility matrix persistence.

type HelmInstallRequest

type HelmInstallRequest struct {
	ReleaseName string         `json:"release_name"`
	ChartName   string         `json:"chart_name"`
	RepoURL     string         `json:"repo_url"`
	Version     string         `json:"version"`
	Namespace   string         `json:"namespace"`
	Values      map[string]any `json:"values"`
	Wait        *bool          `json:"wait,omitempty"`
}

HelmInstallRequest contains parameters for a Helm install operation.

type HelmInstallResult

type HelmInstallResult struct {
	ReleaseName string `json:"release_name"`
	Namespace   string `json:"namespace"`
	Status      string `json:"status"`
	Revision    int    `json:"revision"`
}

HelmInstallResult contains the result of a Helm install operation.

type HelmInstaller

type HelmInstaller interface {
	Install(ctx context.Context, req HelmInstallRequest) (*HelmInstallResult, error)
	Uninstall(ctx context.Context, releaseName, namespace string) error
	Status(ctx context.Context, releaseName, namespace string) (*HelmInstallResult, error)
}

HelmInstaller defines the interface for Helm chart operations.

type HelmReleaseManager

type HelmReleaseManager interface {
	ListReleases(ctx context.Context, namespace string) ([]ReleaseInfo, error)
	// GetValues 는 사용자가 지정한 values(= 설치 때 우리가 넘긴 값)를 돌려준다.
	// 차트 기본값까지 합친 전체가 아니라, 실제로 배포에 쓰인 우리 입력이다.
	GetValues(ctx context.Context, releaseName, namespace string) (map[string]any, error)
	Upgrade(ctx context.Context, req HelmUpgradeRequest) (*HelmUpgradeResult, error)
}

HelmReleaseManager 는 배포된 릴리스의 values 를 읽고 다시 적용한다.

type HelmStepMetadataRepository

type HelmStepMetadataRepository interface {
	Create(ctx context.Context, item *domain.HelmStepMetadata) error
	Update(ctx context.Context, item *domain.HelmStepMetadata) error
	Delete(ctx context.Context, stepName string) error
	GetByStep(ctx context.Context, stepName string) (*domain.HelmStepMetadata, error)
	List(ctx context.Context) ([]*domain.HelmStepMetadata, error)
}

HelmStepMetadataRepository defines persistence for DB-backed Helm step metadata.

type HelmUpgradeRequest

type HelmUpgradeRequest struct {
	ReleaseName string
	Namespace   string
	Values      map[string]any
	// DryRun 이면 클러스터를 건드리지 않고 렌더 결과만 돌려준다.
	DryRun bool
}

HelmUpgradeRequest 는 values 만 교체하는 업그레이드 요청이다. 차트는 릴리스에 저장된 것을 그대로 재사용하므로 여기서 받지 않는다 — 설정 변경이 의도치 않은 차트 버전 업그레이드를 끌고 오면 안 된다.

type HelmUpgradeResult

type HelmUpgradeResult struct {
	ReleaseName string
	Namespace   string
	Revision    int
	Status      string
	// Manifest 는 렌더된 매니페스트다. 드라이런에서 변경 내용을 보여주는 데 쓴다.
	Manifest string
}

HelmUpgradeResult 는 업그레이드(또는 드라이런) 결과다.

type HistoryRepository

type HistoryRepository interface {
	SaveVersion(ctx context.Context, version *domain.StackVersion) error
	ListVersions(ctx context.Context, stackID string) ([]*domain.StackVersion, error)
	GetVersion(ctx context.Context, stackID, versionID string) (*domain.StackVersion, error)
	GetDiff(ctx context.Context, stackID, versionID string) ([]domain.ConfigDiff, error)
}

HistoryRepository defines the interface for stack version history persistence.

type KubeconfigProvider

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

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Level     string    `json:"level"` // info, warn, error
	Step      string    `json:"step"`  // e.g. "installing_minio", "configuring_argocd"
	Message   string    `json:"message"`
	Phase     string    `json:"phase"` // A, B, C
}

LogEntry represents a single log event emitted during a deployment.

type LogStreamer

type LogStreamer interface {
	// Stream publishes a log entry for the given deploymentID.
	Stream(ctx context.Context, deploymentID string, entry LogEntry)
	// Subscribe returns a channel that receives log entries for the given deploymentID.
	Subscribe(deploymentID string) <-chan LogEntry
	// Unsubscribe removes the given channel from the subscriber list for deploymentID.
	Unsubscribe(deploymentID string, ch <-chan LogEntry)
}

LogStreamer defines the interface for publishing and consuming deployment log entries.

type ReleaseInfo

type ReleaseInfo struct {
	ReleaseName string `json:"release_name"`
	// StepName 은 이 릴리스를 만든 설치 단계다. YAML 오버라이드를 어느 키로
	// 저장할지 결정하므로 비어 있으면 편집 결과가 재배포 때 유실된다.
	StepName     string `json:"step_name,omitempty"`
	ChartName    string `json:"chart_name,omitempty"`
	ChartVersion string `json:"chart_version,omitempty"`
	AppVersion   string `json:"app_version,omitempty"`
	Namespace    string `json:"namespace"`
	Revision     int    `json:"revision"`
	Status       string `json:"status"`
}

ReleaseInfo 는 클러스터에 실제로 올라가 있는 Helm 릴리스 한 건이다.

type ResourceDefaultRepository

type ResourceDefaultRepository interface {
	List(ctx context.Context) ([]*domain.ResourceDefault, error)
	Upsert(ctx context.Context, resource *domain.ResourceDefault) error
}

type SSOClientSpec

type SSOClientSpec struct {
	// StepName 은 대상 도구를 식별한다 (예: installing_grafana).
	StepName string
	// ClientSecret 은 Nullus 가 생성해 OpenBao 에 기록한 값이다.
	ClientSecret string
}

SSOClientSpec 은 OIDC 클라이언트 등록에 필요한 정보다.

type SSOProvisioner

type SSOProvisioner interface {
	// ClientIDFor 는 스택 네임스페이스가 적용된 client ID 를 돌려준다.
	ClientIDFor(stepName string) (string, bool)
	// ToolSteps 는 SSO 대상 스텝 목록이다.
	ToolSteps() []string
	// Provision 은 클라이언트를 등록하거나 갱신한다.
	Provision(ctx context.Context, spec SSOClientSpec) error
	// Deprovision 은 등록했던 클라이언트를 지운다.
	//
	// 스택을 지워도 이걸 부르지 않으면 realm 에 존재하지 않는 도구를 가리키는
	// redirect URI 가 계속 남는다. 구현은 진작 있었는데 이 인터페이스에 없어서
	// stack 모듈이 부를 방법이 없었다.
	Deprovision(ctx context.Context, stepName string) error
}

SSOProvisioner 는 설치된 OSS 의 OIDC 클라이언트를 IdP 에 등록한다.

stack 모듈이 auth 모듈의 구현을 직접 import 하면 모듈 간 직접 의존 금지 규칙에 어긋나므로, 여기에 인터페이스를 두고 main 에서 구현체를 주입한다.

type SSOProvisionerFactory

type SSOProvisionerFactory func(accessDomain, stackSlug string) SSOProvisioner

SSOProvisionerFactory 는 스택별 접속 도메인/슬러그로 provisioner 를 만든다.

type StackRepository

type StackRepository interface {
	Create(ctx context.Context, stack *domain.Stack) error
	GetByID(ctx context.Context, id string) (*domain.Stack, error)
	FindByID(ctx context.Context, id string) (*domain.Stack, error)
	List(ctx context.Context, orgID string, includeDeleted bool) ([]*domain.Stack, error)
	// ListInFlight 는 설치가 진행 중인 상태로 남아 있는 스택을 조직과 무관하게
	// 돌려준다. 끊긴 설치를 찾아내는 데 쓴다 — 그것은 조직 경계와 무관한 일이다.
	ListInFlight(ctx context.Context) ([]*domain.Stack, error)
	Update(ctx context.Context, stack *domain.Stack) error
	// TouchUpdatedAt 은 갱신 시각만 찍는다.
	//
	// 설치가 도는 동안 살아 있음을 알리는 데 쓴다. Update 를 쓰지 않는 이유는
	// 그쪽이 메모리에 든 스택 전체를 다시 쓰기 때문이다 — 오래된 사본으로
	// 하트비트를 찍으면 그 사이 다른 경로가 바꾼 값을 되돌린다.
	TouchUpdatedAt(ctx context.Context, stackID string) error
	UpdateTools(ctx context.Context, stack *domain.Stack) error
	Delete(ctx context.Context, id string) error
}

StackRepository defines the interface for stack persistence.

type StepExecutor

type StepExecutor interface {
	ExecuteStep(ctx context.Context, stackID, step, phase string) error
}

StepExecutor maps install step names to real infrastructure operations. Nil-safe: the usecase falls back to simulation when executor is nil.

type TemplateRepository

type TemplateRepository interface {
	Create(ctx context.Context, template *domain.Template) error
	Update(ctx context.Context, template *domain.Template) error
	Delete(ctx context.Context, id string) error
	GetByID(ctx context.Context, id string) (*domain.Template, error)
	List(ctx context.Context) ([]*domain.Template, error)
}

TemplateRepository defines the interface for template persistence.

type TokenSourceInput

type TokenSourceInput struct {
	OrgID         string
	Module        string
	Provider      string
	Path          string
	TokenType     string
	Status        string
	SecretManager string
	TokenValue    string
	// StackID 가 있으면 그 스택의 시크릿 저장소에 기록한다.
	//
	// OpenBao 는 스택마다 배포되므로 전역 저장소에 써 두면 스택 범위로 읽는
	// 쪽(cicd 모듈)이 값을 찾지 못한다. 비면 예전처럼 전역 저장소를 쓴다.
	StackID string
	// Metadata 는 토큰과 함께 보관할 접속 정보다 (예: GitHub organization).
	// 토큰만으로는 어디에 붙어야 할지 알 수 없는 외부 SaaS 에 필요하다.
	Metadata map[string]string
	// ClusterID / Namespace 는 회전 후 반영(rolling restart) 대상을 찾는 데 쓴다.
	ClusterID string
	Namespace string
}

type TokenSourceRegistry

type TokenSourceRegistry interface {
	Upsert(ctx context.Context, input TokenSourceInput) error
}

TokenSourceRegistry tracks OpenBao token metadata for stack integrations.

Jump to

Keyboard shortcuts

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