Flux Schema 구성
flux schema validate와 flux schema explain 명령이 YAML 구성 파일에서 기본 플래그 값을 어떻게 로드하는지 소개합니다.
출처: 문서
본문
flux schema validate와 flux schema explain 명령은 YAML 구성 파일에서 기본 플래그 값을 로드할 수 있습니다. 파일 형태는 버전이 관리되며 config-v1beta1.json의 JSON Schema로 문서화됩니다.
예제
apiVersion: schema.plugin.fluxcd.io/v1beta1
kind: Config
validate:
envsubst:
file: .env
schemaLocation:
- ecosystem
skipKind:
- source.toolkit.fluxcd.io/v1/ExternalArtifact
skipJSONPath:
- Secret:/sops
skipJSONPathIfAbsent:
- Widget:/spec/replicas
skipFile:
- '.*'
- kustomization.yaml
skipCELRules: false
skipMissingSchemas: false
verbose: true
failFast: false
concurrent: 8
insecureSkipTLSVerify: false
output: text
explain:
schemaLocation:
- ecosystem
apiVersion: v1
recursive: false
insecureSkipTLSVerify: false
output: plaintext
사용법 (Usage):
flux schema validate ./manifests --config .fluxschema.yml
flux schema explain pods.spec --config .fluxschema.yml
--config를 설정하지 않으면 FLUX_SCHEMA_CONFIG 환경 변수가 사용됩니다. 둘 다 설정하지 않으면 validate는 실행 파일 옆에 있는 구성 파일(있을 때)을 사용합니다. explain은 --schema-location을 전달하지 않을 때 같은 경로를 읽습니다. 예를 들면 ~/.fluxcd/plugins/flux-schema.config.
사양 (Specification)
| 필드 | 설명 | | apiVersion | Config API 버전. 현재 schema.plugin.fluxcd.io/v1beta1. | | kind | Config API 종류. 현재 Config. | | validate | 검증 옵션의 기본값. | | explain | explain 옵션의 기본값. |
검증 (Validation)
validate 섹션은 flux schema validate 플래그의 기본값을 구성합니다.
| 필드 | 설명 | | schemaLocation[] | 순서대로 시도되는 스키마 URL, 파일 경로 또는 템플릿. 별칭: default (내장 카탈로그), ecosystem (schemas.fluxoperator.dev). | | envsubst.file | Flux post-build 치환 변수를 공급하는 dotenv 파일 경로. 상대 경로는 구성 파일의 디렉터리에서 해석됩니다. | | envsubst.strict | 기본값이 없는 정의된 치환 변수에서 실패. | | skipMissingSchemas | 스키마를 찾을 수 없는 문서를 건너뜀. | | skipKind[] | 검증에서 제외되는 Kind 또는 apiVersion/kind 패턴. | | skipJSONPath[] | 검증 전에 제거되는 JSON Pointer. | | skipJSONPathIfAbsent[] | 필드가 없을 때 required-field 오류를 건너뛰는 JSON Pointer. 일치하는 문서에 대해 필드가 없으면 CEL을 건너뜁니다. 값이 있으면 계속 검증합니다. | | skipFile[] | 검증에서 제외되는 basename glob 패턴. | | skipCELRules | x-kubernetes-validations CEL 규칙 평가 비활성화. | | verbose | 유효한 문서와 건너뛴 문서를 포함해 모든 문서에 대해 한 줄 출력. | | failFast | 첫 번째 유효하지 않은 문서에서 종료. | | concurrent | 동시 검증 워커 수. | | insecureSkipTLSVerify | 스키마 다운로드 시 TLS 인증서 검증 비활성화. | | output | 출력 형식: text, json, yaml 또는 junit. | | outputDirectory | 구조화 출력 (json, yaml 또는 junit XML) 파일을 위한 출력 디렉터리. 디렉터리가 없으면 생성됩니다. |
output 필드를 json 또는 yaml로 설정하면 결과는 Report API 형태를 갖습니다. junit으로 설정하면 결과는 JUnit 시험 보고서를 지원하는 CI/CD 시스템과 통합하기 위해 JUnit XML로 내보내집니다. JUnit XML 형식은 공식 표준이 아니므로 별도로 문서화됩니다.
Explain
explain 섹션은 flux schema explain 플래그의 기본값을 구성합니다.
| 필드 | 설명 | | schemaLocation[] | 순서대로 시도되는 스키마 URL, 파일 경로 또는 템플릿. ecosystem 별칭은 schemas.fluxoperator.dev를 가리킵니다. default는 explain에서 지원되지 않습니다. | | apiVersion | 기본적으로 설명할 API 그룹/버전. | | recursive | 필드의 필드도 출력. | | insecureSkipTLSVerify | 스키마 다운로드 시 TLS 인증서 검증 비활성화. | | output | 출력 형식: plaintext 또는 plaintext-openapiv2. |