mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 10:20:35 +00:00
Docs: build site
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="generator" content="Hugo 0.68.3" />
|
||||
<meta name="generator" content="Hugo 0.73.0-DEV" />
|
||||
|
||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://kubernetes-sigs.github.io/kustomize/zh/guides/plugins/builtins/" />
|
||||
<meta property="article:modified_time" content="2020-06-15T13:39:13+08:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta property="article:modified_time" content="2020-07-16T12:57:18-07:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta itemprop="name" content="内置插件">
|
||||
<meta itemprop="description" content="内置插件
|
||||
">
|
||||
<meta itemprop="dateModified" content="2020-06-15T13:39:13+08:00" />
|
||||
<meta itemprop="dateModified" content="2020-07-16T12:57:18-07:00" />
|
||||
<meta itemprop="wordCount" content="519">
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- application.properties<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- more.properties<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>my-java-server-env-vars<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>literals<span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">literals</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- JAVA_HOME=/opt/java/jdk<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- JAVA_TOOL_OPTIONS=-agentlib<span style="color:#000;font-weight:bold">:</span>hprof<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">options</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
@@ -923,7 +923,7 @@ is equivalent to <code>^myapp$</code>。</p>
|
||||
|
||||
|
||||
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年06月15日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/518147c129f831913d33226cf17068d0d4270f41">add zh docsy (518147c1)</a>
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年07月16日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/f9ee578aed600136133c3232fff03029cdfc526e">Docs: Auto-fix markdownlint issues (f9ee578a)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="generator" content="Hugo 0.68.3" />
|
||||
<meta name="generator" content="Hugo 0.73.0-DEV" />
|
||||
|
||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://kubernetes-sigs.github.io/kustomize/zh/guides/plugins/execpluginguidedexample/" />
|
||||
<meta property="article:modified_time" content="2020-06-15T13:39:13+08:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta property="article:modified_time" content="2020-07-16T12:57:18-07:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta itemprop="name" content="Exec 插件示例">
|
||||
<meta itemprop="description" content="60 秒在 Linux 构建一个 Exec 插件
|
||||
">
|
||||
<meta itemprop="dateModified" content="2020-06-15T13:39:13+08:00" />
|
||||
<meta itemprop="dateModified" content="2020-07-16T12:57:18-07:00" />
|
||||
<meta itemprop="wordCount" content="257">
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
<li><a href="#编写插件">编写插件</a></li>
|
||||
<li><a href="#安装-kustomize">安装 kustomize</a></li>
|
||||
<li><a href="#检查目录结构">检查目录结构</a></li>
|
||||
<li><a href="#使用插件构建-app">使用插件构建 APP:</a></li>
|
||||
<li><a href="#使用插件构建-app">使用插件构建 APP</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@@ -531,13 +531,13 @@ mkdir -p <span style="color:#000">$DEMO</span>/bin
|
||||
mv kustomize <span style="color:#000">$DEMO</span>/bin
|
||||
</code></pre></div><h2 id="检查目录结构">检查目录结构</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">tree <span style="color:#000">$DEMO</span>
|
||||
</code></pre></div><h2 id="使用插件构建-app">使用插件构建 APP:</h2>
|
||||
</code></pre></div><h2 id="使用插件构建-app">使用插件构建 APP</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#000">XDG_CONFIG_HOME</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span> <span style="color:#000">$DEMO</span>/bin/kustomize build --enable_alpha_plugins <span style="color:#000">$MYAPP</span>
|
||||
</code></pre></div><p>之前如果您已经设置了 <code>PLUGIN_ROOT=$HOME/.config/kustomize/plugin</code>,则无需在 <em>kustomize</em> 命令前使用 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
|
||||
|
||||
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年06月15日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/518147c129f831913d33226cf17068d0d4270f41">add zh docsy (518147c1)</a>
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年07月16日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/f9ee578aed600136133c3232fff03029cdfc526e">Docs: Auto-fix markdownlint issues (f9ee578a)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="generator" content="Hugo 0.68.3" />
|
||||
<meta name="generator" content="Hugo 0.73.0-DEV" />
|
||||
|
||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://kubernetes-sigs.github.io/kustomize/zh/guides/plugins/goplugincaveats/" />
|
||||
<meta property="article:modified_time" content="2020-06-15T13:39:13+08:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta property="article:modified_time" content="2020-07-16T12:57:18-07:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta itemprop="name" content="Go 插件注意事项">
|
||||
<meta itemprop="description" content="Go 插件注意事项
|
||||
">
|
||||
<meta itemprop="dateModified" content="2020-06-15T13:39:13+08:00" />
|
||||
<meta itemprop="dateModified" content="2020-07-16T12:57:18-07:00" />
|
||||
<meta itemprop="wordCount" content="145">
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
<nav id="TableOfContents">
|
||||
<ul>
|
||||
<li><a href="#the-skew-problem">The skew problem</a></li>
|
||||
<li><a href="#为什么支持-go-插件">为什么支持 Go 插件?</a>
|
||||
<li><a href="#为什么支持-go-插件">为什么支持 Go 插件</a>
|
||||
<ul>
|
||||
<li><a href="#安全">安全</a></li>
|
||||
<li><a href="#debugging">Debugging</a></li>
|
||||
@@ -418,7 +418,7 @@
|
||||
</span><span style="color:#4e9a06"></span> -o <span style="color:#4e9a06">${</span><span style="color:#000">wherever</span><span style="color:#4e9a06">}</span>/<span style="color:#4e9a06">${</span><span style="color:#000">kind</span><span style="color:#4e9a06">}</span>.so <span style="color:#4e9a06">${</span><span style="color:#000">wherever</span><span style="color:#4e9a06">}</span>/<span style="color:#4e9a06">${</span><span style="color:#000">kind</span><span style="color:#4e9a06">}</span>.go
|
||||
</code></pre></div><p>并根据需要调整路径和发行版本标记(例如 <code>v3.0.0</code>)。</p>
|
||||
<p>为了进行比较,可以参考编写 <a href="https://www.tensorflow.org/guide/extend/op">tensorflow plugin</a> 必须做的事情。</p>
|
||||
<h2 id="为什么支持-go-插件">为什么支持 Go 插件?</h2>
|
||||
<h2 id="为什么支持-go-插件">为什么支持 Go 插件</h2>
|
||||
<h3 id="安全">安全</h3>
|
||||
<p>Go 插件开发者可以操作与原生 kustomize 操作相同的 API,可确保某些语义、变量和检查等一致。exec 插件子进程通过 stdin/stdout 来处理这些问题,但对于下游的转化器和使用者来说,会更容易把事情搞砸。</p>
|
||||
<p>关键点:如果插件通过 kustomize 提供的文件 <code>Loader</code> 接口读取文件,则会受到 kustomize 文件加载限制的约束。当然,除了代码审计之外,没有什么可以阻止 Go 插件导入 io 包并执行其所需的任何操作。</p>
|
||||
@@ -432,7 +432,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年06月15日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/518147c129f831913d33226cf17068d0d4270f41">add zh docsy (518147c1)</a>
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年07月16日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/f9ee578aed600136133c3232fff03029cdfc526e">Docs: Auto-fix markdownlint issues (f9ee578a)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="generator" content="Hugo 0.68.3" />
|
||||
<meta name="generator" content="Hugo 0.73.0-DEV" />
|
||||
|
||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://kubernetes-sigs.github.io/kustomize/zh/guides/plugins/gopluginguidedexample/" />
|
||||
<meta property="article:modified_time" content="2020-06-15T13:39:13+08:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta property="article:modified_time" content="2020-07-16T12:57:18-07:00" /><meta property="og:site_name" content="Kustomize" />
|
||||
<meta itemprop="name" content="Go 插件示例">
|
||||
<meta itemprop="description" content="Go 插件示例
|
||||
">
|
||||
<meta itemprop="dateModified" content="2020-06-15T13:39:13+08:00" />
|
||||
<meta itemprop="dateModified" content="2020-07-16T12:57:18-07:00" />
|
||||
<meta itemprop="wordCount" content="429">
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
<li><a href="#安装-kustomize">安装 kustomize</a></li>
|
||||
<li><a href="#为插件创建目录">为插件创建目录</a>
|
||||
<ul>
|
||||
<li><a href="#使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind?</a></li>
|
||||
<li><a href="#使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind</a></li>
|
||||
<li><a href="#定义插件的主目录">定义插件的主目录</a></li>
|
||||
<li><a href="#下载-sopsencodedsecrets-插件">下载 SopsEncodedSecrets 插件</a></li>
|
||||
<li><a href="#尝试测试插件">尝试测试插件</a></li>
|
||||
@@ -363,7 +363,7 @@
|
||||
<li><a href="#用你的私钥创建加密数据">用你的私钥创建加密数据</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#使用插件构建您的应用">使用插件构建您的应用:</a></li>
|
||||
<li><a href="#使用插件构建您的应用">使用插件构建您的应用</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
<p>该示例将在如下临时目录中存放其使用的插件:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#000">PLUGIN_ROOT</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span>/kustomize/plugin
|
||||
</code></pre></div><p>并在下面的命令行中临时设置 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
<h3 id="使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind?</h3>
|
||||
<h3 id="使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind</h3>
|
||||
<p>在 kustomize 插件的开发时,插件代码不关心也不知道配置文件中的 <code>apiVersion</code> 或 <code>kind</code>。</p>
|
||||
<p>插件会检查这些字段,但是剩下的字段提供了实际的配置数据,在这一点上,成功解析其他字段对于插件很重要。</p>
|
||||
<p>本示例使用一个名为 <em>SopsEncodedSecrets</em> 的插件,其位于 <a href="https://github.com/monopole/sopsencodedsecrets">SopsEncodedSecrets repository</a> 中。</p>
|
||||
@@ -575,14 +575,14 @@ gcloud kms keys create sops-key --location global <span style="color:#4e9a06">\
|
||||
├── myEncryptedData.yaml
|
||||
└── secGenerator.yaml
|
||||
</code></pre></div></blockquote>
|
||||
<h2 id="使用插件构建您的应用">使用插件构建您的应用:</h2>
|
||||
<h2 id="使用插件构建您的应用">使用插件构建您的应用</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#000">XDG_CONFIG_HOME</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span> <span style="color:#000">$tmpGoPath</span>/bin/kustomize build --enable_alpha_plugins <span style="color:#000">$MYAPP</span>
|
||||
</code></pre></div><p>这将生成一个 kubernetes secret,并对名称 <code>ROCKET</code> 和 <code>CAR</code> 的数据进行加密。</p>
|
||||
<p>之前如果您已经设置了 <code>PLUGIN_ROOT=$HOME/.config/kustomize/plugin</code>,则无需在 <em>kustomize</em> 命令前使用 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
|
||||
|
||||
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年06月15日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/518147c129f831913d33226cf17068d0d4270f41">add zh docsy (518147c1)</a>
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年07月16日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/f9ee578aed600136133c3232fff03029cdfc526e">Docs: Auto-fix markdownlint issues (f9ee578a)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="generator" content="Hugo 0.68.3" />
|
||||
<meta name="generator" content="Hugo 0.73.0-DEV" />
|
||||
|
||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
||||
|
||||
@@ -485,7 +485,7 @@
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kustomize.config.k8s.io/needs-hash</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">"true"</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">foo</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bar<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">foo</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bar<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><p><strong><code>kustomize.config.k8s.io/behavior</code></strong></p>
|
||||
<p><code>behavior</code> 注释为当资源发生冲突时插件的处理方式,有效值包括:“create”、“merge “和 “replace”,默认为 “create”。</p>
|
||||
<p>示例:</p>
|
||||
@@ -496,7 +496,7 @@
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">kustomize.config.k8s.io/behavior</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">"merge"</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">data</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">foo</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bar<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">foo</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bar<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span></code></pre></div><h3 id="go-插件">Go 插件</h3>
|
||||
<p>请务必阅读 <a href="goPluginCaveats.md">Go 插件注意事项</a>。</p>
|
||||
<p>如果一个 <code>.go</code> 文件声明 <code>package main</code>,并附加了有用的功能标志,那么它就可以成为一个 <a href="https://golang.org/pkg/plugin/">Go 插件</a>。</p>
|
||||
@@ -506,8 +506,8 @@
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"><span style="color:#204a87;font-weight:bold">package</span> <span style="color:#000">main</span>
|
||||
|
||||
<span style="color:#204a87;font-weight:bold">import</span> <span style="color:#000;font-weight:bold">(</span>
|
||||
<span style="color:#4e9a06">"sigs.k8s.io/kustomize/api/ifc"</span>
|
||||
<span style="color:#4e9a06">"sigs.k8s.io/kustomize/api/resmap"</span>
|
||||
<span style="color:#4e9a06">"sigs.k8s.io/kustomize/api/ifc"</span>
|
||||
<span style="color:#4e9a06">"sigs.k8s.io/kustomize/api/resmap"</span>
|
||||
<span style="color:#ce5c00;font-weight:bold">...</span>
|
||||
<span style="color:#000;font-weight:bold">)</span>
|
||||
|
||||
@@ -600,7 +600,7 @@ go build -buildmode plugin <span style="color:#4e9a06">\
|
||||
|
||||
|
||||
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年06月15日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/518147c129f831913d33226cf17068d0d4270f41">add zh docsy (518147c1)</a>
|
||||
<div class="text-muted mt-5 pt-3 border-top">最后修改 2020年07月16日: <a href="https://github.com/kubernetes-sigs/kustomize/commit/f9ee578aed600136133c3232fff03029cdfc526e">Docs: Auto-fix markdownlint issues (f9ee578a)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- application.properties<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- more.properties<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"></span>- <span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>my-java-server-env-vars<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>literals<span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">literals</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- JAVA_HOME=/opt/java/jdk<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>- JAVA_TOOL_OPTIONS=-agentlib<span style="color:#000;font-weight:bold">:</span>hprof<span style="color:#f8f8f8;text-decoration:underline">
|
||||
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">options</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
|
||||
@@ -630,7 +630,7 @@ mkdir -p <span style="color:#000">$DEMO</span>/bin
|
||||
mv kustomize <span style="color:#000">$DEMO</span>/bin
|
||||
</code></pre></div><h2 id="检查目录结构">检查目录结构</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">tree <span style="color:#000">$DEMO</span>
|
||||
</code></pre></div><h2 id="使用插件构建-app">使用插件构建 APP:</h2>
|
||||
</code></pre></div><h2 id="使用插件构建-app">使用插件构建 APP</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#000">XDG_CONFIG_HOME</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span> <span style="color:#000">$DEMO</span>/bin/kustomize build --enable_alpha_plugins <span style="color:#000">$MYAPP</span>
|
||||
</code></pre></div><p>之前如果您已经设置了 <code>PLUGIN_ROOT=$HOME/.config/kustomize/plugin</code>,则无需在 <em>kustomize</em> 命令前使用 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
|
||||
@@ -666,7 +666,7 @@ mv kustomize <span style="color:#000">$DEMO</span>/bin
|
||||
</span><span style="color:#4e9a06"></span> -o <span style="color:#4e9a06">${</span><span style="color:#000">wherever</span><span style="color:#4e9a06">}</span>/<span style="color:#4e9a06">${</span><span style="color:#000">kind</span><span style="color:#4e9a06">}</span>.so <span style="color:#4e9a06">${</span><span style="color:#000">wherever</span><span style="color:#4e9a06">}</span>/<span style="color:#4e9a06">${</span><span style="color:#000">kind</span><span style="color:#4e9a06">}</span>.go
|
||||
</code></pre></div><p>并根据需要调整路径和发行版本标记(例如 <code>v3.0.0</code>)。</p>
|
||||
<p>为了进行比较,可以参考编写 <a href="https://www.tensorflow.org/guide/extend/op">tensorflow plugin</a> 必须做的事情。</p>
|
||||
<h2 id="为什么支持-go-插件">为什么支持 Go 插件?</h2>
|
||||
<h2 id="为什么支持-go-插件">为什么支持 Go 插件</h2>
|
||||
<h3 id="安全">安全</h3>
|
||||
<p>Go 插件开发者可以操作与原生 kustomize 操作相同的 API,可确保某些语义、变量和检查等一致。exec 插件子进程通过 stdin/stdout 来处理这些问题,但对于下游的转化器和使用者来说,会更容易把事情搞砸。</p>
|
||||
<p>关键点:如果插件通过 kustomize 提供的文件 <code>Loader</code> 接口读取文件,则会受到 kustomize 文件加载限制的约束。当然,除了代码审计之外,没有什么可以阻止 Go 插件导入 io 包并执行其所需的任何操作。</p>
|
||||
@@ -729,7 +729,7 @@ mv kustomize <span style="color:#000">$DEMO</span>/bin
|
||||
<p>该示例将在如下临时目录中存放其使用的插件:</p>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#000">PLUGIN_ROOT</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span>/kustomize/plugin
|
||||
</code></pre></div><p>并在下面的命令行中临时设置 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
<h3 id="使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind?</h3>
|
||||
<h3 id="使用什么-apiversion-和-kind">使用什么 apiVersion 和 kind</h3>
|
||||
<p>在 kustomize 插件的开发时,插件代码不关心也不知道配置文件中的 <code>apiVersion</code> 或 <code>kind</code>。</p>
|
||||
<p>插件会检查这些字段,但是剩下的字段提供了实际的配置数据,在这一点上,成功解析其他字段对于插件很重要。</p>
|
||||
<p>本示例使用一个名为 <em>SopsEncodedSecrets</em> 的插件,其位于 <a href="https://github.com/monopole/sopsencodedsecrets">SopsEncodedSecrets repository</a> 中。</p>
|
||||
@@ -853,7 +853,7 @@ gcloud kms keys create sops-key --location global <span style="color:#4e9
|
||||
├── myEncryptedData.yaml
|
||||
└── secGenerator.yaml
|
||||
</code></pre></div></blockquote>
|
||||
<h2 id="使用插件构建您的应用">使用插件构建您的应用:</h2>
|
||||
<h2 id="使用插件构建您的应用">使用插件构建您的应用</h2>
|
||||
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#000">XDG_CONFIG_HOME</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#000">$DEMO</span> <span style="color:#000">$tmpGoPath</span>/bin/kustomize build --enable_alpha_plugins <span style="color:#000">$MYAPP</span>
|
||||
</code></pre></div><p>这将生成一个 kubernetes secret,并对名称 <code>ROCKET</code> 和 <code>CAR</code> 的数据进行加密。</p>
|
||||
<p>之前如果您已经设置了 <code>PLUGIN_ROOT=$HOME/.config/kustomize/plugin</code>,则无需在 <em>kustomize</em> 命令前使用 <code>XDG_CONFIG_HOME</code>。</p>
|
||||
|
||||
Reference in New Issue
Block a user