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
2.1k
Other Decks in Technology
See All in Technology
データ活用促進のためのデータ分析基盤の進化
takumakouno
2
770
SREの組織類型に応じた リーダシップの考察
kenta_hi
PRO
1
640
"君は見ているが観察していない"で考えるインシデントマネジメント
grimoh
4
1.1k
AWS⼊社という選択肢、⾒えていますか
iwamot
2
1.1k
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
140
フルカイテン株式会社 採用資料
fullkaiten
0
40k
OCI Data Integration技術情報 / ocidi_technical_jp
oracle4engineer
PRO
1
2.6k
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
450
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
150
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
2
860
State of Open Source Web Mapping Libraries
dayjournal
0
230
AGIについてChatGPTに聞いてみた
blueb
0
100
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
33
2.9k
The Invisible Side of Design
smashingmag
297
50k
GitHub's CSS Performance
jonrohan
1030
460k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Language of Interfaces
destraynor
154
24k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Why Our Code Smells
bkeepers
PRO
334
57k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Building Applications with DynamoDB
mza
90
6.1k
Being A Developer After 40
akosma
86
590k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
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 $BDI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CKFDUT %FQMPZNFOU 3FQMJDB4FU 1PE %FQMPZNFOU 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 (FUUIFPCKFDUGSPNDBDIFTUPS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TUPSF )BOEMFS ᶆ ᶇ %FQMPZNFOU 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 ؾʹͳΔਓΛ͔͚͍ͯͩ͘͞