imagescan

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

Documentation

Overview

Package imagescan 은 스택이 설치한 OSS 이미지를 스택의 Trivy 서버로 스캔한다.

플랫폼은 클러스터 밖에서 돈다. 이미지를 받아 분석하는 일은 스택 네임스페이스의 Job 이 하고, 플랫폼은 그 결과를 로그로 받는다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubectlFunc

type KubectlFunc func(ctx context.Context, kubeconfig []byte, args ...string) (string, error)

KubectlFunc 는 kubeconfig 로 kubectl 을 실행한다.

type Option

type Option func(*Scanner)

Option 은 Scanner 설정이다.

func WithClock

func WithClock(fn func() time.Time) Option

WithClock 은 스캔 시각의 출처를 바꾼다(테스트용).

func WithKubectl

func WithKubectl(fn KubectlFunc) Option

WithKubectl 은 kubectl 실행기를 바꾼다(테스트용).

func WithMirrorRegistry

func WithMirrorRegistry(host string) Option

WithMirrorRegistry 는 에어갭 내부 레지스트리에서 이미지를 받게 한다.

에어갭 노드는 containerd 미러로 이미지를 받아서, 파드의 imageID 는 원래 레지스트리 이름이다. 스캔 Job 의 trivy client 는 그 이름으로 받을 수 없으므로 번들이 올린 경로로 바꾸고, plain HTTP 레지스트리를 허용하며, Java DB 도 같은 레지스트리의 미러에서 받는다. host 가 비면 아무것도 바꾸지 않는다.

func WithPollInterval

func WithPollInterval(d time.Duration) Option

WithPollInterval 은 Job 완료를 확인하는 간격을 바꾼다(테스트용).

type Scanner

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

Scanner 는 port.InstalledImageScanner 구현이다.

func NewScanner

func NewScanner(opts ...Option) *Scanner

NewScanner 는 스캐너를 만든다.

func (*Scanner) ScanInstalledImages

func (s *Scanner) ScanInstalledImages(ctx context.Context, kubeconfig []byte, namespace string, shared []domain.SharedComponent) ([]domain.StackImageScan, error)

ScanInstalledImages 는 네임스페이스에서 실행 중인 이미지를 digest 단위로 스캔한다.

Jump to

Keyboard shortcuts

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