Documentation
¶
Overview ¶
Package provisioning 은 스택 정보를 보고 프로비저닝 도구 묶음을 조립한다.
GitLab 주소·토큰·레지스트리 종류가 모두 스택마다 다르므로 기동 시점에 하나로 만들 수 없다. 요청 시점에 스택을 읽어 조립한다.
Index ¶
- type BundleFactory
- func (f *BundleFactory) For(ctx context.Context, stackID string) (*port.SCMBundle, error)
- func (f *BundleFactory) RepositoryLocation(ctx context.Context, stackID string) (*port.RepositoryLocation, error)
- func (f *BundleFactory) WithGatewayLocator(gateways port.GatewayLocator) *BundleFactory
- func (f *BundleFactory) WithGitHub(tokens port.SCMTokenIssuer, connections port.SCMConnectionReader) *BundleFactory
- func (f *BundleFactory) WithGitea(tokens port.SCMTokenIssuer, secrets gitea.SecretWriter) *BundleFactory
- func (f *BundleFactory) WithJenkins(creds port.CICredentialResolver) *BundleFactory
- func (f *BundleFactory) WithManifestApplier(applier port.ManifestApplier, kubeconfigs port.KubeconfigProvider) *BundleFactory
- func (f *BundleFactory) WithRegistrySecrets(store registrycreds.SecretStore) *BundleFactory
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BundleFactory ¶
type BundleFactory struct {
// contains filtered or unexported fields
}
BundleFactory 는 port.SCMBundleFactory 구현체다.
func NewBundleFactory ¶
func NewBundleFactory(stacks port.StackReader, tokens port.SCMTokenIssuer, opts Options) *BundleFactory
NewBundleFactory 는 팩토리를 만든다.
func (*BundleFactory) RepositoryLocation ¶ added in v0.6.0
func (f *BundleFactory) RepositoryLocation(ctx context.Context, stackID string) (*port.RepositoryLocation, error)
RepositoryLocation 은 스택의 앱 저장소가 만들어질 자리다. 번들과 같은 규칙으로 그룹을 정하되 토큰을 발급하거나 SCM 에 붙지 않는다 — 입력 화면을 여는 것만으로 OpenBao · GitLab 을 두드리지 않게.
func (*BundleFactory) WithGatewayLocator ¶ added in v0.6.0
func (f *BundleFactory) WithGatewayLocator(gateways port.GatewayLocator) *BundleFactory
WithGatewayLocator 는 스택 네임스페이스의 실제 게이트웨이를 찾는 길을 배선한다. kubeconfig 는 WithManifestApplier 가 배선한 것을 쓴다.
func (*BundleFactory) WithGitHub ¶
func (f *BundleFactory) WithGitHub( tokens port.SCMTokenIssuer, connections port.SCMConnectionReader, ) *BundleFactory
WithGitHub 는 GitHub 스택을 프로비저닝할 수 있게 한다.
func (*BundleFactory) WithGitea ¶
func (f *BundleFactory) WithGitea(tokens port.SCMTokenIssuer, secrets gitea.SecretWriter) *BundleFactory
WithGitea 는 Gitea 스택을 프로비저닝할 수 있게 한다.
func (*BundleFactory) WithJenkins ¶
func (f *BundleFactory) WithJenkins(creds port.CICredentialResolver) *BundleFactory
WithJenkins 는 Gitea 스택의 CI job 을 만들 수 있게 한다.
배선되지 않으면 CIJobs 가 nil 로 남고, 호출부는 job 생성을 건너뛴다 — 리포와 스캐폴딩은 만들어지되 빌드는 돌지 않는다.
func (*BundleFactory) WithManifestApplier ¶ added in v0.6.0
func (f *BundleFactory) WithManifestApplier(applier port.ManifestApplier, kubeconfigs port.KubeconfigProvider) *BundleFactory
WithManifestApplier 는 CI 변수 저장소가 없는 스택(Gitea + Jenkins)에 스캔 정책 ConfigMap 을 적용할 수단을 배선한다. 배선하지 않으면 그 스택은 정책을 실을 경로가 없고, 정책 저장 결과가 파이프라인마다 실패로 보고된다.
func (*BundleFactory) WithRegistrySecrets ¶
func (f *BundleFactory) WithRegistrySecrets(store registrycreds.SecretStore) *BundleFactory
WithRegistrySecrets 는 스택이 설치한 레지스트리의 자격증명 저장소를 배선한다.
배선하지 않으면 CI 레지스트리 변수는 사용자가 준 값만 쓴다 — 화면이 그 값을 묻지 않으므로, 그 경우 변수가 비어 CI 의 docker login 이 죽는다.
type Options ¶
type Options struct {
// Env 는 시크릿 경로에 쓰는 환경 이름이다 (dev/staging/prod).
Env string
// GroupPath 는 프로젝트가 만들어질 조직 그룹 경로다.
GroupPath string
// ExternalRegistryPrefix 는 알 수 없는 레지스트리 도구의 폴백이다.
ExternalRegistryPrefix string
// GitLabBaseURLOverride 는 클러스터 내부 서비스 DNS 대신 쓸 주소다.
//
// 주소 하나면 모든 GitLab 스택에 적용된다. "네임스페이스=주소" 를 쉼표로 이어 주면
// 스택마다 제 주소를 쓴다(로컬에서 스택이 여럿일 때 포트포워드도 여럿이다). 둘을
// 섞으면 항목이 있는 스택은 그 주소, 나머지는 bare 주소다. gitLabBaseURLOverrideFor 참조.
//
// 기본 경로는 gitlab-webservice-default.{ns}.svc 인데, 이는 API 서버가
// 클러스터 안에서 돌 때만 해석된다. 로컬 실행이나 외부 GitLab 을 붙일 때
// 이 값으로 대체한다.
GitLabBaseURLOverride string
// GiteaBaseURLOverride 는 Gitea 의 클러스터 내부 서비스 DNS 대신 쓸 주소다.
//
// 기본 경로는 gitea-http.{ns}.svc 인데, 이는 API 서버가 클러스터 안에서 돌
// 때만 해석된다. 로컬 실행에서는 이 값이 없으면 인증 확인(Ping)이 DNS 오류로
// 실패하고, 그러면 토큰을 강제 재발급하는 경로로 잘못 흘러간다.
GiteaBaseURLOverride string
// JenkinsBaseURLOverride 는 Jenkins 의 클러스터 내부 서비스 DNS 대신 쓸
// 주소다. Gitea 와 같은 이유로 필요하다 — 기본 경로는 API 서버가 클러스터
// 안에서 돌 때만 해석된다.
JenkinsBaseURLOverride string
// TrivyJavaDBRepository 는 에어갭 설치에서 CI 잡이 Java DB 를 받을 내부 미러다.
// 비면(온라인 설치) 스캔 잡은 업스트림 기본값을 쓴다.
TrivyJavaDBRepository string
}
Options 는 팩토리 기동 설정이다.