์ด ์น์ ์์๋ ํ์ด๋ธ๋ฆฌ๋ ๊ด๋ฆฌ ์์ญ๊ณผ ๋ฐํ์ ์์ญ์ MART ์๋น์ค ์ฌ์ด์ ํต์ ์ ์ํด Apigee Connect(๋ฒ ํ)๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช ํฉ๋๋ค.
์๊ฐ
Apigee Connect๋ฅผ ์ฌ์ฉํ๋ฉด ์ธํฐ๋ท์ MART ์๋ํฌ์ธํธ๋ฅผ ๋ ธ์ถํ ํ์ ์์ด Apigee Hybrid ๊ด๋ฆฌ ์์ญ์ ๋ฐํ์ ์์ญ์ MART ์๋น์ค์ ์์ ํ๊ฒ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค. Apigee Connect๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ ํธ์คํธ ๋ณ์นญ ๋ฐ ์น์ธ๋ DNS ์ธ์ฆ์๋ก MART ์ธ๊ทธ๋ ์ค ๊ฒ์ดํธ์จ์ด๋ฅผ ๊ตฌ์ฑํ ํ์๊ฐ ์์ต๋๋ค.
๊ธฐ๋ณธ ์๊ฑด
Apigee Connect๋ฅผ ์ค์ ํ๋ ค๋ฉด ๋จผ์ Apigee Hybrid ๋ฒ์ 1.2.0 ์ด์์ ์ค์นํ๊ณ ๊ตฌ์ฑํด์ผ ํฉ๋๋ค.
- Apigee Hybrid๋ฅผ ์ฒ์ ์ค์นํ๋ ๊ฒฝ์ฐ Apigee Hybrid ๋ฌธ์์ ์ค์น ์๋ด๋ฅผ ๋ฐ๋ฆ ๋๋ค.
- ํ์ฌ Apigee Hybrid ๋ฒ์ 1.1.x๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ณ์ํ๊ธฐ ์ ์ ๋ฒ์ 1.2.0์ผ๋ก ์ค์น๋ฅผ ์ ๊ทธ๋ ์ด๋ํด์ผ ํฉ๋๋ค. ์ ๊ทธ๋ ์ด๋ ๋จ๊ณ๋ Apigee Hybrid ์ ๊ทธ๋ ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์.
ํ์ด๋ธ๋ฆฌ๋ ๋ฐํ์์ Apigee Connect ์ถ๊ฐ
์ด ์น์ ์์๋ Apigee Hybrid 1.2.0 ์ด์์ ์ค์น ๋๋ ์ ๊ทธ๋ ์ด๋ํ๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
Apigee Connect๊ฐ ๊ตฌ์ฑ๋์๊ณ ์ฌ์ฉ ์ค์ ๋์์ผ๋ฉด MART ์ธ๊ทธ๋ ์ค๊ฐ ๋ฌด์๋ฉ๋๋ค. ๊ด๋ฆฌ ์์ญ์ Apigee Connect๋ฅผ ์ฌ์ฉํด์๋ง MART์ ์ฐ๊ฒฐ๋ฉ๋๋ค. ํ์ด๋ธ๋ฆฌ๋ ๋ฐํ์ ์์ญ ๊ฐ์ ๋ชจ๋ MART ํธ๋ํฝ์ ์์ ํ Apigee Connect ์ฐ๊ฒฐ์ ํตํด ์ ๋ฌ๋ฉ๋๋ค.
Apigee Hybrid์์ Apigee Connect๋ฅผ ์ฌ์ฉ ์ค์ ํ๊ณ ์ฌ์ฉํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์.
- Google Cloud API ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ Apigee Connect API๋ฅผ ์ฌ์ฉ ์ค์ ํฉ๋๋ค. Google Cloud(GCP) Console์์ ๋๋
gcloud
๋ฅผ ์ฌ์ฉํ์ฌ API๋ฅผ ์ฌ์ฉ ์ค์ ํ ์ ์์ต๋๋ค. Google Cloud ์ฝ์์์ API ์ฌ์ฉ ์ค์ ์ ๋ํ ์์ธํ ๋ด์ฉ์ 3๋จ๊ณ: API ์ฌ์ฉ ์ค์ ์ ์ฐธ์กฐํ์ธ์.gcloud
๋ฅผ ์ฌ์ฉํด์ API๋ฅผ ์ฌ์ฉ ์ค์ ํ๋ ค๋ฉด ๋ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์.
$ gcloud config set project YOUR_GCP_PROJECT_ID $ gcloud services enable apigeeconnect.googleapis.com
YOUR_GCP_PROJECT_ID
๋ Apigee๊ฐ ์ฌ์ฉ ์ค์ ๋์๊ณ Apigee ์กฐ์ง์ด ์๋์ผ๋ก ํ๋ก๋น์ ๋๋ ๋์ผํ GCP ํ๋ก์ ํธ์ ๋๋ค. - Apigee Hybrid ์ค์น ์๋ด์ ์๋น์ค ๊ณ์ ๋ง๋ค๊ธฐ ๋จ๊ณ์์ ๋ง๋ MART ์๋น์ค ๊ณ์ ์ Apigee Connect ์์ด์ ํธ ์ญํ ์ ์ถ๊ฐํฉ๋๋ค.
$ gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID --member serviceAccount:YOUR_MART_SERVICE_ACCOUNT_EMAIL --role roles/apigeeconnect.Agent
YOUR_GCP_PROJECT_ID
๋ Apigee๊ฐ ์ฌ์ฉ ์ค์ ๋์๊ณ Apigee ์กฐ์ง์ด ์๋์ผ๋ก ํ๋ก๋น์ ๋๋ ๋์ผํ GCP ํ๋ก์ ํธ์ด๋ฉฐYOUR_MART_SERVICE_ACCOUNT_EMAIL
์ MART ์๋น์ค ๊ณ์ ์ด๋ฆ์ ๋๋ค. ์ด๋ฆ์ ์ด๋ฉ์ผ ์ฃผ์ ํ์์ ๋๋ค. ์๋ฅผ ๋ค๋ฉดapigee-mart@my-project.iam.gserviceaccount.com
์ ๋๋ค.
Apigee Connect ์์ด์ ํธ ์ญํ ์ ์ฌ์ ์ ์๋์ด ์์ผ๋ฉฐ ๋ค์ ๊ถํ์ด ํ ๋น๋ฉ๋๋ค.
๊ถํ ์ค๋ช apigeeconnect.endpoints.connect
Apigee Connect ์์ด์ ํธ๋ฅผ ์ค์ ํ ์ ์๋ ๊ถํ์ ๋๋ค. GCP Console ๋๋ API๋ฅผ ํตํ ์ก์ธ์ค ๊ถํ ๋ถ์ฌ ํ ๋น์ ๋ํ ์์ธํ ๋ด์ฉ์ ๋ค์์ ์ฐธ์กฐํ์ธ์.
- ์๋น์ค ๊ณ์ ๋ง๋ค๊ธฐ์ ์ค๋ช
๋ ๋๋ก MART ์๋น์ค ๊ณ์ ์ ํค ํ์ผ์ด
hybrid_files/service_accounts
๋๋ ํฐ๋ฆฌ์ ์๋์ง ํ์ธํฉ๋๋ค. - ์ฌ์ ์ ํ์ผ์ ์ด๊ณ ๋ค์ ์คํ ์๋ฅผ ์ถ๊ฐํฉ๋๋ค. ์ด ๊ตฌ์ฑ์์๋ ๋ค์ด๋ก๋๋ ์๋น์ค ๊ณ์ ํค์ ๋ํ ๊ฒฝ๋ก๋ฅผ ์ ๊ณตํด์ผ ํฉ๋๋ค. ์ด ํค๋ Apigee Connect ์์ด์ ํธ ์ญํ ์ด ์๋ ์๋น์ค ๊ณ์ ์ฉ์ด์ด์ผ ํฉ๋๋ค.
# Apigee Connect Agent connectAgent: enabled: true serviceAccountPath: ./service-accounts/connect_agent_sa_key.json
k8sCluster ์ ๋ชฉ ์๋์ ์คํ ์๋ฅผ ์ถ๊ฐํฉ๋๋ค. ์๋ฅผ ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
k8sCluster: name: your_cluster_name region: your_cluster_region # Apigee Connect Agent connectAgent: enabled: true serviceAccountPath: ./service-accounts/connect_agent_sa_key.json
# Apigee Connect Agent connectAgent: enabled: true replicaCountMin: 3 serviceAccountPath: ./service-accounts/connect_agent_sa_key.json
- ๋๊ธฐํ ๋ด๋น์ ์ก์ธ์ค ์ฌ์ฉ ์ค์ ์น์ ์ ์ค๋ช ๋ ๋๋ก Apigee Hybrid๋ฅผ ์ฒ์ ์ค์นํ ๋ ๋ค์ด๋ก๋ํ Apigee ์กฐ์ง ๊ด๋ฆฌ์ ์ญํ ์ด ์๋ ์๋น์ค ๊ณ์ ํค๋ฅผ ์ฐพ์ต๋๋ค. ์๋ ์ค๋ช ๋ ๋๋ก API ํธ์ถ์ ์ํํ๋ ๋ฐ ํ์ํ ํ ํฐ์ ์์ฑํ๋ ค๋ฉด ์ด ํค๊ฐ ํ์ํฉ๋๋ค.
- ๋ค์ ๋ ๋ช
๋ น์ด๋ฅผ ์คํํ์ฌ ํ ํฐ์ ๊ฐ์ ธ์ต๋๋ค.
$ export GOOGLE_APPLICATION_CREDENTIALS=org-admin-service-account-file $ export TOKEN=$(gcloud auth application-default print-access-token)
org-admin-service-account-file์ ์์คํ ์์ Apigee ์กฐ์ง ๊ด๋ฆฌ์ ์ญํ ๋ก ๋ค์ด๋ก๋ํ ์๋น์ค ๊ณ์ ํค์ ๋ํ ๊ฒฝ๋ก์ ๋๋ค. - ๋ค์ Apigee API๋ฅผ ํธ์ถํ์ฌ ์กฐ์ง์ Apigee Connect๋ฅผ ์ฌ์ฉ ์ค์ ํ์ธ์.
curl -v -X PUT \ https://apigee.googleapis.com/v1/organizations/your_org_name \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "name" : "your_org_name", "properties" : { "property" : [ { "name" : "features.hybrid.enabled", "value" : "true" }, { "name" : "features.mart.connect.enabled", "value" : "true" } ] } }'
- ํด๋ฌ์คํฐ์์ Apigee Connect ์์ด์ ํธ๋ฅผ ์์ํฉ๋๋ค.
$ $APIGEECTL_HOME/apigeectl apply -f your_overrides_file.yaml -c connect-agent
- Apigee Connect ์์ด์ ํธ ๋ก๊ทธ๋ฅผ ํ์ธํฉ๋๋ค. ๋ณด๊ณ ๋ ์ค๋ฅ๊ฐ ์์ผ๋ฉด ์
๊ทธ๋ ์ด๋๊ฐ ์ฑ๊ณตํฉ๋๋ค.
$ kubectl logs -n namespace apigee-connect-agent-pod-name
Apigee Connect ์์ด์ ํธ์์ ๋ค์ ๋ก๊ทธ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ๋ณด๊ณ ํฉ๋๋ค.
๊ฐ์ฌ ๋ก๊ทธ ์นดํ ๊ณ ๋ฆฌ ์์ DATA_READ ConnectionService.ListConnections
DATA_WRITE Tether.Egress
- ์ค์น๋ฅผ ํ ์คํธํฉ๋๋ค.
mart: hostAlias: "mart.apigee-hybrid-docs.net" serviceAccountPath: ./service-accounts/example-project-apigee-mart.json sslCertPath: ./certs/fullchain.pem sslKeyPath: ./certs/privkey.key
์ด ์ ๊ทธ๋ ์ด๋๋ฅผ ์ฌ์ฉํ๋ฉด ํ์ด๋ธ๋ฆฌ๋ ๋ฐํ์ ์์ญ์ด Apigee Connect๋ฅผ ํตํด ๊ด๋ฆฌ ์์ญ๊ณผ ํต์ ํฉ๋๋ค.
์ฐธ์กฐ: Apigee Connect ์ ๊ฑฐ
์ค์น ํ ์คํธ
- Apigee Hybrid UI๋ฅผ ์ฝ๋๋ค.
- ์ด์ ์ ๋ง๋ ๊ฐ๋ฐ์ ๋ฐ ๊ฐ๋ฐ์ ์ฑ์ด UI์ ์๋์ง ํ์ธํฉ๋๋ค. ์ด๋ฌํ ํญ๋ชฉ์ MART ์๋ฒ์์ ์ฟผ๋ฆฌ๋์๊ธฐ ๋๋ฌธ์ ๊ด๋ฆฌ ์์ญ๊ณผ ๋ฐํ์ ์์ญ ๊ฐ ํต์ ์ด ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌ์ฑ๋ ๊ฒฝ์ฐ์๋ง ์ ๊ณต๋ฉ๋๋ค.
- ์์ฒญ์ด MART ์ธ๊ทธ๋ ์ค๊ฐ ์๋๋ผ Apigee Connect๋ฅผ ํต๊ณผํ๋์ง ํ์ธํ๋ ค๋ฉด MART ์๋ฒ ๋ก๊ทธ๋ฅผ ํ์ธํฉ๋๋ค.
apigee-connect-agent-1.0
์ด๋ผ๋ Apigee Connect ์์ด์ ํธ์ ๋ํ ํญ๋ชฉ์ด ํ์๋ฉ๋๋ค.
$ kubectl logs -n apigee apigee-mart-orgname-rc101-q72tl -c apigee-mart | grep connect
์๋ฅผ ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
"2019-12-11 04:59:52,321 org: env: target: action: context-id: mode: pool-1-thread-1 INFO MART_AUDITLOG - MartAuditListener.eventOccurred() : Type:Audit edge-gaambo-controlplane@system.gserviceaccount.com 1576040392317 /v1/organizations/apigee-connect-hybrid-prod/developers/ count=100&expand=true&startKey=4ee9e8f7-12b2-4cde-bf10-32d991469876 200 GET apigee-connect-hybrid-prod 10.40.11.3 10.40.0.5 apigee-connect-agent-1.0 null"
- ํ์ด๋ธ๋ฆฌ๋ UI์์ API ์ ํ, ๊ฐ๋ฐ์, ๊ฐ๋ฐ์ ์ฑ์ ๋ง๋ญ๋๋ค. ๊ทธ๋ฐ ๋ค์ MART ์๋น์ค ๋ก๊ทธ๋ฅผ ํ์ธํ์ฌ ๋ก๊ทธ ํญ๋ชฉ์ด ํญ๋ชฉ์ ๋ฐํ์ ์์ญ์ผ๋ก ์ ์กํ๋์ง ํ์ธํฉ๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์ ๋ก๊ทธ ํญ๋ชฉ์
foo-product
๋ผ๋ API ์ ํ์ด ์์ ๋์์์ ๋ณด์ฌ์ค๋๋ค.
$ kubectl logs -n apigee apigee-mart-orgname-rc101-q72tl -c apigee-mart
2019-12-16 22:15:29,572 org: env: target: action: context-id: mode: pool-1-thread-1 INFO MART_AUDITLOG - MartAuditListener.eventOccurred() : Type:Audit edge-gaambo-controlplane@system.gserviceaccount.com 1576534529566 /v1/organizations/myorg/apiproducts/foo-product/ -NA- 201 CREATE myorg 10.16.1.61 10.16.1.64 apigee-connect-agent-1.0 null 2019-12-16 22:15:30,412 org: env: target: action: context-id: mode: pool-1-thread-1 INFO MART_AUDITLOG - MartAuditListener.eventOccurred() : Type:Audit edge-gaambo-controlplane@system.gserviceaccount.com 1576534530407 /v1/organizations/myorg/apps/ apiProduct=foo-product&expand=false 200 GET myorg 10.16.1.61 10.16.1.64 apigee-connect-agent-1.0 null
- ํ๋ก์ ๋ง๋ค๊ธฐ ๋ฐ ๋ฐฐํฌ์ ์ค๋ช ๋ ๋๋ก ์ ํ๋ก์๋ฅผ ๋ง๋ค๊ณ ๋ฐฐํฌํฉ๋๋ค.
- ๋ค์ API ํค๋ฅผ ์๊ตฌํ์ฌ API ํ๋ก์ ๋ณดํธ์ ๋จ๊ณ์ ๋ฐ๋ผ API ํค ํ์ธ์ผ๋ก ํ๋ก์๋ฅผ ๊ตฌ์ฑํฉ๋๋ค. ๋ฐํ์์ Apigee Connect๋ฅผ ํตํด ๊ด๋ฆฌ ์์ญ์์ API ํค๋ฅผ ๊ฒ์ฆํ๋ ๋ฐ ํ์ํ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ต๋๋ค. ๋ฐ๋ผ์ API ํค ํ์ธ์ด ์๋ํ๋ค๋ฉด Apigee Connect๊ฐ ์ ๋๋ก ์๋ํ๋ ๊ฒ์ ์ ์ ์์ต๋๋ค. Apigee Connect ๋ก๊ทธ๋ฅผ ํ์ธํ์ฌ ๋ฐ์ดํฐ ์ ์ก ๋ณด๊ณ ์๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
Apigee Connect ์ญ์
Apigee Connect ๋ฐฐํฌ๋ฅผ ์ญ์ ํ ๊ฒฝ์ฐ pod ์ํ๋ ์ต๋ 7๋ถ ๋์ '์ข ๋ฃ ์ค' ์ํ๋ก ์ ์ง๋ ์ ์์ต๋๋ค. ์ด ์๊ฐ์ ์์ ๊ฐ์ ๋๋ค. Apigee Connect ์์ด์ ํธ๋ ์ฐ๊ฒฐ์ ๊ฐ์๊ธฐ ์ค์งํ๋ ๋์ ๊ธฐ์กด ์ฐ๊ฒฐ์ด ์ข ๋ฃ๋ ๋๊น์ง ๊ธฐ๋ค๋ฆฝ๋๋ค. ์ด๋ฌํ ์ง์ฐ ์๊ฐ์ ์งํ ์ค์ธ ์์ฒญ์ด ์์ค๋์ง ์๋๋ก ๋ณด์ฅํฉ๋๋ค.