Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Copy Kubernetes Clusters Really Fast
Shimpei Otsubo
March 11, 2021
Technology
3
2.4k
Copy Kubernetes Clusters Really Fast
Shimpei Otsubo
March 11, 2021
Tweet
Share
More Decks by Shimpei Otsubo
See All by Shimpei Otsubo
Go と Wantedly の関係 / How Wantedly uses Go
potsbo
1
610
Deploy Flow at Wantedly
potsbo
2
560
Wrap every method with just one line
potsbo
1
2.7k
Zero yen Keyboard
potsbo
6
2.5k
Kube - The core tool at Wantedly
potsbo
1
4.6k
k8s - Kubernetes 8 Factors
potsbo
12
8.9k
コンテンツ作成に集中するためのプレゼンテーション Tips / Presentation with Confidence
potsbo
5
27k
ConfigMap vs Secret #k8sjp
potsbo
1
1k
Microservices on Kubernetes
potsbo
5
9.1k
Other Decks in Technology
See All in Technology
OpenShiftでスポットVMを使おう.pdf
jpishikawa
1
290
JAWS-UG 横浜 #54 資料
takakuni
0
210
Raspberry Pi Camera 3 介紹
piepie_tw
PRO
0
150
Deep dive in Reserved Instance ~脳死推奨量購入からの脱却~
kzkmaeda
0
530
SSMパラメーターストアでクロススタック参照の罠を回避する
shuyakinjo
0
100
立ち止まっても、寄り道しても / even if I stop, even if I take a detour
katoaz
0
500
API連携に伴う規制と対応 / Regulations and responses to API linkage
moneyforward
0
150
初めてのデータ移行プロジェクトから得た学び
tjmtmmnk
0
300
創業1年目のスタートアップでAWSコストを抑えるために取り組んでいること / How to Keep AWS Costs Down at a Startup
yuj1osm
3
2.1k
OpenShift.Run2023_create-aro-with-terraform
ishiitaiki20fixer
1
250
20230123_FinJAWS
takuyay0ne
0
120
OPENLOGI Company Profile
hr01
0
12k
Featured
See All Featured
The Web Native Designer (August 2011)
paulrobertlloyd
76
2.2k
Debugging Ruby Performance
tmm1
67
11k
Building Flexible Design Systems
yeseniaperezcruz
314
35k
GitHub's CSS Performance
jonrohan
1020
430k
Fireside Chat
paigeccino
16
1.8k
Bash Introduction
62gerente
601
210k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
50k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
2
400
How To Stay Up To Date on Web Technology
chriscoyier
779
250k
Atom: Resistance is Futile
akmur
256
24k
Fontdeck: Realign not Redesign
paulrobertlloyd
74
4.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
346
17k
Transcript
©2021 Wantedly, Inc. Kubernetes Cluster Λ Copy ޙΖଆͷ Microservice ͷ
Review ؆୯ʹ CloudNative Days Spring 2021 ONLINE Mar 11, 2020 - Shimpei Otsubo @potsbo
Shimpei Otsubo @potsbo Developer eXperience Squad Wantedly, Inc. Kubernetes Dev
Tools CI / CD AuthN / Z Productivity Dvorak
©2021 Wantedly, Inc. Developer eXperience Squad ͱʁ ྑ͍։ൃମݧ͕ྑ͍ϓϩμΫτͱձࣾΛ࡞Δ ։ൃମݧͷͨΊͳΒԿͰ͢Δ ։ൃ࣌ؒͷ30%ఔͰϓϩμΫτ։ൃʹճΔ
Backend, Frontend, Infrastructure, Mobile ͳͲΛΘͳ͍ උͨ͠ج൫ͷυοάϑʔσΟϯά / ʮ։ൃऀ͕ຊʹٻΊ͍ͯΔͷͳʹ͔?ʯΛߟ͑Δ ֎෦ʹٕज़ج൫νʔϜͱհ͢Δ͜ͱଟ͍ ߴ͔ͭ҆શͳ deploy ϓϩμΫτͱ৫Λͤ͞Δ ٕज़ࢿͱͷલͷϓϩμΫτͷ༏ઌॱҐΛߟ͑ΔλΠϛϯάΛ࣋ͪଓ͚Δ ίʔυΛॻ͔ͳ͍ղܾࡦࢹʹೖΕΔ 10ޙͷ։ൃͷৗࣝΛ࡞͍͚ͬͯΔνʔϜʹ͍ͨ͠
©2021 Wantedly, Inc. TL;DR Istio + Ambassador Λͬͯ Ծతͳ Kubernetes
ͷ copy Λ࣮ݱ ͜ΕʹΑͬͯ։ൃମݧ͕ΨϥοͱมΘΔ
©2021 Wantedly, Inc. ߴͰޮతͳΫϥελ copy ͕͍ͨ͠ Copy on Write ͰԾΫϥελΛ࡞Δ
Ԡ༻ͱಘΒΕͨମݧ WHY HOW WHAT
©2021 Wantedly, Inc. WHY Microservice ͷґଘղܾΛ͠ͳͯ͘ྑ͍ ߴͰޮతͳΫϥελ copy ͕͍ͨ͠ Preview
URL Λ࡞ΕΔ Photo by Jørgen Håland on Unsplash
©2021 Wantedly, Inc. ϙνϙν͔ͯ֬͠Ί͍ͨ͜ͱΑ͋͘Δ UI มߋͳΒͪΖΜ ΞϧΰϦζϜͷมߋ࣮σʔλͰݟͯΈ͍ͨ
©2021 Wantedly, Inc. Preview Deployment ੲ͔ΒΑ͋͘Δ https://vercel.com/docs/git/vercel-for-github Vercel, Heroku, Netlify
νʔϜશһͰಉ͡ͷΛݟΕΔ ຊ൪ʹ͍ۙঢ়ଶ ϫϯΫϦοΫͰ֬ೝ ࠷ۙͷ PaaS ʹී௨ʹ͋Δػೳ ىಈํ๏ΛΒͳ͍͍ͯ͘ ΞϓϦέʔγϣϯͷશମ૾͢ΒΒͳ͍͍ͯ͘ ։ൃ build Ͱ͔͠ى͖ͳ͍ʹϋϚͬͨΓ͠ͳ͍ ԶͷPCͰಈͧ͘ʁͱ͔ى͜Βͳ͍ ࣮σʔλΛ͑ͨΓ͢Δ Kubernetes ্Ͱ࣮ݱ͢Δ OSS ͋Δ
©2021 Wantedly, Inc. Microservice Ͱ؆୯Ͱͳ͍ ཪଆͷ Microservice ʹͲ͏ͬͯ౸ୡ͢Δ͔ʁ ཪଆʹܨ͍Ͱ integration
ͨ͠ঢ়ଶͰͷ test ͕Ͱ͖ͳ͍ Wantedly Ͱͱͱ͜ͷχʔζʹڞ༗ڥʹ deploy ͢Δ͜ͱͰ͍ͬͯͨ Ұ൪ front ʹཱͭ service ͳΒ؆୯ ޙΖଆʹཱͭ service ʹ؆୯ʹ౸ୡͰ͖ͳ͍ ޙΖଆ͚͕ͩҧ͏ front ͷ microservice ΛͲ͏ͬͯ࡞Γग़͔͢ʁ ͜͜ͷ Routing Ͳ͏Δͷʁ
©2021 Wantedly, Inc. Microservice Ͱ؆୯Ͱͳ͍ ඞཁͳ͚ͩ copy ͠Α͏ͱ͢Δͱͦͷґଘղܾ͕ͦͦେม Microservice ͷ
interface ͷઌΛҙࣝͨ͘͠ͳ͍ Wantedly Ͱͱͱ͜ͷχʔζʹڞ༗ڥʹ deploy ͢Δ͜ͱͰ͍ͬͯͨ ͜Ε͕ࣗ໌ʹͳΔΑ͏ͳ architecture Λࢦ͖͢ͱ͍͏͋Δ
©2021 Wantedly, Inc. Kubernetes Cluster Λ copy ͢Ε ok! ґଘؔউखʹͯ͢ຬͨ͞ΕΔ
ཪଆ͚ͩҧ͏ঢ়ଶΛશʹ࠶ݱ Wantedly ͷ߹શ microservice 140ݸ͕ 1 cluster ʹଘࡏ Microservice Ͱ Preview ͕Ͱ͖ΔΑ͏ʹͳΔ https://speakerdeck.com/morux2/istio-integrated-telepresence https://event.cloudnativedays.jp/cndt2020/talks/17 ͜ͷลͷϞνϕʔγϣϯલճৄ͘͠
©2021 Wantedly, Inc. Kubernetes Cluster Λ copy ͢Ε ok! ຊʹͦΜͳ͜ͱͰ͖Δͷ͔
Wantedly ͷ߹શ microservice 140ݸ͕ 1 cluster ʹଘࡏ
©2021 Wantedly, Inc. Context Propagation Service Mesh Gateway Header Λൖ
Header Ͱ Routing Host Λ Header ʹม HOW Copy on Write Ͱ Virtual Copy Photo by Alina Grubnyak on Unsplash
©2021 Wantedly, Inc. ԾతͳΫϥελ copy πʔϧ kubefork Λ࡞ͬͨ ڞ༗Ͱ͖Δͱ͜Ζڞ༗ Copy
on Write ͯ͢ Copy ͢Δͱ N * D ඞཁͳͱ͜Ζ͚ͩͩͱ N + D ޮత ҟͳΔ෦͚ͩஔ͖͑ N: microservice , D: ։ൃऀ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ શ෦࣮ copy ͩͱ node ͕ͪൃੜ ߴ OSS ʹ͍͚ͨ͠Ͳؒʹ߹ͬͯͳ͍ Deployment ͱ service ͷΈ
©2021 Wantedly, Inc. Terminology Ծతʹ copy ͞ΕͨΫϥελ Virtual Cluster Virtual
Cluster Λಛఆ͢Δ id Fork Identifier Ұͭͷ fork identifier Λ࣋ͭ Shared ͳ cluster Λͱʹ Fork ͢Δ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ Virtual Cluster Λੜ͢Δ
©2021 Wantedly, Inc. Terminology Ծతʹ copy ͞ΕͨΫϥελ Virtual Cluster Virtual
Cluster Λಛఆ͢Δ id Fork Identifier Ұͭͷ fork identifier Λ࣋ͭ Shared ͳ cluster Λͱʹ Fork ͢Δ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ Virtual Cluster Λੜ͢Δ
©2021 Wantedly, Inc. Terminology Ծతʹ copy ͞ΕͨΫϥελ Virtual Cluster Virtual
Cluster Λಛఆ͢Δ id Fork Identifier Ұͭͷ fork identifier Λ࣋ͭ Shared ͳ cluster Λͱʹ Fork ͢Δ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ Virtual Cluster Λੜ͢Δ
©2021 Wantedly, Inc. Terminology Ծతʹ copy ͞ΕͨΫϥελ Virtual Cluster Virtual
Cluster Λಛఆ͢Δ id Fork Identifier Ұͭͷ fork identifier Λ࣋ͭ Shared ͳ cluster Λͱʹ Fork ͢Δ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ Virtual Cluster Λੜ͢Δ
©2021 Wantedly, Inc. Wildcard DNS Ͱ upstream ΛଋͶΔ Gateway Request
Λదͳ copy ઌૹΔ Service Mesh ߏཁૉ Context Propagation fork identifier Λ header ͱͯ͠ൖ 4 microservice ߏʹ2ͭͷ copy Λੜͨ͠߹ Ͳͷ Virtual Cluster ༻ͷ request? ମײ৽͍͠ host ͷΞΫηε
©2021 Wantedly, Inc. Context Propagation ʮͲͷ Virtual Cluster ʹ͚ΒΕͨͷ͔ʯΛRequest ͝ͱʹཧ
e.g. X-Fork-Identifier: forked-a ࣾڞ௨ϥΠϒϥϦ servicex Ͱ࣮ݱ Feature Flag ͳͲԠ༻৭ʑ X-Feature-Flags: {"name": "new_feature?": "enabled": true} e.g. ޙΖଆͷ microservice ͷ new-feature Λ༗ޮʹͨ͠ঢ়ଶ͕ݟ͍ͨͱ͖ʹ HTTP header Λൖ͢Δ͜ͱͰ request ͝ͱͷॲཧΛ؆୯ʹՃͰ͖ΔΑ͏ʹͳΔ ಛఆͷ Prefix Λ࣋ͭ header / metadata ΛࣗಈͰൖ ޙड़ Ͳͷ Microservice ؒ௨৴ͰʮѼઌClusterʯ͕໌ࣔతʹͳΔ https://www.wantedly.com/companies/wantedly/post_articles/311135
©2021 Wantedly, Inc. ༨ஊ: Metadata ͷ͍͗͢ʹҙ ൖ͍ͨ͠ͷ͍ͬͺ͍͋Δ UserId, Country, Language
ͳͲޙΖଆͷ server Ͱཉ͘͠ͳΔ͜ͱΑ͋͘Δ ෦͚: wantedly/dev#412 ్தܦ࿏ͷͯ͢ͷ schema ʹੜ͍ͯ͘͠Έ͍ͨͳͷਏ͍ ৴༻Ͱ͖Δ͔Θ͔Βͳ͍ Schema ʹݱΕʹ͘͘ͳΔ Debug తڐ༰ ʮProto ͷ௨Γʹ request ͨ͠Β header ͕Γͣʹ͔ΕΔʯͱ͔͕ىͬͯ͜͠·͏ ৴༻͍ͨ͠߹֎෦͔Β inject Ͱ͖ͳ͍Έ͕ඞཁ ʮX-Current-User-Id ΛͱʹೝՄͯ͠Α͍ʯͱ͍͏ policy ͔ͳΓ৻ॏʹ Metadata proto ʹ serialize ͢Δͱ͍͏ΞΠσΞ͋Δ(ະ࣮) ຊ൪ͰΕྑ͍͠ɺabuse ͞Εͯக໋తͰͳ͍
©2021 Wantedly, Inc. Service Mesh ࠓ͍Δ Virtual Cluster ʹ߹Θͤͨ routing
Header ʹԠͯ͡ request ઌΛม͑Δ e.g. X-Fork-Identifier: forked-a ֎͔ΒݟΔͱ࣮࣭ copy ڞ༗͍ͯ͠Δ microservice ෳ͋ΔΑ͏ʹݟ͑Δ ͬͪ͜ͷ path Λ௨͍ͬͯΔΑ͏ʹײ͡Δ ͨͩ͠Ӆṭ͕ॏཁ Service mesh Λҙࣝ͢Δͱ copy ʹײ͡ͳ͘ͳΔ ͋͑ͯʮcopy ͕Ͱ͖Δʯ͑ͨ΄͏͕ΘΕΔ Έ͔Βઆ໌͢Δͱ͍͠ͱײ͡ΒΕͯ͠·͏
©2021 Wantedly, Inc. Gateway Host ʹ߹Θͤͯ header Λ༩ Wildcard DNS
͕͍ͨ proxy ʮCopy ͞ΕͯΔײʯʹॏཁ fork-a.example.com Έ͍ͨͳ URL ͕ൃߦ͞ΕΔ ֎͔ΒݟΔͱʮcopy ͞Ε࣮ͨଶʯ ʮURL ͕ൃߦͰ͖Δʯ͜ͱ͕ϝϯλϧϞσϧߏஙʹྑ͍ Wantedly Ͱ͜ͷػೳ͕Ͱ͖Δ·Ͱܟԕ͞Ε͕ͪͩͬͨ Routing ͷ͠͞ΛӅṭ ͜͜ʹଓ͍ͯ͠Δؾ࣋ͪʹͳΕΔ URL ͕͋Δͱڞ༗͕Ͱ͖Δ ࣗͷมߋΛଞͷਓʹ৮ͬͯΒ͑Δ Mobile ͔ΒମݧΛ͔֬ΊΔ
©2021 Wantedly, Inc. 20209݄࣌Ͱ Chrome Extension ͷΈͷରԠͩͬͨ ࠓͲ͜ʹܨ͍Ͱ͍Δͷ͔ʁ͕͔ΓͮΒ͔ͬͨ https://speakerdeck.com/morux2/istio-integrated-telepresence?slide=44 Gateway
Host ʹ߹Θͤͯ header Λ༩ Wildcard DNS ͕͍ͨ proxy ʮCopy ͞ΕͯΔײʯʹॏཁ fork-a.example.com Έ͍ͨͳ URL ͕ൃߦ͞ΕΔ ֎͔ΒݟΔͱʮcopy ͞Ε࣮ͨଶʯ ʮURL ͕ൃߦͰ͖Δʯ͜ͱ͕ϝϯλϧϞσϧߏஙʹྑ͍ Wantedly Ͱ͜ͷػೳ͕Ͱ͖Δ·Ͱܟԕ͞Ε͕ͪͩͬͨ Routing ͷ͠͞ΛӅṭ URL ͕͋Δͱڞ༗͕Ͱ͖Δ ࣗͷมߋΛଞͷਓʹ৮ͬͯΒ͑Δ Mobile ͔ΒମݧΛ͔֬ΊΔ Chrome Ҏ֎ͰରԠͰ͖ͳ͔ͬͨ
©2021 Wantedly, Inc. Context Propagation Service Mesh Gateway Header Λൖ
Header Ͱ Routing Host Λ Header ʹม HOW Copy on Write Ͱ Virtual Copy Photo by Alina Grubnyak on Unsplash
©2021 Wantedly, Inc. ࣮ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name:
wantedly-some-identifier namespace: wantedly spec: identifier: some-identifier manager: fork-proxy-ambassador/default services: selector: matchLabels: role: web deployments: selector: matchLabels: newrelic: "true" template: metadata: labels: app: some-identifier role: fork annotations: wantedly.com/deploy-target: "false" spec: containers: - image: example:tag name: wantedly CRD Ͱ atomic ͳॲཧʹݟͤΔ
©2021 Wantedly, Inc. ࣮ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name:
wantedly-some-identifier namespace: wantedly spec: identifier: some-identifier manager: fork-proxy-ambassador/default services: selector: matchLabels: role: web deployments: selector: matchLabels: newrelic: "true" template: metadata: labels: app: some-identifier role: fork annotations: wantedly.com/deploy-target: "false" spec: containers: - image: example:tag name: wantedly some-identifer ͱ͍͏ id Ͱ cluster ൃߦΛґཔ CRD Ͱ atomic ͳॲཧʹݟͤΔ
©2021 Wantedly, Inc. ࣮ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name:
wantedly-some-identifier namespace: wantedly spec: identifier: some-identifier manager: fork-proxy-ambassador/default services: selector: matchLabels: role: web deployments: selector: matchLabels: newrelic: "true" template: metadata: labels: app: some-identifier role: fork annotations: wantedly.com/deploy-target: "false" spec: containers: - image: example:tag name: wantedly some-identifer ͱ͍͏ id Ͱ cluster ൃߦΛґཔ Namespce Ͱ copy ͢Δ͖ service Λࢦఆ CRD Ͱ atomic ͳॲཧʹݟͤΔ
©2021 Wantedly, Inc. ࣮ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name:
wantedly-some-identifier namespace: wantedly spec: identifier: some-identifier manager: fork-proxy-ambassador/default services: selector: matchLabels: role: web deployments: selector: matchLabels: newrelic: "true" template: metadata: labels: app: some-identifier role: fork annotations: wantedly.com/deploy-target: "false" spec: containers: - image: example:tag name: wantedly some-identifer ͱ͍͏ id Ͱ cluster ൃߦΛґཔ Namespce Ͱ copy ͢Δ͖ service Λࢦఆ ͦͷ service ͔Β route ͞ΕΔ deploy Λ list ͯ͠ߋʹ੍ݶ CRD Ͱ atomic ͳॲཧʹݟͤΔ
©2021 Wantedly, Inc. ࣮ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name:
wantedly-some-identifier namespace: wantedly spec: identifier: some-identifier manager: fork-proxy-ambassador/default services: selector: matchLabels: role: web deployments: selector: matchLabels: newrelic: "true" template: metadata: labels: app: some-identifier role: fork annotations: wantedly.com/deploy-target: "false" spec: containers: - image: example:tag name: wantedly some-identifer ͱ͍͏ id Ͱ cluster ൃߦΛґཔ Namespce Ͱ copy ͢Δ͖ service Λࢦఆ ͦͷ service ͔Β route ͞ΕΔ deploy Λ list ͯ͠ߋʹ੍ݶ pod template ͷ patch Λ copy ʹͯΔ CRD Ͱ atomic ͳॲཧʹݟͤΔ
©2021 Wantedly, Inc. ࣮ CRDͰදݱ Gateway Service Mesh Copy ੜ
CRD͔ΒશͯΛੜ
©2021 Wantedly, Inc. ࣮ apiVersion: getambassador.io/v2 kind: Mapping metadata: labels:
fork.k8s.wantedly.com/manager: default name: some-dev-wantedly-com-some-identifier namespace: fork-proxy-ambassador spec: add_request_headers: x-fork-identifier: some-identifier ambassador_id: - fork-proxy-ambassador host: some-identifier.some-dev.wantedly.com prefix: / service: https://some-dev.wantedly.com Gateway ͱͯ͠ͷ Mapping ੜ ൖ͢Δ header ΛՃ ಛఆͷ host ͱͯ͠ request ͕དྷͨΒ ਖ਼͍͠ upstream ʹଓ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: ForkManager metadata: name: default namespace: fork-proxy-ambassador spec: upstreams: - host: "some-dev.wantedly.com" - host: "another-dev.wantedly.com" - host: "yet-another-dev.wantedly.com" - host: … Cluster ͷೖΓޱΛ༧Ί list ͓ͯ͘͠ Upstreams * Virtual Cluster ͷͷ mapping ͕ੜ͞ΕΔ ಉ͜͡ͱ͕Ͱ͖Ε Ambassador ͡Όͳ͍͍ͯ͘
©2021 Wantedly, Inc. WHAT Telepresence ͠์ Copy ͞Εͨ virtual cluster
ͰԿΛͬͯ୭ʹ໎Λ͔͚ͳ͍ Feature Flag ͝ͱʹ؆୯ʹ URL Λൃߦ Pull Request Preview URL ͲΜͳʹޙΖଆͷ Microservice Ͱ ok Pull Request Λ࡞ͬͨΒͦΕ͕ Preview Ͱ͖Δ URL ͕ൃߦͰ͖Δ new-feature-released.dev.example.com Έ͍ͨͳ URL ͕؆୯ʹ࡞ΕΔ Virtual cluster ͷͯ͢ͷ request Λ local ʹૹͬͯେৎ ͔͠Ճͷܭࢉࢿݯ͕Ұ͍Βͳ͍ Photo by SpaceX on Unsplash Ԡ༻ͱಘΒΕͨମݧ
©2021 Wantedly, Inc. Telepresence ͠์ Virtual cluster ͰԿͰ͋Γ ࣗઐ༻ͷڥͩͱײ͡ΒΕΔ Telepresence
ͯ͠େৎ ڞ༗ΫϥελͰ͏ͱଞͷਓͷ request ٵ͍ࠐΉ όάͬͨͷΛىಈͯ͠େৎ https://speakerdeck.com/morux2/istio-integrated-telepresence?slide=33 Virtual ͳΒࣗͷ request ͚ͩͳͷͰ҆શ ͜ͷ༻్ʹ͍ͭͯલճͷൃද͕ৄ͍͠
©2021 Wantedly, Inc. Feature Flag ͝ͱʹ؆୯ʹ URL Λൃߦ αʔόʔͷҙͷڍಈΛ override
Ͱ͖Δج൫Λ͍࣋ͬͯͨ શͯͷ AB test ໌ࣔతʹ annotate ͨ͠ͷ Rails ͷ ҙͷHelper ͷҙͷ method X-Feature-Flags: {"name": "new_feature?": "enabled": true} Header ΛૹΓ͚ͭΔ͚ͩͰྑ͍ ൖ͞Ε͍ͯΔͷͰޙΖଆͷ microservice ͷڍಈม͑ΒΕΔ Assets ͚ͩखݩͷ webpack-dev-server Λ͏ ༗༻ͳ Debug πʔϧ AB test ͷಛఆͷ variant Ͱදࣔ͢Δ ϦϦʔεલͷػೳΛ৮Δ Host / Header มج൫ͱͯ͠ͷ Gateway Λ༗ޮར༻ https://speakerdeck.com/potsbo/wrap-every-method-with-just-one-line ؆୯ʹ Header ΛՃͰ͖Δ Chrome Extension Λ࡞͍ͬͯͨ
©2021 Wantedly, Inc. Feature Flag ͝ͱʹ؆୯ʹ URL Λൃߦ Gateway ͱ
integrate some.wantedly.com some-dev.wantedly.com new-feature-released.some-dev.wantedly.com ຊ൪ ։ൃ NEW!! Host / Header มج൫ͱͯ͠ͷ Gateway Λ༗ޮར༻ apiVersion: vsconfig.k8s.wantedly.com/v1beta1 kind: Fork metadata: name: new-feature-enabled namespace: wantedly spec: identifier: new-feature-enabled manager: fork-proxy-ambassador/default gatewayOptions: addRequestHeaders: x-feature-flags: '{"name": "new_feature?": "enabled": true}' Feature Flag Header Λૠೖ Resourceফඅ͕օແ Virtual Cluster ͍ग़͞ΕΔ ͜ͷͨΊ URL ͍ग़͞ΕΔ ͔͠͠৽نͷ pod Ұͳ͍
©2021 Wantedly, Inc. Pull Request Preview URL Microservice Ͱ Preview
Ͱ͖Δ ͲΜͳʹޙΖଆͷ Microservice Ͱ࣮ࡍͷ UI ͔Β࣮֬ʹ౸ୡͰ͖Δ ※·ͩͯ͠ͳ͍ͷͰΠϝʔδͰ͢… σβΠφͱͷ Review εϜʔζʹͳΔ Microservice ؔͳͯ͘ศར GitHub ͷ webhook ʹ߹Θͤͯ fork Λ࡞Δ͚ͩ
©2021 Wantedly, Inc. Pull Request Preview URL GitHub ͷ webhook
ʹ߹Θͤͯ fork Λ࡞Δ͚ͩ
©2021 Wantedly, Inc. ࠷ޙʹ༨ஊ ج൫ੵΈ্͛ Context Propagation ࣾڞ௨ϥΠϒϥϦ͕͔͋ͬͨΒ࡞Εͨ ൖͱͱ Feature
Flag ༻ͷج൫ͩͬͨͷΛ͍·Θͨ͠ Istio / Ambassador ͕ेݕূ͞ΕͯಋೖࡁΈͩͬͨ ݹ͍αʔϏεશͯ Kubernetes ʹҠߦ͖͍ͬͯͨ͠ Deployment Λ Copy ͢Δ CRD ͕࡞ࡁΈͩͬͨ શ෦ Terraform ͔ͩͬͨΒূ໌ॻ/DNSΛҰؾʹ૿ͤͨ …
©2021 Wantedly, Inc. Context Propagation Service Mesh Gateway Header Λൖ
Header Ͱ Routing Host Λ Header ʹม Կ͔ͱ͋Δͱศརͳ3ͭͷج൫ Photo by Alina Grubnyak on Unsplash
©2021 Wantedly, Inc. ʮCluster Copy ͱ͍͏நԽʯ͕͋Δͱ ։ൃϨϏϡʔQAָʹͳΔ ·ͱΊ ج൫ΛੵΈ্͍͛ͯ͜͏