728x90
Kustomize는 Build할때 참조되는 Resource들의 path에 대해서 정합성을 체크한다. 휴먼에러를 방지하기 위한 내부 메커니즘으로 보이는데, Kustomization으로 build하는 Application Scope을 벗어난 리소스 참조는 실패하도록 설계되어 있다.
가령
├── base
│ ├── app-new-manifest.yaml # I am trying to patch this
│ ├── kustomization.yaml
│ ├── app
│ │ ├── app.yaml
│ │ └── kustomization.yaml
└── overlay
└── environment1
│ ├── kustomization.yaml # I want to patch app-new-manifest.yaml in base
│
└── environment2
│ ├── kustomization.yaml # No patch. app.yaml will be as is
│
└── environment3
├── kustomization.yaml # I want to patch app-new-manifest.yaml in base
overlay/environment1/kustomization은 base/app-new-manifest.yaml을 Patch로 참조할 수 없다.
Base를 참조하는 경로에 대해서는 관대한데, Patch 와 같이 Value file을 참조할때는 상위 경로로 이동을 할수가 없다.
이럴때 사용할 수 있는 것이 다음 옵션인데,
--load_restrictor LoadRestrictionsNone
이를 활용하여 Build를 수행하면 정상적으로 참조된다.
kustomize build --load_restrictor LoadRestrictionsNone config/overlays/dev_mutation | kubectl apply -f -
만약 당신이 ArgoCD에서 Kustomize build를 통하여 배포를 하고 있다면 ArgoCD에서 해당 build parameter를 추가해주어야 한다.
공식문서 링크 : https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/
ArgoCD의 구성요소중 argocd-cm 이라는 configmap에서 다음 kustomize.buildOptions을 추가하자.
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
kustomize.buildOptions: --load-restrictor LoadRestrictionsNone
kustomize.buildOptions.v4.4.0: --output /tmp
...
그러면 상위 경로의 파일을 Patch를 위해 참조하여도 잘 참조 된다.
'PaaS > CI CD' 카테고리의 다른 글
SSH key로 Github 인증 받기 (0) | 2024.12.28 |
---|---|
ArgoCD) Git-Sync를 통하여 주기적으로 git repo fetch 받아오게 하기 (0) | 2024.12.27 |
Gitlab Runner ) kubernetes Executor Error 'Is the docker daemon running?' (0) | 2024.12.15 |
Gitlab Runner ) Kubernetes에 scaling Runner 배포하기 (0) | 2024.12.10 |
DockerHub Rate Limit 정책 그리고 이슈 (0) | 2024.08.03 |