kube

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImagePullSecretNameFor added in v0.6.0

func ImagePullSecretNameFor(app string) string

ImagePullSecretNameFor 는 앱 네임스페이스에 만드는 그 앱의 pull 자격증명 이름이다. 스캐폴딩된 Deployment 가 이 이름을 참조한다. 백업이 같은 자격증명을 담아야 하므로 공용 도메인이 갖는다.

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 는 첫 동기화 시점에야 만든다.

func RenderScanPolicyConfigMap added in v0.6.0

func RenderScanPolicyConfigMap(namespace string, vars []port.ProjectVariable) (string, error)

RenderScanPolicyConfigMap 은 CI 변수 저장소가 없는 CI(Jenkins)가 읽는 스캔 정책 ConfigMap 을 만든다.

스택 네임스페이스에 하나다. Jenkinsfile 의 스캐너 컨테이너가 envFrom 으로 읽으므로, 정책을 바꾸면 그 스택의 Jenkins 파이프라인 전체가 다음 실행부터 따른다. 비밀이 아니라 Secret 이 아니다.

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 ArgoApplicationRefresher added in v0.6.0

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

ArgoApplicationRefresher 는 Application 의 첫 비교를 확인하고 필요하면 다시 읽게 한다.

func NewArgoApplicationRefresher added in v0.6.0

func NewArgoApplicationRefresher() *ArgoApplicationRefresher

func (*ArgoApplicationRefresher) EnsureFirstComparison added in v0.6.0

func (r *ArgoApplicationRefresher) EnsureFirstComparison(
	ctx context.Context,
	kubeconfig []byte,
	namespace, name string,
) error

EnsureFirstComparison 은 첫 비교가 저장소를 읽을 때까지 잠깐 기다린다.

비교 오류가 보이면 refresh 를 요청하고, 컨트롤러가 그것을 처리한 뒤(주석이 지워진 뒤) 에도 오류가 남으면 한 번 더 요청한다. 횟수를 다 쓰고도 남으면 그 이유를 돌려준다. 컨트롤러가 아직 비교하지 않았거나 요청한 refresh 를 처리하지 못한 채 시간이 다 되면 조용히 넘긴다 — Argo CD 가 곧 처리할 것이고, 결과를 모르는 채 경고하지 않는다.

type ExternalSecretDeleter added in v0.6.0

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

ExternalSecretDeleter 는 파이프라인 자격증명 ExternalSecret 을 지운다.

func NewExternalSecretDeleter added in v0.6.0

func NewExternalSecretDeleter() *ExternalSecretDeleter

func (*ExternalSecretDeleter) DeleteCredentialObject added in v0.6.0

func (d *ExternalSecretDeleter) DeleteCredentialObject(
	ctx context.Context,
	kubeconfig []byte,
	obj port.PipelineCredentialObject,
) error

DeleteCredentialObject 는 이 파이프라인이 만든 ExternalSecret 만 지운다.

플랫폼 표시가 있으면 지운다. 표시가 붙기 전에 만든 것은 원격 키가 모두 이 파이프라인의 금고 경로 아래일 때만 지운다 — 같은 네임스페이스에서 스택 모듈도 같은 SecretStore 로 ExternalSecret 을 만든다. 읽은 그 객체만 지운다(UID 전제 조건).

type GatewayLocator added in v0.6.0

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

GatewayLocator 는 스택 네임스페이스의 게이트웨이를 조회한다.

func NewGatewayLocator added in v0.6.0

func NewGatewayLocator() *GatewayLocator

NewGatewayLocator 는 kubeconfig 로 클러스터에 붙는 조회기를 만든다.

func (*GatewayLocator) LocateGateway added in v0.6.0

func (l *GatewayLocator) LocateGateway(ctx context.Context, kubeconfig []byte, namespace, preferred string) (string, error)

LocateGateway 는 namespace 의 게이트웨이 가운데 앱이 붙을 것을 고른다(chooseGateway).

type ImagePullSecretSpec

type ImagePullSecretSpec struct {
	// AppName 은 자격증명을 쓸 앱이다. Secret 이름이 앱마다 따로다(ImagePullSecretNameFor).
	AppName      string
	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 ManagedSecretDeleter added in v0.6.0

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

ManagedSecretDeleter 는 플랫폼 표시가 있는 Secret 만 이름으로 지운다.

func NewManagedSecretDeleter added in v0.6.0

func NewManagedSecretDeleter() *ManagedSecretDeleter

func (*ManagedSecretDeleter) DeleteManagedSecret added in v0.6.0

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

DeleteManagedSecret 은 Secret 을 읽어 플랫폼 표시를 확인한 뒤 지운다.

읽은 그 객체만 지운다(UID 전제 조건) — 확인과 삭제 사이에 누가 같은 이름으로 다시 만들었다면 그것은 건드리지 않는다.

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