Kubernetes Advent Calendar 2019 ãã®3 ã® 2æ¥ç®ã§ãã
Weaveworksã«ãã£ã¦GitOpsãææ¡ããã¦ãã2å¹´ã»ã©ãçµã¡ãå ãã§ããæ¬çªå°å ¥äºä¾ãè³ã«ããããã«ãªãã¾ãããã¨ã¯ããæ¡å¤ã¾ã¨ã¾ã£ãããã¥ã¡ã³ãã¯ä½ããã¦ãã¾ãããç¹ã«GitOpsã§è¤æ°ã®ç°å¢ (e.g., éçºç°å¢ãæ¬çªç°å¢ãetc.) ããã³ããªã³ã°ããããã«ã¯æ¬ ãããªããã©ã³ãæ¦ç¥ã«ã¤ãã¦ã¯æ®ã©èªããã¦ããªãããã§ããããã§ã¯ãã¨ãGitOpsã®æ¦è¦ (Single Source of Truthã®æ¦å¿µç) ãç¥ã£ã¦ãã¦ãæ¬çªå°å ¥ã«ã¯å¤§ããªãã¼ãã«ãæ®ã£ãã¾ã¾ã§ãæ¬çªå°å ¥äºä¾ãã¾ã ã¾ã å°ãªããã¨ã«ãç´å¾ã§ãã¦ãã¾ãã¾ããããã§ãã®è¨äºã§ã¯ãã©ã³ãæ¦ç¥ã«ç¦ç¹ãå½ã¦ããµã³ãã«ããã¸ã§ã¯ãã交ããªããç´¹ä»ãã¦ãããã¨æãã¾ããk8s/GitOpsä¸ç´è åãã§ããå¤åã
以åGitOpsã«ã¤ãã¦çºè¡¨ããéã«ç«¯æã£ã¦ãã¾ã£ãå ã®è£å®ã«ããªã£ã¦ãã¾ãã
åæ
æ¬è¨äºã§ã¯ä»¥ä¸ã®ãã¨ãåæã¨ãã¦è§£èª¬ããã«é²ãã¾ããå¿ è¦ã«å¿ãã¦å¤é¨è³æãåç §ãã¦ãã ããã
ãªããæ¬è¨äºã®å 容ã¯æè¡æ¸å ¸7ã«ã¦é å¸ãããKubernetes-Native Development&Deploymentãã®ä¸é¨ãæç²ï½¥çµæ§æ¹å¤ãããã®ã§ããå ¨ä½åããµã³ãã«ããã¸ã§ã¯ãããã£ã¨ç¥ãããã¨ãã£ãå ´åã¯âããã©ãããGitOpsã ãã§ãªãk8såãéçºç°å¢ã«ã¤ãã¦ã解説ãã¦ãã¾ã (ãã ã®å®£ä¼ã§ãï¼ï¼ï¼)ã
æ¦è¦
GitOpsã§ã¯å ¨ã¦ãGitã§ç®¡çããã¾ããããã®ãã©ã³ãã¨ã¢ããªå®è¡ç°å¢ã¸ã®åæ ãã©ã対å¿ä»ããããèããªããã°ãªãã¾ããããµã¼ãã¹ã«ãã£ã¦ã¯ãµã¼ãã¹ã®ãã¼ã¸ã§ã³ãã¨ã«æ¬çªç°å¢ãå¿ è¦ã§ãã£ãããéã«æ¬çªç°å¢ã¯å¸¸ã«1ã¤ã§ææ°ã«ããããã¯ãã¾ãã¦ã¼ã¶ãã¨ã«åå¥ã®ç°å¢ãæãåºããããªãµã¼ãã¹ã§ããã°ä¼¼ããããªç°å¢ã大éã«å¿ è¦ã«ãªã£ãããã¨å½¢æ ã¯æ§ã ã§ããæ´ã«éçºã®ããã®ç°å¢ãæ¬çªãããã¤åã®æçµç¢ºèªã¨ãã¦ã¹ãã¼ã¸ã³ã° (=ãã¬ãã¥ã¼) ç°å¢ãå¿ è¦ã«ããªãã¯ãã§ããåãããããµã¼ãã¹ã®ã¢ãã«ã«ãã©ã³ãæ¦ç¥ããã¾ãåãããªãéãããæãã«ãããã¤ãµã¤ã¯ã«ãåããã¨ã¯ã§ããªãã®ã§ãã
ç¨èª
以ä¸ã¯é©åãªç¨èªãå®ç¾©ããã¦ããªããããåãããããããããçè ãåæã«å®ç¾©ããç¨èªã§ãã
- ãããã¤è¦æ±: GitOpsã®æèã«ããã¦ãã¢ããªãªãã¸ããªã®æ´æ°ã«CIãããã¯ãSingle Source of Truthã§ããmanifestsãªãã¸ããªã«å¯¾ãã¦ãã®æ´æ°ãåæ ãããPRãçºè¡ãããã¨ãå ·ä½çã«ã¯ãmanifestsãªãã¸ããªã«å«ã¾ãã対象ã¢ããªã®ãããã§ã¹ããã¡ã¤ã«ã®Dockerã¤ã¡ã¼ã¸ã¿ã°ãææ°ã®ãã®ã«å¤æ´ããPRãçºè¡ãã
ãµã³ãã«ããã¸ã§ã¯ã
æ¯è¼çæ±ç¨çã¨æãããå½¢ã®ãµã³ãã«ã§ç´¹ä»ãã¦ããã¾ããä»åã¯ä»¥ä¸ã®ãããªå ´é¢ãæ³å®ãããã®ã¨ãªãã¾ãããµã¼ãã¹ã®è¦æ±ã«ãã£ã¦ã¯èª¿æ´ããå¿ è¦ãããã¾ãã
- æ¬çªç°å¢ (
prd
) ã¯1ã¤ã§ã常ã«å ¨ã¦ã¼ã¶ã«åããã¼ã¸ã§ã³ã§æä¾ãããããªãµã¼ãã¹ - éçºç°å¢ (
dev
) ã¯1ã¤ã§ã常ã«ã¢ããªãªãã¸ããªã®ææ°ç¶æ ããããã¤ããã¦ãã - å¿
ãå
ã«éçºç°å¢ã«ãããã¤ããå¾ã
æ¬çªç°å¢ã«ãããã¤ãã
- åºæ¥ãéãã®èªååãè¡ã
- 使ç¨ãã¼ã«
- CI: travis
- CD: argo-cd
Gitãªãã¸ããª
ãµã³ãã«ããã¸ã§ã¯ãã¯5ã¤ã®Gitãªãã¸ããªããæ§æããã¦ãã¾ãã
manifests
ã¢ããªã®Single Source of Truthã¨ãªããªãã¸ããªã§ããapp-aã¨app-bããããã¤ããããã®Manifestãå«ãã§ãã¾ããapp-aã¯helmããapp-bã¯kustomizeããã³ãã¬ã¼ãã¨ã³ã¸ã³ã¨ãã¦å©ç¨ã dev
ã»prd
ç°å¢ã«ãã©ã¡ã¼ã¿éãã®ãããã¤ãå®ç¾ãã¦ãã¾ãã
ä¾ç¤ºã®ããã«helmã¨kustomizeãä½µç¨ãã¦ãã¾ãããå®éã«ã¯ã©ã¡ããã«å¯ããã»ããè¯ãã§ãããã
system-manifests
ãã¡ã¤ã³ãå®ç¾ããã¢ã㪠以å¤ã® ããã«ã¦ã§ã¢ã®Single Source of Truthã¨ãªããªãã¸ããªã§ããä»åã®ãµã³ãã«ã§ã¯sealed-secretsããããã¤ããããã®Manifestãå«ãã§ãã¾ããIstioãPrometheusã¨ãã£ãããã«ã¦ã§ã¢ãå©ç¨ããå ´åãããã«å«ã¾ãããã¨ã«ãªãã¾ãããã©ã¡ã¼ã¿ãã¡ã¤ã«ã ããä¿æããHelmã®Chartèªä½ã¯å¤é¨ãåç §ããæ§æã¨ãªã£ã¦ãã¾ãã
manifestsãªãã¸ããªã¨system-manifestsãªãã¸ããªãåãã¦ããçç±ã§ãããããã¯ããããã®ãªãã¸ããªã§æ±ã£ã¦ãããã®ã®ã©ã¤ããµã¤ã¯ã«ãç°ãªãããã§ãããããã¤ã®ç²åº¦ãã¿ã¤ãã³ã°ããããã¤å Namespaceãå ¨ãç°ãªãã¾ããããã¼ãã¹ãã©ããæã«ã¯ããã«ã¦ã§ã¢âã¢ããªã¨ããé åºãå¿ è¦ã«ãªããã¨ããã°ãã°ããã¾ãããSingle Source of Truthã¨ããã¤ã¤è¤æ°ãããããã¼ãï¼ãã¨ããã³ããããªãããããã¾ããããçè çã«ã¯å¸¸ã«åããã»ããä½ãã¨ä¾¿å©ã¨ããçµè«ã«éãã¾ããã
cd-manifests
CDãã¼ã«ã§ããargo-cdã®è¨å®ã®Single Source of Truthã¨ãªããªãã¸ããªã§ããåç°å¢ã«ã¤ã³ã¹ãã¼ã«ããargo-cdããã¯ãã®ãªãã¸ããªãåç
§ããã¾ãã(argo-cdããããã¤ããããã®Manifestã§ã¯ãªãã) Applicationããããã¤ããããã®Manifestãå«ãã§ãã¾ããããã® Application ã¨ã¯ãããã¤è¨å®ã表ã Custom Resource Definitionã§ãã"Application of Applications" ã¨å¼ã°ãããå¹¾ã¤ãã®Applicationããããã¤ããããã®Applicationãåãæ§æã¨ãªã£ã¦ãã¾ããããã¯ä¾ãã°ããdev
ç°å¢ã®ã¢ããªãã»ãprd
ç°å¢ã®ããã«ã¦ã§ã¢ãã¨ãã£ãåä½ã§ã®ãããã¤ãå¯è½ã«ããããã®ææ³ã§ãããªãã¸ããªã«ã¼ãã«Application of Applicationsããããåã
ã®Applicationã¯ç°å¢å¥ã»ã¢ããª/ããã«ã¦ã§ã¢å¥ã«é
ç½®ããã¦ãã¾ãã
app-a
ãµã¼ãã¹å®ç¾ã®ããã«åããã¢ããªã®ãªãã¸ããªã§ããPythonã§ç°¡æçãªAPIãµã¼ããå®è£ ããã¦ãã¾ãã (ç°å¢å¤æ°ã§DBæ¥ç¶æ å ±çã®éçºç°å¢/æ¬çªç°å¢ã§å¤æ´ãå¿ è¦ãªãã©ã¡ã¼ã¿ã渡ããããã«ãããã¨ã§ãåä¸ã®Dockerã¤ã¡ã¼ã¸ã§éçºç°å¢ã¨æ¬çªç°å¢ã©ã¡ãã«ã対å¿ã§ããã¨ããåæãããã¾ãã)
app-b
ãµã¼ãã¹å®ç¾ã®ããã«åããã¢ããªã®ãªãã¸ããªã§ããGolangã§ç°¡æçãªAPIãµã¼ããå®è£ ããã¦ãã¾ãã (ç°å¢å¤æ°ã§DBæ¥ç¶æ å ±çã®éçºç°å¢/æ¬çªç°å¢ã§å¤æ´ãå¿ è¦ãªãã©ã¡ã¼ã¿ã渡ããããã«ãããã¨ã§ãåä¸ã®Dockerã¤ã¡ã¼ã¸ã§éçºç°å¢ã¨æ¬çªç°å¢ã©ã¡ãã«ã対å¿ã§ããã¨ããåæãããã¾ãã)
ãã©ã³ã
åãªãã¸ããªã®ãã©ã³ãã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãããªããDockerã¤ã¡ã¼ã¸ã¿ã°ã«ã¯ãã¼ã¸ã§ã³çªå·ã§ã¯ãªãGitã³ãããããã·ã¥å¤ãå©ç¨ãã¦ãã¾ãã
manifests
dev
: éçºç°å¢ã®ã¢ããªã®ç¶æ ã表ããã©ã³ã (éçºç°å¢ï½¥æ¬çªç°å¢ä¸¡æ¹ã®è¨å®ãã¡ã¤ã«ãå«ã)prd
: æ¬çªç°å¢ã®ã¢ããªã®ç¶æ ã表ããã©ã³ã (éçºç°å¢ï½¥æ¬çªç°å¢ä¸¡æ¹ã®è¨å®ãã¡ã¤ã«ãå«ã)feat/*
: ã¢ããªã®æ§æ (ãã³ãã¬ã¼ã) ãæ´æ°ããã¨ãã«æåã§ä½æãããã©ã³ã
system-manifests
dev
: éçºç°å¢ã®ããã«ã¦ã§ã¢ã®ç¶æ ã表ããã©ã³ã (éçºç°å¢ï½¥æ¬çªç°å¢ä¸¡æ¹ã®è¨å®ãã¡ã¤ã«ãå«ã)prd
: æ¬çªç°å¢ã®ããã«ã¦ã§ã¢ã®ç¶æ ã表ããã©ã³ã (éçºç°å¢ï½¥æ¬çªç°å¢ä¸¡æ¹ã®è¨å®ãã¡ã¤ã«ãå«ã)feat/*
: ããã«ã¦ã§ã¢ã®æ§æ (ãã³ãã¬ã¼ã) ãæ´æ°ããã¨ãã«æåã§ä½æãããã©ã³ã
cd-manifests
master
: å ¨ç°å¢ã®ãããã¤ç¶æ ã表ããã©ã³ãfeat/*
: ãããã¤ç¶æ ãæ´æ°ããã¨ãã«æåã§ä½æãããã©ã³ã
GitHub-flowã§ç®¡çããã¦ããã
app-a
master
: ææ°ã®app-aã表ããã©ã³ã (åç°å¢ã®ãããã¤ç¶æ ã¨ã¯ç¡é¢ä¿)feat/*
: app-aãæ´æ°ããã¨ãã«æåã§ä½æãããã©ã³ã
GitHub-flowã§ç®¡çããã¦ããã
app-b
master
: ææ°ã®app-bã表ããã©ã³ã (åç°å¢ã®ãããã¤ç¶æ ã¨ã¯ç¡é¢ä¿)feat/*
: app-bãæ´æ°ããã¨ãã«æåã§ä½æãããã©ã³ã
GitHub-flowã§ç®¡çããã¦ããã
詳細
ã¢ããªãªãã¸ããªã¨manifestsãªãã¸ããª
CIã«ããèªåçãªãããã¤è¦æ±ã¸ã®å¯¾å¿
æåã«ã¢ããªã®ãªãã¸ããªã§ãããä»åã¯GitHub-flowãåæã¨ã master
ãã©ã³ã ï¼ã¨featureãã©ã³ãï¼ ã®ã¿ã¨ãªã£ã¦ãã¾ããGitHub-flow㧠master
ãã©ã³ãã¯å¸¸ã«Production-Readyã§ãããã¨ã示ãã¾ãã®ã§ãmaster
ãé²ãã æç¹ã§CIããéçºç°å¢ãæ´æ°ãããããã¤è¦æ±ãèªåã§è¡ãã¾ãã
manifestsãªãã¸ããªã§ã¯ãåç°å¢ã表ããã©ã³ãã¯æ£ã«ãã®ç°å¢ã®ç¶æ
ã表ãã¦ãã¾ããã¤ã¾ããéçºç°å¢ã®ãããã¤ç¶æ
ã¯å¸¸ã« dev
ãã©ã³ãã®ç¶æ
ã¨ãæ¬çªç°å¢ã®ãããã¤ç¶æ
ã¯å¸¸ã« prd
ãã©ã³ãã®ç¶æ
ã¨çãããªããã¨ãæå¾
ããã¦ãã¾ããããã§æ³¨æãã¦ããã ãããã®ããdev
ãã©ã³ãã prd
ç°å¢ã®è¨å®ãå«ãã§ãã ã¨ããç¹ã§ãããã£ã¬ã¯ããªæ§é çã«ã¯ä¸è¨ã®ããã«ä¿æãã¦ãã¾ãã
manifests/ ãâ app-a/ # app-aã«é¢ãããããã§ã¹ã ãâãâ templates/ # <- ãã³ãã¬ã¼ããã¡ã¤ã« ãâãâ values/ # <- ç°å¢åºæè¨å®å¤ ãâãããâ dev-app-a.yaml ãâãããâ prd-app-a.yaml ãâ app-b/ # app-bã«é¢ãããããã§ã¹ã ãããâ templates/ # <- ãã³ãã¬ã¼ããã¡ã¤ã« ãããâ values/ # <- ç°å¢åºæè¨å®å¤ ãããããâ dev-app-b.yaml ãããããâ prd-app-b.yaml
manifests/app-a/values at dev · gitops-demo/manifests · GitHub
ä¸è¦å¤ã«æããããããã¾ãããããã㯠manifestsãªãã¸ããªå
ã® dev
ç°å¢ã®è¨å®ã¨ prd
ç°å¢ã®è¨å®ã¯å¸¸ã«åæã«æ´æ°ããã ã¨ãããã¨ãæã«è¦æ±ãã¦ãã¾ãã
åããã¥ããã¨æãã®ã§ã¢ããªãªãã¸ããªè¦ç¹ã§ãèãã¦ã¿ã¾ããããã¢ããªãªãã¸ããªãæ´æ°ãããã¨ããã¾ãéçºç°å¢ã«åæ ãããã対å¿ãããã©ã³ãã§ãã dev
ãã©ã³ãã«å¯¾ãã¦ãããã¤è¦æ±ãè¡ãã¾ãã
ãã®ã¨ããå¿
ã éçºç°å¢åãã®è¨å®ã ãã§ãªãæ¬çªç°å¢åãã®è¨å®ãæ´æ°ãã¾ããå
·ä½ä¾ãæããã¨ãmanifestsãªãã¸ããªã® dev
ãã©ã³ãã«å«ã¾ããéçºç°å¢åãã®è¨å®ãã¡ã¤ã« (dev-app-a.yaml
) ã¨æ¬çªç°å¢åãè¨å®ãã¡ã¤ã« (prd-app-a.yaml
) ã«å
±éããDockerã¤ã¡ã¼ã¸ã¿ã°ã app-a:aaa
ãã app-a:bbb
ã«åæã«æ¸ãæãããã¨ãããããªæãã§ããPRã®å·®åçã«ã¯æ¬¡ã®ããã«ãªãã¯ãã§ãã
--- a/dev-app-a.yaml +++ b/dev-app-a.yaml @@ -1,2 +1,2 @@ -image: app-a:aaa +image: app-b:bbb replicas: 1 --- a/prd-app-a.yaml +++ b/prd-app-a.yaml @@ -1,2 +1,2 @@ -image: app-a:aaa +image: app-b:bbb replicas: 10
ã¾ãããµã³ãã«ã§ããã¨ä»¥ä¸ã®CIããçæããããããã¤è¦æ±PRã§ã (ã³ãããå 容ãã³ãããããã·ã¥å¤çã¯ç°ãªãã¾ã)ã
以ä¸ã å®éã«ãã®æä½ãè¡ã£ã¦ããCIã®ã¹ã¯ãªãã ã®æç²ã§ãã
git clone "https://github.com/gitops-demo/manifests.git" manifests cd manifests git checkout dev # 常ã«ãããã¤è¦æ±ã¯devãã©ã³ã (=éçºç°å¢) ã«åãã git checkout -b "ci-build/app-a/${TRAVIS_COMMIT}" # æ´æ°ç¨ã®ãã©ã³ããä½æ cd app-a/values for f in *-app-a.yaml # éçºç°å¢åãè¨å®ãã¡ã¤ã« (dev-app-a.yaml) ã¨æ¬çªç°å¢åãè¨å®ãã¡ã¤ã« (prd-app-a.yaml) ã©ã¡ãã«ãåãå¦çãè¡ã do PREV_COMMIT=$(grep -oP "(?<=repository: gitopsdemo/app-a:).+$" "${f}") sed -i -e "s!repository: gitopsdemo/app-a:.\+\$!repository: gitopsdemo/app-a:${TRAVIS_COMMIT}!" "${f}" # Dockerã¤ã¡ã¼ã¸ã¿ã°ãææ°ã®Gitã³ãããããã·ã¥å¤ã«æ´æ° done
manifestsãªãã¸ããªã® dev
ãã©ã³ãããããã¤è¦æ±ã®å¯¾è±¡ã¨ãã¤ã¤ãéçºç°å¢åãè¨å®ãã¡ã¤ã«ã¨æ¬çªç°å¢åãè¨å®ãã¡ã¤ã«ãåæã«åãããã«æ´æ°ãã¦ãããã¨ããããã¨æãã¾ãããªããä»åã®ãµã³ãã«ã§ã¯éçºç°å¢ã¨æ¬çªç°å¢ã®2ã¤ã ãã§ãããä¾ãã°ã¹ãã¼ã¸ã³ã°ç°å¢ãããå ´åã¯ã¹ãã¼ã¸ã³ã°ç°å¢åãè¨å®ãã¡ã¤ã«ãåæ§ã«å¦çãããã¨ã«ãªãã¾ãã
dev
ãã©ã³ãã®ã¿ãæ¬çªç°å¢ã®è¨å®ã¯ prd
ãã©ã³ãã®ã¿æãããå ´åãèãã¦ã¿ã¾ããããç°¡åãªãã¨ã§ãããdev
ãã©ã³ã㨠prd
ãã©ã³ãã¯ããããç¬ç«ããã³ããããã°ãéãã¦ãã¾ãããGitã®æ©æµãåãããã¾ãããæ°ãããã©ã¡ã¼ã¿ãå¢ãããã¨æã£ãããå
¨ãç¬ç«ãã2ã¤ã®ãã©ã³ãã®å
¨ãç¬ç«ãã2ã¤ã®ãã¡ã¤ã«ãæ¸ãæãããã¨ã«ãªã£ã¦ãã¾ãã¾ããã¾ãããã³ãã¬ã¼ããæ´»ç¨ã§ãã¾ããã
ã¢ããªæ§æå¤æ´ãä¼´ãæåãããã¤è¦æ±ã¸ã®å¯¾å¿
ããã¾ã§ã¢ããªãã¨ã®Dockerã¤ã¡ã¼ã¸ãæ´æ°ããã ãã§æ¸ãã±ã¼ã¹ã®ã¿ãèãã¦ãã¾ããããã1ãã¿ã¼ã³ãmanifestsãªãã¸ããªå ã®ã¢ããªæ§æãå¤æ´ããã±ã¼ã¹ãèãã¦ã¿ã¾ãããããµã³ãã«ããã¸ã§ã¯ãã«ã¯ããã¾ããããapp-cã¨ãã第3ã®ã¢ããªã®è¿½å ãä»®å®ãã¾ãã
ãã®å ´åGitOpsã§ã¯manifestsãªãã¸ããªã«app-cç¨ã®ãããã§ã¹ãã追å ãããããæå㧠feat
ãã©ã³ããä½æããå¿
è¦ãããã¾ããfeat/add-app-c
ã¯ä»¥ä¸ã®ç·è²ã®é¨åã追å ããPRã«ãªãã¯ãã§ãããã¡ããéçºç°å¢ã ãã§ãªãæ¬çªç°å¢ã®è¨å®ãå«ã¾ãã¦ãã¾ãã
manifests/ ãâ app-a/ # app-aã«é¢ãããããã§ã¹ã ãâãâ templates/ # <- ãã³ãã¬ã¼ããã¡ã¤ã« ãâãâ values/ # <- ç°å¢åºæè¨å®å¤ ãâãããâ dev-app-a.yaml ãâãããâ prd-app-a.yaml ãâ app-b/ # app-bã«é¢ãããããã§ã¹ã ãâãâ templates/ # <- ãã³ãã¬ã¼ããã¡ã¤ã« ãâãâ values/ # <- ç°å¢åºæè¨å®å¤ ãâãããâ dev-app-b.yaml ãâãããâ prd-app-b.yaml ãâ app-c/ # app-cã«é¢ãããããã§ã¹ã ãããâ templates/ # <- ãã³ãã¬ã¼ããã¡ã¤ã« ãããâ values/ # <- ç°å¢åºæè¨å®å¤ ãããããâ dev-app-b.yaml ãããããâ prd-app-b.yaml
ããã¦ãã¼ã¸å
ã§ããããããå¿
ã dev
ãã©ã³ãã«ãã¾ããããã«ãããèªååããããããã¤è¦æ±ã¨æ´åæ§ã®åãããã©ã³ãéç¨ãå®ç¾ãã¾ãã
éçºç°å¢ããæ¬çªç°å¢ã¸ã®åæ
度ã
ã«ãªãã¾ãããã¢ããªã®å¤æ´ã¯å¿
ãæåã« dev
ç°å¢ã«å¯¾ãã¦è¡ããããCIã«ãããããã¤è¦æ±ã¯manifestsãªãã¸ããªã® dev
ãã©ã³ãã«è¡ãã¾ããããã ãã§ã¯æ¬çªç°å¢ (prd
ãã©ã³ã) ãä¸çæ´æ°ããã¾ããã®ã§ããã¡ãã®æ´æ°æ¹æ³ã«ã¤ãã¦ãç´¹ä»ãã¦ããã¾ããæ¹æ³ã¨ãã¦ã¯ãprd
ãã©ã³ãã«å¯¾ããCIããã®èªåçãªå¦çã¯ä¸åãªããä»»æã®ã¿ã¤ãã³ã°ã§æåã§manifestsãªãã¸ããªã® dev
ãã©ã³ãã prd
ãã©ã³ãã«ãã¼ã¸ ãã¾ãã
ãµã³ãã«ã§ã¯ä»¥ä¸ã®æã§ä½æãããPRãããã«ãããã¾ãã
ãªãèªååããã¦ããªãã®ãã¯2ã¤ã®çç±ããæãã¾ãã1ã¤ç®ã®çç±ã¯ãä¸è¬çã«æ¬çªç°å¢ã¯éçºç°å¢ã»ã©ç´°ããåä½ã§ã¯ãããã¤ãè¡ããªããããã¨ãããã®ã§ãããµã¼ãã¹ã®æ´æ°ã«ãã£ã¦ã¯ãè¤æ°ã®ã¢ããªã®æ´æ°ãåæã«åãè¾¼ãå¿
è¦ããããã¨ããã±ã¼ã¹ã容æã«èãããã¾ãããã®å ´åãdev
ãã©ã³ãã«å¿
è¦ãªå¹¾ã¤ãã®ã¢ããªãæ´æ°ãåæ ããã段éã§ãã¾ã¨ã¾ã£ãæ´æ°ã prd
ãã©ã³ãã«è¡ãããã¹ãã§ãã2ã¤ç®ã®çç±ã¯ãä¸æ¦éçºç°å¢ã§ç¢ºèªãã¦ããæ¬çªç°å¢ã¸ä¸ããã¨ããããã¼ã®å¼·å¶ãGitçã«å°é£ã ããã§ãããCIããã¯ã®åº¦ã«åããããã¤è¦æ±ã dev
ãã©ã³ã㨠prd
ãã©ã³ãã«æãã¦ãã¾ãã¨ãã©ã³ããç¬ç«ãã¦ãã¾ãã¾ããã¾ããCIã«ããèªåçãªãããã¤è¦æ±ä»¥å¤ã«è¡ããããµã¼ãã¹æ§æã®å¤æ´ãã¾ã dev
ãã©ã³ãã¸è¡ãããã«ãããã¨ã§ãå¤æ´ãèªç¶ã«Gitä¸ã§ä¼æããããã¨ãå¯è½ã«ãªãã¾ããç¹æ®ãªã±ã¼ã¹ã¨ãã¦ããdev
ãã©ã³ãã«ã³ãããã¨ãã¦æºã¾ã£ãå¤æ´ã®ä¸é¨ãããã¯ã¢ãããã¦æ¬çªç°å¢ã«åæ ããããã¨ãããã¨ããããã¨æãã¾ãããã®å ´åã¯Gitã®Cherry-Pickã§èªç¶ã«è§£æ±ºã§ãã¾ããå¿
è¦ãªå¤æ´ã®ã³ãããã ããCherry-Pick㧠prd
ãã©ã³ãã«æ¾ãä¸ããã°è¯ãã®ã§ããdev
ãã©ã³ãã«æ®ã£ãå·®åãã¾ã¨ã㦠prd
ãã©ã³ãã«åæ ãããããªã£ãã dev
ãã©ã³ãã prd
ãã©ã³ãã«ãã¼ã¸ããã ãã§ãããã®è¾ºãã¯Gitãæ大éã«æ´»ç¨ãã¦ãããã¨ã«ãªãã¾ãããéç¨ãç
©éã«ãªããããªãããã«æ³¨æãå¿
è¦ã§ãã
system-manifestsãªãã¸ããª
ããã¾ã§manifestsãªãã¸ããªï¼=ã¢ããªã®Single Source of Truthï¼ã«ã¤ãã¦ã§ããããsystem-manifestsãªãã¸ããªã«ã¤ãã¦ãããã¼ã¯å
¨ãåãã§ãã(ã¢ããªã¨ã¯ç°ãªããããã«ã¦ã§ã¢èªä½ã®éçºãè¡ããªãã¸ããªã¯å¤é¨ã«ããããã¾ã§å©ç¨ããã ãã¨ããä»®å®ã®ãã¨ã) manifestsãªãã¸ããªã¨ã¯ç°ãªãåºæ¬çã«CIã«ãããããã¤è¦æ±ã¯ããã¾ãããsystem-manifestsã«å¯¾ããç´æ¥ã®å¤æ´ã¯ã¢ããªæ§æå¤æ´ãä¼´ããããã¤è¦æ±ã¨åãããã« feat
ãã©ã³ããä½æãããããã¾ã㯠dev
ãã©ã³ãã«PRï½¥ãã¼ã¸ãã¾ããããã¦å¿
è¦ã«å¿ã㦠dev
ãã©ã³ãã prd
ãã©ã³ãã«ãã¼ã¸ãããã¨ã§æçµçã«å¤æ´ãæ¬çªç°å¢ã¸åæ ã§ãã¾ãã
ãµã³ãã«ããã¸ã§ã¯ã > Gitãªãã¸ããª
ã§ã軽ã触ãã¾ãããmanifestsã¨system-manifestsã¯ã©ã¤ããµã¤ã¯ã«ã大ããç°ãªãã¾ããããåãã¦ããªãã¨ãä¾ãã°æ¬çªç°å¢ã®ã¢ã©ã¼ãè¨å®ã®ãããã§ã¹ããå°ãã ãå¤ããå¿
è¦ãåºãå ´åããæ¢ã« dev
ãã©ã³ãã«æºã¾ã£ã¦ããã¢ããªã®å¤æ´å·®åãprd
ãã©ã³ãã¸ã®ãã¼ã¸ã«å·»ãè¾¼ã¾ãªãããã«ã¢ã©ã¼ãè¨å®ã³ãããã ããCherry-Pickãããã¨ãã£ãç
©éãªCherry-Pickãå¤çºãã¦é¢åãªãã¨ã«ãªã£ã¦ãã¾ãã§ãããã
cd-manifestsãªãã¸ããª
æå¾ã«cd-manifestsã§ãããåºæ¬çã« master
ãã©ã³ãã®ã¿ã§ããmanifestsãsystem-manifestsã¨æ¯è¼ãã¦ãä¸æ¦ãããã¤ãã¦ãã¾ãã°cd-manifestsã®ã¬ã¤ã¤ã§ã®å¤æ´ (e.g., ã¢ããªèªä½ã®è¿½å ï½¥åé¤ç) ã¯å°ãªãã¯ããªã®ã§ãä½è¨ãªè¤éæ§ãæé¤ããããã«ãã®ããã«ãã¦ãã¾ãã
ã¾ã¨ã
ããã¾ã§ä¸ä¾ã§ããããµã³ãã«ããã¸ã§ã¯ãã交ããªããGitOpsã®ãã©ã³ãæ¦ç¥ãç´¹ä»ãã¾ãããå®éã«å°å ¥ããã«ã¯ã©ããã¦ããµã¼ãã¹ã®è¦ä»¶ã«åãããã«ã¹ã¿ãã¤ãºãå¿ è¦ã§ãããåºæ¬ã¨ãªãé¨åã ãã§ããé°å²æ°ã ãã§ãæ´ãã§ããã ããã®ã§ããã°ã