GitHub App์(๋ฅผ) ์ฌ์ฉํ๊ฑฐ๋ personal access token (classic)์(๋ฅผ) ์ฌ์ฉํ์ฌ GitHub API์ ๋ํ Actions Runner Controller(ARC)์(๋ฅผ) ์ธ์ฆํ ์ ์์ต๋๋ค.
์ฐธ๊ณ ํญ๋ชฉ
์ํฐํ๋ผ์ด์ฆ ์์ค์ ์คํ๊ธฐ์ฉ GitHub App์ ์ฌ์ฉํ์ฌ ์ธ์ฆํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ๊ทธ๋ฃน์ ์ฌ์ฉํ์ฌ ์์ฒด ํธ์คํธํ ์คํ๊ธฐ์ ๋ํ ์ก์ธ์ค ๊ด๋ฆฌ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
GitHub App(์ผ)๋ก ARC ์ธ์ฆ
-
์กฐ์ง์ด ์์ ํ GitHub App ๋ง๋ค๊ธฐ ์์ธํ ๋ด์ฉ์ GitHub ์ฑ ๋ฑ๋ก์(๋ฅผ) ์ฐธ์กฐํ์ธ์. ๋ค์๊ณผ ๊ฐ์ด GitHub App์(๋ฅผ) ๊ตฌ์ฑํฉ๋๋ค.
-
"ํํ์ด์ง URL"์
https://github.com/actions/actions-runner-controller
๋ฅผ ์ ๋ ฅํฉ๋๋ค. -
"์ฌ์ฉ ๊ถํ"์์ ๋ฆฌํฌ์งํ ๋ฆฌ ๊ถํ์ ํด๋ฆญํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋๋กญ๋ค์ด ๋ฉ๋ด๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์ก์ธ์ค ๊ถํ์ ์ ํํฉ๋๋ค.
-
๊ด๋ฆฌ: ์ฝ๊ธฐ ๋ฐ ์ฐ๊ธฐ
์ฐธ๊ณ ํญ๋ชฉ
Administration: Read and write
๋ ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฒ์์์ ๋ฑ๋กํ Actions Runner Controller๋ฅผ ๊ตฌ์ฑํ ๋๋ง ํ์ํฉ๋๋ค. ์กฐ์ง ๋ฒ์์ ๋ฑ๋กํ ๋๋ ํ์ํ์ง ์์ต๋๋ค. -
๋ฉํ๋ฐ์ดํฐ: ์ฝ๊ธฐ ์ ์ฉ
-
-
"์ฌ์ฉ ๊ถํ"์์ ์กฐ์ง ๊ถํ์ ํด๋ฆญํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋๋กญ๋ค์ด ๋ฉ๋ด๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์ก์ธ์ค ๊ถํ์ ์ ํํฉ๋๋ค.
- ์์ฒด ํธ์คํธํ ์คํ๊ธฐ: ์ฝ๊ธฐ ๋ฐ ์ฐ๊ธฐ
-
-
GitHub App์(๋ฅผ) ๋ง๋ ํ GitHub App์ ํ์ด์ง์์ "์ฑ ID" ๊ฐ์ ๋ฉ๋ชจํฉ๋๋ค. ํด๋น ๊ฐ์ ์ดํ์ ์ฌ์ฉํฉ๋๋ค.
-
"ํ๋ผ์ด๋น ํค"์์ ํ๋ผ์ด๋น ํค ์์ฑ์ ํด๋ฆญํ๊ณ ,
.pem
ํ์ผ์ ์ ์ฅํฉ๋๋ค. ํด๋น ํค๋ ์ดํ์ ์ฌ์ฉํฉ๋๋ค. -
ํ์ด์ง์ ์ผ์ชฝ ์ ๋ชจ์๋ฆฌ์ ์๋ ๋ฉ๋ด์์ ์ฑ ์ค์น๋ฅผ ํด๋ฆญํ๊ณ ์กฐ์ง ์์ ์๋ ์ค์น๋ฅผ ํด๋ฆญํ์ฌ ์กฐ์ง์ ์ฑ์ ์ค์นํฉ๋๋ค.
-
์กฐ์ง์ ๋ํ ์ค์น ๊ถํ์ ํ์ธํ ํ ์ฑ ์ค์น ID๋ฅผ ๊ธฐ๋กํด ๋ก๋๋ค. ๋์ค์ ํ์ํฉ๋๋ค. ๋ค์ URL ํ์์ ์ฑ ์ค์น ํ์ด์ง์์ ์ฑ ์ค์น ID๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
https://github.com/organizations/ORGANIZATION/settings/installations/INSTALLATION_ID
-
์ด์ ๋จ๊ณ์์ ๋ค์ด๋ก๋ํ ์ฑ ID, ์ค์น ID ๋ฐ ๋ค์ด๋ก๋ํ
.pem
ํ๋ผ์ด๋น ํค ํ์ผ์ Kubernetes์ ๋น๋ฐ๋ก ๋ฑ๋กํฉ๋๋ค.GitHub App์ ๊ฐ์ Kubernetes์ ๋น๋ฐ๋ก ๋ง๋ค๋ ค๋ฉด ๋ค์ ๋ช ๋ น์ ์คํํฉ๋๋ค.
์ฐธ๊ณ ํญ๋ชฉ
gha-runner-scale-set
์ฐจํธ๊ฐ ์ค์น๋ ๋์ผํ ๋ค์์คํ์ด์ค์ ๋น๋ฐ์ ๋ง๋ญ๋๋ค. ์ด ์์ ์์ ๋ค์์คํ์ด์ค๋ ๋น ๋ฅธ ์์ ์ค๋ช ์์ ์ผ์นํ๊ธฐ ์ํดarc-runners
์ ๋๋ค. ์์ธํ ๋ด์ฉ์ Actions Runner Controller์ ๋ํ ๋น ๋ฅธ ์์์(๋ฅผ) ์ฐธ์กฐํ์ธ์.Bash kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_app_id=123456 \ --from-literal=github_app_installation_id=654321 \ --from-literal=github_app_private_key='-----BEGIN RSA PRIVATE KEY-----********'
kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_app_id=123456 \ --from-literal=github_app_installation_id=654321 \ --from-literal=github_app_private_key='-----BEGIN RSA PRIVATE KEY-----********'
๋ค์์ผ๋ก
values.yaml
ํ์ผ ๋ณต์ฌ๋ณธ์githubConfigSecret
์์ฑ์ ๋น๋ฐ ์ด๋ฆ์ ์ฐธ์กฐ๋ก ์ ๋ฌํฉ๋๋ค.githubConfigSecret: pre-defined-secret
์ถ๊ฐ Helm ๊ตฌ์ฑ ์ต์
์ ARC ๋ฆฌํฌ์งํ ๋ฆฌ์ values.yaml
์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
personal access token (classic)์(๋ฅผ) ์ฌ์ฉํ์ฌ ARC ์ธ์ฆ
ARC๋ personal access tokens (classic)์(๋ฅผ) ์ฌ์ฉํ์ฌ ์์ฒด ํธ์คํธํ ์คํ๊ธฐ๋ฅผ ๋ฑ๋กํ ์ ์์ต๋๋ค.
-
ํ์ํ ๋ฒ์๊ฐ ์๋ personal access token (classic)์(๋ฅผ) ๋ง๋ญ๋๋ค. ํ์ํ ๋ฒ์๋ ์ํฐํ๋ผ์ด์ฆ ๋๋ ์กฐ์ง ์์ค์์ ์คํ๊ธฐ๋ฅผ ๋ฑ๋กํ๋์ง ์ฌ๋ถ์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. personal access token (classic)๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ ๊ฐ์ธ์ฉ ์ก์ธ์ค ํ ํฐ ๊ด๋ฆฌ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
๋ค์์ ARC ์คํ๊ธฐ์ ํ์ personal access token ๋ฒ์ ๋ชฉ๋ก์ ๋๋ค.
- ๋ฆฌํฌ์งํ ๋ฆฌ ์คํ๊ธฐ:
repo
- ์กฐ์ง ์คํ๊ธฐ:
admin:org
- ๋ฆฌํฌ์งํ ๋ฆฌ ์คํ๊ธฐ:
-
personal access token (classic)์ ๊ฐ์ผ๋ก Kubernetes ๋น๋ฐ์ ๋ง๋ค๋ ค๋ฉด ๋ค์ ๋ช ๋ น์ ์ฌ์ฉํฉ๋๋ค.
์ฐธ๊ณ ํญ๋ชฉ
gha-runner-scale-set
์ฐจํธ๊ฐ ์ค์น๋ ๋์ผํ ๋ค์์คํ์ด์ค์ ๋น๋ฐ์ ๋ง๋ญ๋๋ค. ์ด ์์ ์์ ๋ค์์คํ์ด์ค๋ ๋น ๋ฅธ ์์ ์ค๋ช ์์ ์ผ์นํ๊ธฐ ์ํดarc-runners
์ ๋๋ค. ์์ธํ ๋ด์ฉ์ Actions Runner Controller์ ๋ํ ๋น ๋ฅธ ์์์(๋ฅผ) ์ฐธ์กฐํ์ธ์.Bash kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_token='YOUR-PAT'
kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_token='YOUR-PAT'
-
values.yaml
ํ์ผ ๋ณต์ฌ๋ณธ์์ ๋น๋ฐ ์ด๋ฆ์ ์ฐธ์กฐ๋ก ์ ๋ฌํฉ๋๋ค.githubConfigSecret: pre-defined-secret
์ถ๊ฐ Helm ๊ตฌ์ฑ ์ต์ ์ ARC ๋ฆฌํฌ์งํ ๋ฆฌ์
values.yaml
์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
fine-grained personal access token์ ์ฌ์ฉํ์ฌ ARC ์ธ์ฆ
ARC๋ fine-grained personal access tokens์ ์ฌ์ฉํ์ฌ ์์ฒด ํธ์คํ ๋ฌ๋๋ฅผ ๋ฑ๋กํ ์ ์์ต๋๋ค.
-
ํ์ํ ๋ฒ์๊ฐ ์๋ fine-grained personal access token์ ๋ง๋ญ๋๋ค. ํ์ํ ๋ฒ์๋ ๋ฆฌํฌ์งํ ๋ฆฌ ๋๋ ์กฐ์ง ์์ค์์ ๋ฌ๋๋ฅผ ๋ฑ๋กํ๋์ง ์ฌ๋ถ์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. fine-grained personal access token์ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ ๊ฐ์ธ์ฉ ์ก์ธ์ค ํ ํฐ ๊ด๋ฆฌ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
๋ค์์ ARC ์คํ๊ธฐ์ ํ์ personal access token ๋ฒ์ ๋ชฉ๋ก์ ๋๋ค.
-
๋ฆฌํฌ์งํ ๋ฆฌ ๋ฌ๋:
- ๊ด๋ฆฌ: ์ฝ๊ธฐ ๋ฐ ์ฐ๊ธฐ
-
์กฐ์ง ๋ฌ๋:
- ๊ด๋ฆฌ: ์ฝ๊ธฐ
- ์์ฒด ํธ์คํธํ ์คํ๊ธฐ: ์ฝ๊ธฐ ๋ฐ ์ฐ๊ธฐ
-
-
fine-grained personal access token์ ๊ฐ์ผ๋ก Kubernetes ๋น๋ฐ์ ๋ง๋ค๋ ค๋ฉด ๋ค์ ๋ช ๋ น์ ์ฌ์ฉํฉ๋๋ค.
์ฐธ๊ณ ํญ๋ชฉ
gha-runner-scale-set
์ฐจํธ๊ฐ ์ค์น๋ ๋์ผํ ๋ค์์คํ์ด์ค์ ๋น๋ฐ์ ๋ง๋ญ๋๋ค. ์ด ์์ ์์ ๋ค์์คํ์ด์ค๋ ๋น ๋ฅธ ์์ ์ค๋ช ์์ ์ผ์นํ๊ธฐ ์ํดarc-runners
์ ๋๋ค. ์์ธํ ๋ด์ฉ์ Actions Runner Controller์ ๋ํ ๋น ๋ฅธ ์์์(๋ฅผ) ์ฐธ์กฐํ์ธ์.Bash kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_token='YOUR-PAT'
kubectl create secret generic pre-defined-secret \ --namespace=arc-runners \ --from-literal=github_token='YOUR-PAT'
-
values.yaml
ํ์ผ ๋ณต์ฌ๋ณธ์์ ๋น๋ฐ ์ด๋ฆ์ ์ฐธ์กฐ๋ก ์ ๋ฌํฉ๋๋ค.githubConfigSecret: pre-defined-secret
์ถ๊ฐ Helm ๊ตฌ์ฑ ์ต์ ์ ARC ๋ฆฌํฌ์งํ ๋ฆฌ์
values.yaml
์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์๊ฒฉ ์ฆ๋ช ๋ชจ์ ๋น๋ฐ์ ์ฌ์ฉํ์ฌ ARC ์ธ์ฆ
์ฐธ๊ณ ํญ๋ชฉ
์๊ฒฉ ์ฆ๋ช ๋ชจ์ ํตํฉ์ ํ์ฌ Azure Key Vault๋ฅผ ์ง์ํ๋ ๊ณต๊ฐ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ๋ก ์ ๊ณต๋ฉ๋๋ค.
gha-runner-scale-set ๋ฒ์ 0.12.0๋ถํฐ ARC๋ ์ธ๋ถ ์๊ฒฉ ์ฆ๋ช ๋ชจ์์์ GitHub ์๊ฒฉ ์ฆ๋ช ๊ฒ์ ๊ธฐ๋ฅ์ ์ง์ํฉ๋๋ค. ์๊ฒฉ ์ฆ๋ช ๋ชจ์ ํตํฉ์ ์คํ๊ธฐ ํ์ฅ ์งํฉ๋ณ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค. ์ฆ, ๋ณด์ ๋ฐ ์ด์ ์๊ตฌ ์ฌํญ์ ๋ฐ๋ผ ์ผ๋ถ ํ์ฅ ์งํฉ์ Kubernetes ๋น๋ฐ์ ์ฌ์ฉํ์ฌ ์คํํ๊ณ ๋ค๋ฅธ ํ์ฅ ์งํฉ์ ์๊ฒฉ ์ฆ๋ช ๋ชจ์ ๊ธฐ๋ฐ ๋น๋ฐ์ ์ฌ์ฉํ์ฌ ์คํํ ์ ์์ต๋๋ค.
์๊ฒฉ ์ฆ๋ช ๋ชจ์ ํตํฉ ์ฌ์ฉ
์คํ๊ธฐ ํ์ฅ ์งํฉ์ ์๊ฒฉ ์ฆ๋ช ๋ชจ์ ํตํฉ์ ์ฌ์ฉํ๋๋ก ์ค์ ํ๋ ค๋ฉด ๋ค์์ ์ํํฉ๋๋ค.
values.yaml
ํ์ผ์githubConfigSecret
ํ๋๋ฅผ ์๊ฒฉ ์ฆ๋ช ๋ชจ์์ ์ ์ฅ๋ ๋น๋ฐ ํค์ ์ด๋ฆ์ผ๋ก ์ค์ ํฉ๋๋ค. ์ด ๊ฐ์ ๋ฌธ์์ด์ด์ด์ผ ํฉ๋๋ค.- ์ ์ ํ ๊ณต๊ธ์์ ์ก์ธ์ค ์ธ๋ถ ์ ๋ณด๋ฅผ ์ด์ฉํ์ฌ
values.yaml
ํ์ผ์์keyVault
์น์ ์ ์ฃผ์ ์ฒ๋ฆฌ๋ฅผ ์ ๊ฑฐํ๊ณ ๊ตฌ์ฑํ์ธ์. - ์ปจํธ๋กค๋ฌ์ ์์ ๊ธฐ ๋ชจ๋์ํ์ํ ์ธ์ฆ์(
.pfx
)๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋ค์์ ์ํํ์ฌ ์ด ์์ ์ ์ํํ ์ ์์ต๋๋ค. *์ธ์ฆ์๊ฐ ํฌํจ๋ ์ปจํธ๋กค๋ฌ ์ด๋ฏธ์ง๋ฅผ ๋ค์ ๋น๋ํ๊ฑฐ๋ *listenerTemplate
๋ฐcontrollerManager
ํ๋๋ฅผ ์ฌ์ฉํ์ฌ ์ธ์ฆ์๋ฅผ ์ปจํธ๋กค๋ฌ์ ์์ ๊ธฐ ๋ชจ๋์ ๋ณผ๋ฅจ์ผ๋ก ๋ง์ดํธํฉ๋๋ค.
๋น๋ฐ ํ์
Azure Key Vault์ ์ ์ฅ๋ ๋น๋ฐ์ JSON ํ์์ด์ด์ผ ํฉ๋๋ค. ๊ตฌ์กฐ๋ ์ฌ์ฉ ์ค์ธ ์ธ์ฆ ์ ํ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค.
์: GitHub ํ ํฐ
{
"github_token": "TOKEN"
}
์: GitHub ์ฑ
{
"github_app_id": "APP_ID_OR_CLIENT_ID",
"github_app_installation_id": "INSTALLATION_ID",
"github_app_private_key": "PRIVATE_KEY"
}
์๊ฒฉ ์ฆ๋ช
๋ชจ์ ํตํฉ์ ์ํ values.yaml
๊ตฌ์ฑ
์ธ์ฆ์๋ .pfx ํ์ผ๋ก ์ ์ฅ๋๊ณ /akv/cert.pfx์ ์ปจํ ์ด๋์ ๋ง์ดํธ๋ฉ๋๋ค. ๋ค์์ ์ธ์ฆ์ ์ด ์ธ์ฆ์๋ฅผ ์ฌ์ฉํ๋๋ก keyVault ์น์ ์ ๊ตฌ์ฑํ๋ ๋ฐฉ๋ฒ์ ์์ ๋๋ค.
keyVault:
type: "azure_key_vault"
proxy:
https:
url: "PROXY_URL"
credentialSecretRef: "PROXY_CREDENTIALS_SECRET_NAME"
http: {}
noProxy: []
azureKeyVault:
clientId: <AZURE_CLIENT_ID>
tenantId: <AZURE_TENANT_ID>
url: <AZURE_VAULT_URL>
certificatePath: "/akv/cert.pfx"
์ปจํธ๋กค๋ฌ ๋ฐ ์์ ๊ธฐ์ ์ธ์ฆ์ ์ ๊ณต
ARC๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ์๊ฒฉ ์ฆ๋ช
๋ชจ์์ ์ธ์ฆํ๊ธฐ ์ํด .pfx
์ธ์ฆ์๊ฐ ํ์ํฉ๋๋ค. ์ด ์ธ์ฆ์๋ ์ปจํธ๋กค๋ฌ ์ค์น ์ค์ ์ปจํธ๋กค๋ฌ์ ์์ ๊ธฐ ๊ตฌ์ฑ ์์ ๋ชจ๋์์ ์ฌ์ฉํ ์ ์์ด์ผ ํฉ๋๋ค.
values.yaml
ํ์ผ์์ controllerManager
๋ฐ listenerTemplate
ํ๋๋ฅผ ์ฌ์ฉํ์ฌ ์ธ์ฆ์๋ฅผ ๋ณผ๋ฅจ์ผ๋ก ๋ง์ดํธํ์ฌ ์ด ์์
์ ์ํํ ์ ์์ต๋๋ค.
volumes:
- name: cert-volume
secret:
secretName: my-cert-secret
volumeMounts:
- mountPath: /akv
name: cert-volume
readOnly: true
listenerTemplate:
volumeMounts:
- name: cert-volume
mountPath: /akv/certs
readOnly: true
volumes:
- name: cert-volume
secret:
secretName: my-cert-secret
์๋ ์ฝ๋๋ ํ์ฅ ์งํฉ values.yml
ํ์ผ์ ์์
๋๋ค.
listenerTemplate:
spec:
containers:
- name: listener
volumeMounts:
- name: cert-volume
mountPath: /akv
readOnly: true
volumes:
- name: cert-volume
secret:
secretName: my-cert-secret
๋ฒ์ ๊ณ ์ง
๋ค์์ Apache-2.0 ๋ผ์ด์ ์ค์์ https://github.com/actions/actions-runner-controller/๋ก๋ถํฐ ์ผ๋ถ ์กฐ์ ๋์์ต๋๋ค.
Copyright 2019 Moto Ishizawa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.