Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kubernetes の API Client における キャッシュ設計 / Cache De...
Search
Takayuki Kasai
May 18, 2019
Technology
6
4.1k
Kubernetes の API Client における キャッシュ設計 / Cache Design in Kubernetes API Client
Go Conference 2019 Spring
Takayuki Kasai
May 18, 2019
Tweet
Share
More Decks by Takayuki Kasai
See All by Takayuki Kasai
DVC を活用した機械学習パイプライン開発の高速化 / Using DVC to accelerate machine learning pipeline development
unblee
3
2.8k
自作 Controller による Secret の配布と収集 / Distributing and collecting secrets with self-made controller
unblee
4
2k
Other Decks in Technology
See All in Technology
LINEヤフー新卒採用 コーディングテスト解説 アルゴリズム問題編
lycorp_recruit_jp
0
13k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
48k
地域DXにおけるGrafana活用事例
wacky
0
250
Webセキュリティのあるきかた
akiym
32
11k
CData Virtuality 日本ローンチイベントのKeynote
cdataj
0
350
ADRを運用して3年経った僕らの現在地
onk
PRO
13
5.9k
O'Reilly Superstream: Building a RAG App to Chat with Your Data
pamelafox
0
120
Vespaを利用したテクいベクトル検索
szdr
2
200
What a Good Platform Looks Like and How to Get There @ Large Financial Organization, Oct 2024
mfpais
PRO
0
100
入門 バックアップ
ryuichi1208
18
7.2k
エンジニア向け会社紹介資料
caddi_eng
14
270k
SageMaker学習のツボ / The Key Points of Learning SageMaker
cmhiranofumio
0
220
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
41
9.2k
How to Ace a Technical Interview
jacobian
275
23k
Making the Leap to Tech Lead
cromwellryan
131
8.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Designing with Data
zakiwarfel
98
5.1k
Music & Morning Musume
bryan
46
6.1k
Visualization
eitanlees
143
15k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2k
Designing for Performance
lara
604
68k
The World Runs on Bad Software
bkeepers
PRO
65
11k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Transcript
©2019 Wantedly, Inc. Kubernetes ͷ API Client ʹ͓͚Δ Ωϟογϡઃܭ Go
Conference 2019 Spring Takayuki Kasai (@unblee) Wantedly, Inc. 2019.5.18 -
©2019 Wantedly, Inc. !VOCMFF5BLBZVLJ,BTBJ *OGSBTUSVDUVSF&OHJOFFS 8BOUFEMZ *OD ৽ଔ
©2019 Wantedly, Inc. w (PQIFST$PEF3FBEJOH1BSUZʢࣾษڧձʣͰͷίʔυϦʔσΟϯά w αʔϏεج൫ͱͯ͠,VCFSOFUFTΛ༻͍ͯ͠Δ ςʔϚઃఆͷಈػ
©2019 Wantedly, Inc. w ,VCFSOFUFTͷΞʔΩςΫνϟͷಛ w ΞʔΩςΫνϟʹଇͬͨ"1*ϦΫΤετΛݮ͢ΔͨΊͷΩϟογϡઃܭ ࠓ͢͜ͱ
©2019 Wantedly, Inc. w ίϯςφӡ༻ΛࣗಈԽ͢ΔͨΊͷϓϥοτϑΥʔϜ w σϓϩΠɺΦʔτεέʔϧɺࣗݾճ෮ɺϦιʔε࠷దԽɺFUD w ෳͷখ͍͞αʔϏε͕ڠௐಈ࡞ͯ͠ػೳΛ࣮ݱ͍ͯ͠ΔࢄγεςϜ ,VCFSOFUFTͱ
IUUQTLVCFSOFUFTJP
©2019 Wantedly, Inc. /PEF /PEF ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF $POUSPMMFS $POUSPMMFS 3FTPVSDFͷঢ়ଶΛ࣮ڥ্ʹөͤ͞Δ 3FTPVSDFૢ࡞ରΛநԽͨ֓͠೦ ίϯςφɺϩʔυόϥϯαɺFUD
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF "1*4FSWFS 3FTPVSDFΛૢ࡞͢ΔͨΊͷ"1*&OEQPJOUΛఏڙ͢Δ 3FTPVSDFͷมߋΠϕϯτΛ௨͢ΔͨΊͷ8BUDI"1*ఏڙ͍ͯ͠Δ
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF 4UBUF4UPSF 3FTPVSDFͷঢ়ଶઃఆɺൿಗใͱ͍ͬͨ ,VCFSOFUFTΛߏ͢ΔͨΊͷσʔλ͕อଘ͞Ε͍ͯΔ
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF 4UBUF4UPSF ίϯςφΛૢ࡞͢Δྫ "1*4FSWFS $POUSPMMFS $POUBJOFS 3FTPVSDF $POUBJOFS 0CKFDU ,VCFSOFUFTʹ͓͚Δঢ়ଶ $POUBJOFS3FTPVSDFͷ0CKFDUͱͯ͠อଘ͞Ε͍ͯΔ $POUSPMMFS ˞$POUBJOFS3FTPVSDFઆ໌Λ؆୯ʹ͢ΔͨΊʹઃఆͨ͠Ծͷ3FTPVSDF ɹ࣮ࡍʹ1PE3FTPVSDF
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF 4UBUF4UPSF ίϯςφΛૢ࡞͢Δྫ "1*4FSWFS $POUSPMMFS $POUBJOFS 3FTPVSDF $POUBJOFS 0CKFDU 8BUDI"1*Λར༻ͯ͠ $POUBJOFS3FTPVSDFΛࢹ͍ͯ͠Δ Πϕϯτʢ࡞ɾߋ৽ɾআʣΛݕͨ͠Β ରͷ$POUBJOFS0CKFDUͷঢ়ଶ·Ͱ ࣮ࡍͷίϯςφΛૢ࡞͢Δ $POUSPMMFS $POUBJOFS
©2019 Wantedly, Inc. /PEF $POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS /PEF
$POUBJOFS $POUSPMMFS $POUBJOFS $POUBJOFS $POUBJOFS ,VCFSOFUFTͷΞʔΩςΫνϟ .BTUFS "1*4FSWFS 4UBUF4UPSF w ͯ͢ͷૢ࡞"1*ϦΫΤετͰߦ͏ w ֤$POUSPMMFSಛఆͷ3FTPVSDFΛࢹ͍ͯ͠Δ w 3FTPVSDFͱ$POUSPMMFS/ͷؔ w ͭͷ3FTPVSDF0CKFDUΛૢ࡞͢Δ͚ͩͰෳͷ$POUSPMMFS͕ಈ࡞͢Δ w "1*ϦΫΤετ͕େྔʹൃߦ͞ΕΔ
©2019 Wantedly, Inc. େྔͷ"1*ϦΫΤετʹΑΔ ύϑΥʔϚϯεվળͷͨΊʹ࣮͞Εͨͷ w 3FGIUUQTLVCFSOFUFTJPCMPHLVCFSOFUFTQFSGPSNBODF NFBTVSFNFOUTBOE w "1*4FSWFSʹ8BUDI"1*ͱΩϟογϡػೳΛ࣮ͨ͠
w 8BUDI"1*ϕʔεͰಈ࡞͢ΔΑ͏ʹ$POUSPMMFSΛॻ͖͑ͨ w ෛՙʹΑͬͯ"1*&OEQPJOUͷϨεϙϯελΠϜ͕͘ͳΔ w ͕ͯ͢"1*ʹΑ੍ͬͯޚ͞Ε͍ͯΔͷͰɺશମతͳಈ࡞͕ॏ͘ͳΔ
©2019 Wantedly, Inc. $POUSPMMFSʹ͓͚ΔΩϟογϡઃܭͷ֓ཁ "1*4FSWFS *OGPSNFS -JTU 8BUDI FWFOUT 1PQBPCKFDUGSPNRVFVF
"EEUIFPCKFDU /PUJGZFWFOU $IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ ,VCFSOFUFT"1*$MJFOU1BDLBHFҎԼʹΩϟογϡػߏ͕ఏڙ͞Ε͍ͯΔ IUUQTHPEPDPSHLTJPDMJFOUHPUPPMTDBDIF w $POUSPMMFSͰར༻͞Ε͍ͯΔ w 8BUDI"1*ΛલఏʹΩϟογϡػߏΛߏங͍ͯ͠Δ w ىಈ࣌ʹͯ͢ͷΦϒδΣΫτΛΩϟογϡͯ͠ $POUSPMMFSΩϟογϡ͔ΒΦϒδΣΫτΛऔಘͰ͖Δ
©2019 Wantedly, Inc. $POUSPMMFSʹ͓͚ΔΩϟογϡઃܭͷ֓ཁ "1*4FSWFS *OGPSNFS -JTU 8BUDI FWFOUT 1PQBPCKFDUGSPNRVFVF
"EEUIFPCKFDU /PUJGZFWFOU $IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3Fq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QMPZNFOU 3FQMJDB4FU 1PE type Deployment struct { metav1.TypeMeta metav1.ObjectMeta Spec DeploymentSpec Status DeploymentStatus } IUUQTHPEPDPSHLTJPBQJBQQTW%FQMPZNFOU
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS -JTU 8BUDI FWFOUT 1PQBPCKFDUGSPNRVFVF
"EEUIFPCKFDU /PUJGZFWFOU $IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ "1*4FSWFS (FUBMMUBSHFUSFTPVSDFPCKFDUT $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶃ EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ ᶄ $BDIFBMMPCKFDUT %FQMPZNFOU 3FQMJDB4FU 1PE %FQMPZNFOU 3FQMJDB4FU 1PE type Lister interface { List(options metav1.ListOptions) (runtime.Object, error) } type Watcher interface { Watch(options metav1.ListOptions) (watch.Interface, error) } type ListerWatcher interface { Lister Watcher } IUUQTHPEPDPSHLTJPDMJFOUHPUPPMTDBDIF-JTUFS8BUDIFS IUUQTHPEPDPSHLTJPDMJFOUHPUPPMTDBDIF-JTUFS IUUQTHPEPDPSHLTJPDMJFOUHPUPPMTDBDIF8BUDIFS
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS -JTU 8BUDI FWFOUT 1PQBPCKFDUGSPNRVFVF
"EEUIFPCKFDU /PUJGZFWFOU $IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().Deployments(namespace).List(options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } return client.AppsV1().Deployments(namespace).Watch(options) }, }, &appsv1.Deployment{}, resyncPeriod, indexers, ) IUUQTHJUIVCDPNLVCFSOFUFTDMJFOUHPCMPCCEGCFDCCF⒎EDDBJOGPSNFSTBQQTWEFQMPZNFOUHP--
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS 8BUDIUBSHFUSFTPVSDFFWFOUT 1PQBPCKFDUGSPNRVFVF "EEUIFPCKFDU /PUJGZFWFOU
$IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ %FQMPZNFOU 3FQMJDB4FU 1PE %FQMPZNFOU 3FQMJDB4FU 1PE EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ શମͷΩϟογϡྃޙ
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS 8BUDIUBSHFUSFTPVSDFFWFOUT 1PQBPCKFDUGSPNRVFVF "EEUIFPCKFDU /PUJGZFWFOU
$IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0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3FQMJDB4FU 1PE
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS 8BUDIUBSHFUSFTPVSDFFWFOUT 1PQBPCKFDUGSPNRVFVF "EEUIFPCKFDU /PUJGZFWFOU
$IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ %FQMPZNFOU 3FQMJDB4FU 1PE %FQMPZNFOU 3FQMJDB4FU 1PE EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ )BOEMFS %FQMPZNFOU 3FQMJDB4FU 1PE type ResourceEventHandler interface { OnAdd(obj interface{}) OnUpdate(oldObj, newObj interface{}) OnDelete(obj interface{}) } IUUQTHPEPDPSHLTJPDMJFOUHPUPPMTDBDIF3FTPVSDF&WFOU)BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ %FQMPZNFOU 3FQMJDB4FU 1PE (FUUIFPCKFDUGSPNDBDIFTUPSF ᶇ
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS 8BUDIUBSHFUSFTPVSDFFWFOUT 1PQBPCKFDUGSPNRVFVF "EEUIFPCKFDU /PUJGZFWFOU
$IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ %FQMPZNFOU 3FQMJDB4FU 1PE %FQMPZNFOU 3FQMJDB4FU 1PE EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ func (dc *DeploymentController) syncDeployment(key string) error { namespace, name, err := cache.SplitMetaNamespaceKey(key) deployment, err := dc.dLister.Deployments(namespace).Get(name) d := deployment.DeepCopy() if reflect.DeepEqual(d.Spec.Selector, &everything) { dc.eventRecorder.Eventf(d, v1.EventTypeWarning, "SelectingAll", "This deployment is selecting all pods. A non- empty selector is required.") if d.Status.ObservedGeneration < d.Generation { d.Status.ObservedGeneration = d.Generation dc.client.AppsV1().Deployments(d.Namespace).UpdateStatus(d) } return nil } rsList, err := dc.getReplicaSetsForDeployment(d) podMap, err := dc.getPodMapForDeployment(d, rsList) if getRollbackTo(d) != nil { return dc.rollback(d, rsList) } scalingEvent, err := dc.isScalingEvent(d, rsList) switch d.Spec.Strategy.Type { case apps.RecreateDeploymentStrategyType: return dc.rolloutRecreate(d, rsList, podMap) case apps.RollingUpdateDeploymentStrategyType: return dc.rolloutRolling(d, rsList) } } IUUQTHJUIVCDPNLVCFSOFUFTLVCFSOFUFTCMPCBGGFFCFFCGBFFGFDQLHDPOUSPMMFSEFQMPZNFOUEFQMPZNFOU@DPOUSPMMFSHP--
©2019 Wantedly, Inc. EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFS *OGPSNFS 8BUDIUBSHFUSFTPVSDFFWFOUT 1PQBPCKFDUGSPNRVFVF "EEUIFPCKFDU /PUJGZFWFOU
$IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ 3FQMJDB4FU 1PE %FQMPZNFOU 3FQMJDB4FU 1PE EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ %FQMPZNFOU EFQMPZNFOUDPOUSPMMFSʹ͓͚ΔΩϟογϡར༻ "1*4FSWFSʹૢ࡞ޙͷΦϒδΣΫτΛ1045͢Δ )BOEMFS "1*4FSWFS %FQMPZNFOU 3FQMJDB4FU 1PE 3FQMJDB4FU 1PE $IBOHFUIFTUBUFPGUIFPCKFDU ᶈ
©2019 Wantedly, Inc. $POUSPMMFSʹ͓͚ΔΩϟογϡઃܭͷ֓ཁ "1*4FSWFS *OGPSNFS -JTU 8BUDI FWFOUT 1PQBPCKFDUGSPNRVFVF
"EEUIFPCKFDU /PUJGZFWFOU $IBOHFUIFTUBUFPGUIFPCKFDU (FUUIFPCKFDUGSPNDBDIFTUPSF DMJFOUHP 6TFS )BOEMFS $BDIF4UPSF 0CKFDU 0CKFDU 0CKFDU/ 3FqFDUPS 2VFVF ᶈ ᶃ ᶄ ᶅ ᶆ ᶇ
©2019 Wantedly, Inc. w ,VCFSOFUFTͰ"1*DMJFOUQBDLBHFʹΩϟογϡػߏ͕࣮͞Ε͍ͯΔ w ͭͷσʔλมߋ͕ಉ࣌ʹෳՕॴʹӨڹΛ༩͑ΔΞʔΩςΫνϟʹ͓͍ͯ ΦϒδΣΫτͷঢ়ଶΛΩϟογϡ͢Δઃܭ͕"1*ϦΫΤετͷݮʹ༗ޮ w ,VCFSOFUFTͷΑ͏ͳେن044ͰݸʑͷύοέʔδΛಡΜͰΈΔͱ໘ന͍
·ͱΊ
©2019 Wantedly, Inc. એ ຖि݄༵.JDSPTFSWJDFT.POEBZ IUUQTXXXXBOUFEMZDPNQSPKFDUT IUUQTHJUIVCDPNXBOUFEMZNJDSPTFSWJDFT@NPOEBZ ຖिਫ༵(PQIFST$PEF3FBEJOH1BSUZ IUUQTHJUIVCDPNXBOUFEMZHPQIFSTDPEFSFBEJOHQBSUZJTTVFT ؾʹͳΔਓΛ͔͚͍ͯͩ͘͞