Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
kustomizeでCustomResourceにいい感じにStrategicMergePat...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
s-shirayama
August 26, 2021
Technology
1.8k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
kustomizeでCustomResourceにいい感じにStrategicMergePatchする / StrategicMergePatch to CustomResource with Kustomize
Kubernetes Meetup Tokyo #44のLT発表資料です。
https://k8sjp.connpass.com/event/218143/
s-shirayama
August 26, 2021
More Decks by s-shirayama
See All by s-shirayama
安心・安全なCluster移行で実現するKubernetesのバージョンアップ / Kubernetes upgrade with cluster migration
sshirayama
1
1.2k
How Istio helped us investigate failures on our microservices
sshirayama
0
93
継続的なバージョンアップのためのテスト戦略 〜自動テストの導入とコンテナ化〜 / Testing Strategy for Continuous Version Up
sshirayama
1
810
Other Decks in Technology
See All in Technology
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
120
3つのアプローチで目指す チームを強くするAI駆動開発
thkt
0
150
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
580
今さら理解するウェブフォントver.2026
takanorip
3
570
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
1.9k
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.3k
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
1
130
Incremental HTTP
kazuho
5
2.1k
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
1
710
OR学会2026年秋期大会_機械学習と数理最適化の融合による、配合レシピ最適化システム開発事例
brainpadpr
0
110
The seven pitfalls of AI (revised version)
ufried
0
310
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
130
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
560
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Being A Developer After 40
akosma
92
590k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Building AI with AI
inesmontani
PRO
1
1.3k
RailsConf 2023
tenderlove
30
1.6k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.1k
Transcript
kustomizeでCustomResourceにいい感じに StrategicMergePatchする Kubernetes Meetup Tokyo #44 LT Shota Shirayama ECインキュベーション開発部
Rakuten Group, Inc.
2 kustomize 便利ですよね base overlays output + = • base/*
→ 共通の設定 • overlays/development/* → 開発環境特有の設定 • overlays/production/* → 本番環境特有の設定
3 CustomResource だと StrategicMergePatch がいい感じにあたらない base overlays output + =
Overlaysで指定したリストで置き換えられてしまう。 (kustomizeがリストを扱うときのDefaultの挙動)
4 なぜ︖ k8s Native Resource のスキーマ定義が kustomize内で参照されている。 x-kubernetes-patch-xxx で何をキーにマージ するのかが指定されている。
これが指定されていない場合、kustomizeは arrayをそのまま置き換えてしまう。 https://github.com/kubernetes- sigs/kustomize/blob/kustomize/v4.2.0/kyaml/openapi/kubernetesapi/v1204/swagger.json
5 CustomResrouce⽤の独⾃のスキーマ定義も利⽤できるようになった • v4.1.0 (2021/4/14 Release) の追加機能 • 独⾃のスキーマ定義ファイルをkustomizeで読み込むことができる https://github.com/kubernetes-
sigs/kustomize/blob/kustomize/v4.2.0/examples/customOpenAPIschema.md ただし、利⽤にはいくつか注意したい点がある
6 CR⽤のスキーマ定義利⽤時の注意点︓公式のスキーマ定義の提供がない • CustomResrouceの提供元から公式のスキーマ定義が提供されていない場合がある • 例)ArgoRolloutはIssue #1210にあがっているが未提供(2021/8/16時点) ↓ • ⾃作する必要がある。
7 CR⽤のスキーマ定義利⽤時の注意点︓ Defaultのスキーマ定義は読み込まれない • 独⾃のスキーマ定義を読み込むと、kustomizeがDefaultで読み込んでいたk8s Native Resrouceのスキーマ定義は読み込まれない。 • DeploymentなどにStrategicMergePatch がいい感じにあたらなくなる
↓ • kustomizeのDefaultで読み込まれているスキーマ定義と、独⾃のスキーマ定義を マージしたスキーマ定義ファイルを作成する DEFAULT_SCHEMA_URL= https://raw.githubusercontent.com/kubernetes- sigs/kustomize/kustomize/v4.2.0/kyaml/openapi/kubernetesapi/v1204/swagger.json
8 CR⽤のスキーマ定義利⽤時の注意点︓ Remoteのスキーマ定義は参照できない • “openapi:” では、“resources:” や “configurations:” のようにRemoteのURLを指定する ことができない
• kustomize buildするそれぞれの場所にスキーマ定義ファイルを配置しておかな ければならない ↓ • Base⽤のリポジトリを各Manifest⽤のリポジトリから参照する⽅式を採⽤した Base repo Manifest repo Manifest repo Manifest repo schema.json kustomization.yaml
9 まとめ • kustomizeでCustomResourceにいい感じにStrategicMergePatchできなかったが、 v4.1.0からはできるようになった。 • ただし、利⽤する際にはいくつか注意点がある • 公式のスキーマ定義の提供がない場合がある •
Defaultのスキーマ定義は読み込まれない • Remoteのスキーマ定義は参照できない
None