kube

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: 27 Imported by: 0

Documentation

Index

Constants

View Source
const ImagePullSecretName = "nullus-registry" // #nosec G101 -- Secret 리소스 이름

ImagePullSecretName 은 앱 네임스페이스에 만드는 pull 자격증명 이름이다. 스캐폴딩된 Deployment 가 이 이름을 참조한다.

Variables

This section is empty.

Functions

func RenderImagePullSecret

func RenderImagePullSecret(spec ImagePullSecretSpec) (string, error)

RenderImagePullSecret 은 kubelet 이 private 레지스트리에서 이미지를 받아올 dockerconfigjson Secret 을 만든다.

없으면 pull 이 "failed to fetch anonymous token: 403" 으로 실패한다.

func RenderNamespace

func RenderNamespace(name string) (string, error)

RenderNamespace 는 네임스페이스 매니페스트를 만든다.

pull 자격증명을 넣으려면 네임스페이스가 먼저 있어야 하는데, Argo CD 의 CreateNamespace 는 첫 동기화 시점에야 만든다.

Types

type ArgoApplicationDeleter

type ArgoApplicationDeleter struct{}

ArgoApplicationDeleter 는 Argo CD Application 과 그것이 배포한 리소스를 지운다.

func NewArgoApplicationDeleter

func NewArgoApplicationDeleter() *ArgoApplicationDeleter

func (*ArgoApplicationDeleter) DeleteApplication

func (d *ArgoApplicationDeleter) DeleteApplication(
	ctx context.Context,
	kubeconfig []byte,
	namespace, name string,
) error

Delete 는 Application 에 정리 finalizer 를 붙인 뒤 삭제한다.

순서가 중요하다. 먼저 지우면 Argo CD 컨트롤러가 정리할 대상 정보를 잃어 워크로드가 고아로 남는다. 생성 시점에 finalizer 를 넣지 않는 이유는, 그러면 Application 을 손으로 지울 때도 항상 배포까지 함께 사라져 되돌릴 수 없기 때문이다 — 파괴적 동작은 삭제를 요청한 이 시점에만 켠다.

Application 이 이미 없으면 성공으로 본다.

type ImagePullSecretSpec

type ImagePullSecretSpec struct {
	Namespace    string
	RegistryHost string
	Username     string
	Password     string
}

ImagePullSecretSpec 은 pull 자격증명 요청이다.

type LogEvent

type LogEvent struct {
	DeploymentID string
	StepIndex    int
	Level        string
	Message      string
	Progress     int
	Status       string
	Timestamp    time.Time
}

type ManifestApplier

type ManifestApplier struct {
	Tracker *StepTracker
}

ManifestApplier applies K8s manifests using the dynamic client.

func NewManifestApplier

func NewManifestApplier() *ManifestApplier

func (*ManifestApplier) Apply

func (a *ManifestApplier) Apply(ctx context.Context, kubeconfig []byte, manifests []string) error

func (*ManifestApplier) ApplyWithTracking

func (a *ManifestApplier) ApplyWithTracking(ctx context.Context, kubeconfig []byte, manifests []string, deploymentID string, stepOffset ...int) error

ApplyWithTracking applies manifests and reports step progress to the tracker.

type StepTracker

type StepTracker struct {
	// contains filtered or unexported fields
}

StepTracker stores deploy steps in memory for active deployments.

func NewStepTracker

func NewStepTracker() *StepTracker

func (*StepTracker) AppendLog

func (t *StepTracker) AppendLog(deploymentID string, index int, line string)

AppendLog appends a log line to the specified step.

func (*StepTracker) Get

func (t *StepTracker) Get(deploymentID string) []domain.DeployStep

func (*StepTracker) Init

func (t *StepTracker) Init(deploymentID string, stepNames []string)

func (*StepTracker) MarkFailed

func (t *StepTracker) MarkFailed(deploymentID string, index int, message string)

func (*StepTracker) MarkRunning

func (t *StepTracker) MarkRunning(deploymentID string, index int, kind string)

func (*StepTracker) MarkSuccess

func (t *StepTracker) MarkSuccess(deploymentID string, index int, message string)

func (*StepTracker) Remove

func (t *StepTracker) Remove(deploymentID string)

func (*StepTracker) Subscribe

func (t *StepTracker) Subscribe(deploymentID string) chan LogEvent

func (*StepTracker) Unsubscribe

func (t *StepTracker) Unsubscribe(deploymentID string, ch chan LogEvent)

type WorkloadDeleter

type WorkloadDeleter struct{}

WorkloadDeleter 는 라벨 셀렉터로 워크로드를 지운다.

func NewWorkloadDeleter

func NewWorkloadDeleter() *WorkloadDeleter

func (*WorkloadDeleter) DeleteByLabel

func (d *WorkloadDeleter) DeleteByLabel(
	ctx context.Context,
	kubeconfig []byte,
	namespace, selector string,
) error

DeleteByLabel 은 네임스페이스에서 셀렉터에 걸리는 리소스를 지운다.

없는 것은 성공으로 본다 — Argo CD 로 배포한 앱에는 지울 것이 없고, 그 경우까지 실패로 만들면 정상 삭제가 막힌다.

Jump to

Keyboard shortcuts

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